@modelcontextprotocol/sdk
    Preparing search index...

    Type Alias ToolCallback<Args>

    ToolCallback: Args extends ZodRawShape
        ? (
            args: z.objectOutputType<Args, ZodTypeAny>,
            extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
        ) => CallToolResult | Promise<CallToolResult>
        : (
            extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
        ) => CallToolResult | Promise<CallToolResult>

    Callback for a tool handler registered with Server.tool().

    Parameters will include tool arguments, if applicable, as well as other request handler context.

    The callback should return:

    • structuredContent if the tool has an outputSchema defined
    • content if the tool does not have an outputSchema
    • Both fields are optional but typically one should be provided

    Type Parameters

    • Args extends undefined | ZodRawShape = undefined