internal/mcp: update CONTRIBUTING.md and README.md for the official SDK
Change CONTRIBUTING.md and README.md to reflect that the MCP SDK is being moved to github.com/modelcontextprotocol/go-sdk, and to include content from the 'Governance' section of the design doc. Also, include the antitrust policy as a section in CONTRIBUTING.md. Change-Id: I46784d8e57b2a2cab8895593f633d20a2e15c8ba Reviewed-on: https://go-review.googlesource.com/c/tools/+/682976 Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Auto-Submit: Robert Findley <rfindley@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
a6ec3f5f4e
commit
f4ed9b5904
1 changed files with 408 additions and 109 deletions
|
|
@ -15,8 +15,10 @@ import (
|
|||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
|
||||
// Create a new client, with no features.
|
||||
client := mcp.NewClient("mcp-client", "v1.0.0", nil)
|
||||
|
||||
// Connect to a server over stdin/stdout
|
||||
transport := mcp.NewCommandTransport(exec.Command("myserver"))
|
||||
session, err := client.Connect(ctx, transport)
|
||||
|
|
@ -24,20 +26,21 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
defer session.Close()
|
||||
|
||||
// Call a tool on the server.
|
||||
params := &mcp.CallToolParams{
|
||||
Name: "greet",
|
||||
Arguments: map[string]any{"name": "you"},
|
||||
}
|
||||
if res, err := session.CallTool(ctx, params); err != nil {
|
||||
log.Printf("CallTool failed: %v", err)
|
||||
} else {
|
||||
if res.IsError {
|
||||
log.Print("tool failed")
|
||||
}
|
||||
for _, c := range res.Content {
|
||||
log.Print(c.Text)
|
||||
}
|
||||
res, err := session.CallTool(ctx, params)
|
||||
if err != nil {
|
||||
log.Fatalf("CallTool failed: %v", err)
|
||||
}
|
||||
if res.IsError {
|
||||
log.Fatal("tool failed")
|
||||
}
|
||||
for _, c := range res.Content {
|
||||
log.Print(c.Text)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue