mcp_tool_to_talk_box()

Convert an MCPToolInfo into a TalkBoxTool.

Usage

Source

mcp_tool_to_talk_box(
    info,
    *,
    call_fn=None,
)

This wraps a remote MCP tool so it can be used inside Talk Box conversations just like a native tool.

Parameters

info: MCPToolInfo

The MCP tool descriptor (from list_mcp_tools).

call_fn: Callable[…, Any] | None = None
An optional callable (name, arguments) -> result used to invoke the remote tool. When omitted a stub that returns the arguments as a JSON string is created (useful for testing).

Returns

TalkBoxTool
A Talk Box tool that delegates to the MCP server.

Examples

import talk_box as tb

info = tb.MCPToolInfo(
    name="lookup",
    description="Look up a term",
    input_schema={
        "type": "object",
        "properties": {"term": {"type": "string"}},
        "required": ["term"],
    },
)
tool = tb.mcp_tool_to_talk_box(info)
tool.name  # "lookup"