mcp-use TypeScript API
    Preparing search index...

    Interface CallToolHandle<Args, Result>

    Typed server-tool call handle returned by useCallTool and useDynamicTool.

    interface CallToolHandle<Args, Result> {
        callTool: (args: Args) => Promise<CallToolSuccess<Result>>;
        data: CallToolSuccess<Result> | undefined;
        error: Error | undefined;
        isPending: boolean;
    }

    Type Parameters

    • Args

      Tool argument object type.

    • Result

      Expected structuredContent type for a successful result.

    Index
    callTool: (args: Args) => Promise<CallToolSuccess<Result>>

    Invoke the server tool over the bridge.

    Every non-error result resolves. structuredContent is guaranteed and typed exactly when the tool declares an outputSchema — the server rejects non-error results from schema-backed tools that lack it, so a resolved result from a schema'd tool always carries it. Tools without an outputSchema legitimately return content-only results.

    Type Declaration

    ToolError when the tool answers with isError: true. Transport, RPC, and missing-serverTools failures also reject with an Error.

    data: CallToolSuccess<Result> | undefined

    Last successful result only. Preserved while a later request is pending or fails (tool error / transport).

    error: Error | undefined

    Last failure (ToolError or transport/RPC/capability Error). Cleared on the next call.

    isPending: boolean

    Whether a call is in flight.