MCPcopy Create free account
hub / github.com/plotly/dash / call_tool

Function call_tool

dash/mcp/primitives/tools/__init__.py:33–48  ·  view source on GitHub ↗

Route a tools/call request by tool name. The optional ``task`` parameter (per MCP Tasks protocol) is passed through to providers that support background callbacks.

(
    tool_name: str, arguments: dict[str, Any], task: dict | None = None
)

Source from the content-addressed store, hash-verified

31
32
33def call_tool(
34 tool_name: str, arguments: dict[str, Any], task: dict | None = None
35) -> CallToolResult | CreateTaskResult:
36 """Route a tools/call request by tool name.
37
38 The optional ``task`` parameter (per MCP Tasks protocol) is passed
39 through to providers that support background callbacks.
40 """
41 for provider in _TOOL_PROVIDERS:
42 if tool_name in provider.get_tool_names():
43 return provider.call_tool(tool_name, arguments, task=task)
44 raise ToolNotFoundError(
45 f"Tool not found: {tool_name}."
46 " The app's callbacks may have changed."
47 " Please call tools/list to refresh your tool list."
48 )

Callers 2

_process_mcp_messageFunction · 0.90
_call_toolFunction · 0.90

Calls 3

ToolNotFoundErrorClass · 0.90
get_tool_namesMethod · 0.45
call_toolMethod · 0.45

Tested by 1

_call_toolFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…