-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(mcp): CORS middleware, renaming, error handling #9423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WithBasePath is deprecated
…on; fix error handling
Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information. |
@@ -102,22 +102,22 @@ func NewMCPServer(connectionString string, readOnly bool) (*server.MCPServer, er | |||
s.AddTool(alterSchemaTool, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { | |||
schema, ok := request.GetArguments()["schema"].(string) | |||
if !ok { | |||
return nil, fmt.Errorf("schema must be present") | |||
return mcp.NewToolResultError("Schema must be present"), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handling errors via mcp.NewToolResultError is the correct mode. If we return an err
, the SSE server internals will return a 500 server error.
Description
This PR:
Note, there's a MCP demo client here that you can spin up to test the SSE implementation.
Checklist