Skip to content

Commit 617c676

Browse files
committed
update
1 parent 5a1d3fe commit 617c676

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

www/docs/pages/getting-started.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package main
1919

2020
import (
2121
"context"
22-
"errors"
2322
"fmt"
2423

2524
"github.com/mark3labs/mcp-go/mcp"
@@ -53,9 +52,9 @@ func main() {
5352
}
5453

5554
func helloHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
56-
name, ok := request.Params.Arguments["name"].(string)
57-
if !ok {
58-
return nil, errors.New("name must be a string")
55+
name, err := request.RequireString("name")
56+
if err != nil {
57+
return mcp.NewToolResultError(err.Error()), nil
5958
}
6059

6160
return mcp.NewToolResultText(fmt.Sprintf("Hello, %s!", name)), nil

0 commit comments

Comments
 (0)