mcp: fix tool result in examples (#45)

This commit is contained in:
Gerard Adam 2025-06-26 03:48:21 +07:00 • committed by GitHub
commit 10dcf48fdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

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

View file

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