modelcontextprotocol / modelcontextprotocol/go-sdk

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

Open
#396 22 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs community feedback
Dominant language
Go
Stars
5.1k
Forks
543
Avg merge
1d 17h
Merged PRs (30d)
37

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the current AddTool and ToolHandlerFor[In, Out] definitions and review the discussion referenced in #386. Compare the proposed handler signature with the existing CallToolRequest and CallToolResult usage; done means the API direction and resulting tool-author behavior are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.