internal/mcp: rename NewXXX->NewServerXXX
The NewTool and NewPrompt constructors were unidiomatic, because they returned a ServerTool and ServerPrompt, respectively, rather than a Tool and Prompt. Rename to be consistent with the constructed object name. Change-Id: Ife3f16f783368401f792660c4272e1bb5ae61638 Reviewed-on: https://go-review.googlesource.com/c/tools/+/682375 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
parent
d2f2f87bbe
commit
9453d6bf6c
1 changed files with 76 additions and 74 deletions
|
|
@ -24,7 +24,7 @@ func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParam
|
|||
func main() {
|
||||
// Create a server with a single tool.
|
||||
server := mcp.NewServer("greeter", "v1.0.0", nil)
|
||||
server.AddTools(mcp.NewTool("greet", "say hi", SayHi))
|
||||
server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi))
|
||||
// Run the server over stdin/stdout, until the client disconnects
|
||||
_ = server.Run(context.Background(), mcp.NewStdIOTransport())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue