Skip to content

Proposal: add a simpler version of AddTool that drops request and response #396

@jba

Description

@jba

Currently, mcp.AddTool takes a ToolHandlerFor[In, Out], which is defined as

func(context.Context, *CallToolRequest, In) (*CallToolResult, Out, error)

As argued on #386, the request and result are seldom used and confusing. In particular, it is unclear whether to use the StructuredOutput and IsError fields of CallToolResult, or to return results via the second and third return values.

The proposal is to change AddTool to take a handler with signature

func(context.Context, In) (Out, error)

That will satisfy the majority of tool authors and remove the confusion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalA proposal for an a new API or behavior. See CONTRIBUTING.md.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions