docs: fix README (#32)

This commit is contained in:
qiaodev 2025-06-25 10:54:29 -07:00 • committed by GitHub
commit abb650e45b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,7 +71,7 @@ func main() {
log.Fatal("tool failed")
}
for _, c := range res.Content {
log.Print(c.Text)
log.Print(c.(*mcp.TextContent).Text)
}
}
```
@ -95,7 +95,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.ContentBlock{mcp.NewTextContent("Hi " + params.Name)},
Content: []mcp.Content{&mcp.TextContent{Text: "Hi " + params.Name}},
}, nil
}