ExMCP.Client.Operations.Tools (ex_mcp v0.10.0)
View SourceTool operations for ExMCP client.
This module handles all tool-related operations including listing available tools, calling specific tools, and finding tools by name or pattern.
Summary
Functions
Calls a tool on the MCP server.
Finds a tool by name or pattern.
Lists all available tools from the MCP server.
Alias for list_tools/2.
Functions
@spec call_tool( ExMCP.Client.Types.client(), ExMCP.Client.Types.tool_name(), ExMCP.Client.Types.tool_arguments(), ExMCP.Client.Types.request_opts_or_timeout() ) :: ExMCP.Client.Types.mcp_response()
Calls a tool on the MCP server.
Options
:timeout- Request timeout (default: 30000):format- Response format (default: :map)
Examples
ExMCP.Client.Operations.Tools.call_tool(client, "my_tool", %{arg1: "value"})
ExMCP.Client.Operations.Tools.call_tool(client, "my_tool", %{arg1: "value"}, timeout: 60_000)
@spec find_tool( ExMCP.Client.Types.client(), String.t() | nil, ExMCP.Client.Types.request_opts() ) :: {:ok, map()} | {:error, :tool_not_found | any()}
Finds a tool by name or pattern.
If name_or_pattern is nil, it returns the first tool from the list.
Options
:fuzzy- If true, performs a fuzzy search (default: false):timeout- Request timeout (default: 5000):format- Response format (default: :map)
Examples
{:ok, tool} = ExMCP.Client.Operations.Tools.find_tool(client, "my_tool")
{:ok, tool} = ExMCP.Client.Operations.Tools.find_tool(client, "tool", fuzzy: true)
@spec list_tools(ExMCP.Client.Types.client(), ExMCP.Client.Types.request_opts()) :: ExMCP.Client.Types.mcp_response()
Lists all available tools from the MCP server.
Options
:timeout- Request timeout (default: 5000):format- Response format (default: :map)
Examples
{:ok, tools} = ExMCP.Client.Operations.Tools.list_tools(client)
{:ok, tools} = ExMCP.Client.Operations.Tools.list_tools(client, timeout: 10_000)
@spec tools(ExMCP.Client.Types.client(), ExMCP.Client.Types.request_opts()) :: ExMCP.Client.Types.mcp_response()
Alias for list_tools/2.