import { Command } from 'commander'; /** * CLI command for dynamic MCP server tool operations via API. * * This command provides a simplified CLI interface for interacting with MCP server tools, * supporting six actions: list-servers, list-tools, list-tags, get-tool, call-tool, and search-tools. It wraps * the HTTP API endpoints and requires the MCP Hub Lite server to be running. * * ## Command Format * * ``` * mcp-hub-lite tool-use [query] [--server ] [--tool ] [--args ] [--tags ] * ``` * * Or via npm: * ``` * npm run tool-use -- [query] [--server ] [--tool ] [--args ] [--tags ] * ``` * * ## Supported Actions * * - `list-servers` - List all connected MCP servers * - `list-tools` - List all tools from the specified server * - `list-tags` - List all instance tags for a specific MCP server * - `get-tool` - Get complete schema for a specific tool (requires --tool) * - `call-tool` - Call a tool on the specified server (requires --tool) * - `search-tools` - Search tools across all connected servers by name or description (requires query) * * ## Options * * - `--server ` - Server name to target (use "mcp-hub-lite" for system tools) * - `--tool ` - Tool name (required for get-tool and call-tool actions) * - `--args ` - JSON string of tool arguments, or combined JSON with server/tool/args fields * - `--tags ` - JSON object of instance selection tags (call-tool only, for multi-instance servers) * * ## JSON Merge Logic * * When `--args` contains `server`, `tool`, or `args` fields, they are extracted and merged: * - `server` field → effective server name * - `tool` field → effective tool name * - `args` field → tool arguments * - Other fields → treated as tool arguments * * This allows passing all parameters in a single JSON object via --args. * * ## Usage Examples * * ###分散参数形式 (Separate Arguments): * * ```bash * # List all connected servers * mcp-hub-lite tool-use list-servers * * # List system tools * mcp-hub-lite tool-use list-tools --server mcp-hub-lite * * # List third-party server tools * mcp-hub-lite tool-use list-tools --server baidu-search * * # List instance tags for a server * mcp-hub-lite tool-use list-tags --server chrome-devtools * * # Get system tool schema * mcp-hub-lite tool-use get-tool --tool list_tools --server mcp-hub-lite * * # Call system tool * mcp-hub-lite tool-use call-tool --tool list_tools --server mcp-hub-lite --args '{}' * * # Call third-party server tool * mcp-hub-lite tool-use call-tool --tool search --server baidu-search --args '{"query":"天气"}' * * # Multi-instance server with tags * mcp-hub-lite tool-use call-tool --tool search --server baidu-search --args '{"query":"test"}' --tags '{"env":"prod"}' * * # Search tools across all connected servers * mcp-hub-lite tool-use search-tools "weather" * ``` * * ### JSON 合并形式 (JSON Merge): * * ```bash * # All parameters in one JSON * mcp-hub-lite tool-use call-tool --args '{"server":"baidu-search","tool":"search","query":"天气"}' * * # System tool example * mcp-hub-lite tool-use call-tool --args '{"server":"mcp-hub-lite","tool":"list_tools"}' * * # Equivalent to * mcp-hub-lite tool-use call-tool --server baidu-search --tool search --args '{"query":"天气"}' * * # Search tools (JSON merge form) * mcp-hub-lite tool-use search-tools --args '{"query":"weather"}' * ``` * * ## Error Handling * * - Exits with code 1 if the server is not running * - Exits with code 1 if action is unknown * - Exits with code 1 if toolName is required but not provided * - Exits with code 1 if JSON parsing fails for --args or --tags * - Exits with code 1 if the underlying API call fails * * @returns {Command} The configured mcp-tool-use command instance for registration with Commander.js */ export declare const toolUseCommand: Command; //# sourceMappingURL=tool-use.d.ts.map