Skip to content

Commit 376d949

Browse files
authored
README.md: add description to tool input (#38)
1 parent 92859ef commit 376d949

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParam
102102
func main() {
103103
// Create a server with a single tool.
104104
server := mcp.NewServer("greeter", "v1.0.0", nil)
105-
server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi))
105+
server.AddTools(
106+
mcp.NewServerTool("greet", "say hi", SayHi, mcp.Input(
107+
mcp.Property("name", mcp.Description("the name of the person to greet")),
108+
)),
109+
)
106110
// Run the server over stdin/stdout, until the client disconnects
107111
if err := server.Run(context.Background(), mcp.NewStdioTransport()); err != nil {
108112
log.Fatal(err)

internal/readme/server/server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParam
2525
func main() {
2626
// Create a server with a single tool.
2727
server := mcp.NewServer("greeter", "v1.0.0", nil)
28-
server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi))
28+
server.AddTools(
29+
mcp.NewServerTool("greet", "say hi", SayHi, mcp.Input(
30+
mcp.Property("name", mcp.Description("the name of the person to greet")),
31+
)),
32+
)
2933
// Run the server over stdin/stdout, until the client disconnects
3034
if err := server.Run(context.Background(), mcp.NewStdioTransport()); err != nil {
3135
log.Fatal(err)

0 commit comments

Comments
 (0)