mcp: new API for features (#88)
BREAKING CHANGE Change the API for adding tools, prompts, resources and resource templates to a server. The ServerXXX types are gone along with the plural Add methods (AddTools, AddPrompts etc.) Instead there are single Add methods (AddTool, AddPrompt). In addition, instead of NewServerTool, there is AddTool[In, Out]. Fixes #73.
This commit is contained in:
parent
328a25d503
commit
aebd244981
1 changed files with 366 additions and 612 deletions
|
|
@ -35,12 +35,12 @@ func main() {
|
|||
}
|
||||
|
||||
server1 := mcp.NewServer("greeter1", "v0.0.1", nil)
|
||||
server1.AddTools(mcp.NewServerTool("greet1", "say hi", SayHi))
|
||||
mcp.AddTool(server1, &mcp.Tool{Name: "greet1", Description: "say hi"}, SayHi)
|
||||
|
||||
server2 := mcp.NewServer("greeter2", "v0.0.1", nil)
|
||||
server2.AddTools(mcp.NewServerTool("greet2", "say hello", SayHi))
|
||||
mcp.AddTool(server2, &mcp.Tool{Name: "greet2", Description: "say hello"}, SayHi)
|
||||
|
||||
log.Printf("MCP servers serving at %s\n", *httpAddr)
|
||||
log.Printf("MCP servers serving at %s", *httpAddr)
|
||||
handler := mcp.NewSSEHandler(func(request *http.Request) *mcp.Server {
|
||||
url := request.URL.Path
|
||||
log.Printf("Handling request for URL %s\n", url)
|
||||
|
|
|
|||
Loading…
Reference in a new issue