module MCP::Tools

Included Modules

Defined in:

mcp/tools.cr

Constant Summary

Log = ::Log.for("mcp")
NAME_REGEX = /^([a-zA-Z0-9_-]+|hashtag#[a-zA-Z0-9_-]+|mention@[[email protected]]+)$/
TOOL_DEFINITIONS = [{name: "paginate_collection", description: "Paginate through collections of ActivityPub objects, activities, and actors. Use this tool when you want to inspect the contents of a collection.", properties: [{name: "name", type: "string", description: "Name of the collection to paginate", required: true, matches: NAME_REGEX}, {name: "page", type: "integer", description: "Page number (optional, defaults to 1)", minimum: 1, default: 1}, {name: "size", type: "integer", description: "Number of items per page (optional, defaults to 10, maximum 1000)", minimum: 1, maximum: 20, default: 10}]}, {name: "count_collection_since", description: "Count items in ActivityPub collections since a given time. Use this tool when you want to know if new items have been added in the last day/week/month.", properties: [{name: "name", type: "string", description: "Name of the collection to count", required: true, matches: NAME_REGEX}, {name: "since", type: "time", description: "Time (RFC3339) to count from", required: true}]}, {name: "read_resources", description: "Read one or more resources by URI (format \"ktistec://{resource}/{id*}\"). Supports all resource types including templated resources (actors, objects) and static resources (information, users). Supports batched reads (comma-separated IDs of resources of the same type). Use this tool as a universal fallback when resources are not supported by an MCP client.", properties: [{name: "uris", type: "array", description: "Resource URIs to read (e.g., ['ktistec://actors/123,456', 'ktistec://objects/456,789'])", required: true, items: "string"}]}] of ToolDefinition

Class Method Summary

Macro Summary

Macros inherited from module Utils::Paths

activity_path(activity = nil) activity_path, actor_path(actor = nil) actor_path, actor_relationships_path(actor = nil, relationship = nil) actor_relationships_path, actor_remote_follow_path(actor = nil) actor_remote_follow_path, admin_accounts_path admin_accounts_path, admin_path admin_path, anchor(object = nil) anchor, approve_path(object = nil) approve_path, back_path back_path, block_actor_path(actor = nil) block_actor_path, block_object_path(object = nil) block_object_path, cancel_fetch_hashtag_path(hashtag = nil) cancel_fetch_hashtag_path, cancel_fetch_thread_path(object = nil) cancel_fetch_thread_path, clear_translation_object_path(object = nil) clear_translation_object_path, create_translation_object_path(object = nil) create_translation_object_path, edit_object_path(object = nil) edit_object_path, everything_path everything_path, filter_path(filter = nil) filter_path, filters_path filters_path, follow_hashtag_path(hashtag = nil) follow_hashtag_path, follow_mention_path(mention = nil) follow_mention_path, follow_thread_path(object = nil) follow_thread_path, hashtag_path(hashtag = nil) hashtag_path, home_path home_path, inbox_path(actor = nil) inbox_path, mcp_actor_path(actor) mcp_actor_path, mcp_information_path mcp_information_path, mcp_object_path(object) mcp_object_path, mcp_user_path(account) mcp_user_path, mention_path(mention = nil) mention_path, metrics_path metrics_path, object_path(object = nil) object_path, object_remote_like_path(object = nil) object_remote_like_path, object_remote_reply_path(object = nil) object_remote_reply_path, object_remote_share_path(object = nil) object_remote_share_path, objects_path objects_path, outbox_path(actor = nil) outbox_path, refresh_remote_actor_path(actor = nil) refresh_remote_actor_path, remote_activity_path(activity = nil) remote_activity_path, remote_actor_path(actor = nil) remote_actor_path, remote_interaction_path remote_interaction_path, remote_object_path(object = nil) remote_object_path, remote_thread_path(object = nil, anchor = true) remote_thread_path, reply_path(object = nil) reply_path, search_path search_path, sessions_path sessions_path, settings_path settings_path, start_fetch_hashtag_path(hashtag = nil) start_fetch_hashtag_path, start_fetch_thread_path(object = nil) start_fetch_thread_path, system_path system_path, tasks_path tasks_path, thread_path(object = nil, anchor = true) thread_path, unapprove_path(object = nil) unapprove_path, unblock_actor_path(actor = nil) unblock_actor_path, unblock_object_path(object = nil) unblock_object_path, unfollow_hashtag_path(hashtag = nil) unfollow_hashtag_path, unfollow_mention_path(mention = nil) unfollow_mention_path, unfollow_thread_path(object = nil) unfollow_thread_path

Class Method Detail

def self.handle_tool_count_collection_since(params : JSON::Any, account : Account) : JSON::Any #

[View source]
def self.handle_tool_paginate_collection(params : JSON::Any, account : Account) : JSON::Any #

[View source]
def self.handle_tool_read_resources(params : JSON::Any, account : Account) : JSON::Any #

[View source]
def self.handle_tools_call(request : JSON::RPC::Request, account : Account) : JSON::Any #

[View source]
def self.handle_tools_list(request : JSON::RPC::Request) : JSON::Any #

[View source]

Macro Detail

macro def_tool(name, description, properties = [] of ToolPropertyDefinition, &block) #

[View source]