Skip to content

Commit 8a3f272

Browse files
authored
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.
1 parent c47dbcd commit 8a3f272

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ type HiParams struct {
104104

105105
func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParamsFor[HiParams]) (*mcp.CallToolResultFor[any], error) {
106106
return &mcp.CallToolResultFor[any]{
107-
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Name}},
107+
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Arguments.Name}},
108108
}, nil
109109
}
110110

internal/readme/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type HiParams struct {
1818

1919
func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParamsFor[HiParams]) (*mcp.CallToolResultFor[any], error) {
2020
return &mcp.CallToolResultFor[any]{
21-
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Name}},
21+
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Arguments.Name}},
2222
}, nil
2323
}
2424

0 commit comments

Comments
 (0)