internal/readme: fix server example (#63)

Fix an example using params.Name instead of params.Arguments.Name. All
credit due to @A11Might for noticing this. Sending a separate PR to keep
the internal/readme source consistent.
This commit is contained in:
Robert Findley 2025-06-27 15:43:14 -04:00 • committed by GitHub
commit 8a3f272dbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -104,7 +104,7 @@ type HiParams struct {
func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParamsFor[HiParams]) (*mcp.CallToolResultFor[any], error) {
return &mcp.CallToolResultFor[any]{
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Name}},
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Arguments.Name}},
}, nil
}

View file

@ -18,7 +18,7 @@ type HiParams struct {
func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParamsFor[HiParams]) (*mcp.CallToolResultFor[any], error) {
return &mcp.CallToolResultFor[any]{
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Name}},
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Arguments.Name}},
}, nil
}