-
Notifications
You must be signed in to change notification settings - Fork 754
Open
Description
Description
A simplest MCP server cannot be invoked via n8n when the input parameters are empty
Code Sample
package main
import (
"context"
"fmt"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
)
func main() {
// Create a new MCP server
s := server.NewMCPServer(
"Demo 🚀",
"1.0.0",
server.WithToolCapabilities(false),
)
// Add tool
tool := mcp.NewTool("hello_world",
mcp.WithDescription("Say hello to someone"),
)
// Add tool handler
s.AddTool(tool, helloHandler)
svr := server.NewStreamableHTTPServer(s)
if err := svr.Start(":8081"); err != nil {
fmt.Printf("Server error: %v\n", err)
}
}
func helloHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
return mcp.NewToolResultText("Hello world"), nil
}Logs or Error Messages
run it and connect it with n8n(version: 2.1.5), it will call failed with msg:
Problem in node ‘PartialExecutionToolExecutor‘
Error executing tool: Received tool input did not match expected schema ✖ Required → at value
Environment
- Go version (see
go.mod): [1.25.5] - mcp-go version (see
go.mod): [0.43.2] - Any other relevant environment details (debian 12.2)
Additional Context
Possible Solution
when I remove the omitempty tag of json on ToolArgumentsSchema.Properties, and rebuild it ,It will be all ok
diff --git a/mcp/tools.go b/mcp/tools.go
index 0dc7ceed..0c0e1ac1 100644
--- a/mcp/tools.go
+++ b/mcp/tools.go
@@ -637,7 +637,7 @@ func (t Tool) MarshalJSON() ([]byte, error) {
type ToolArgumentsSchema struct {
Defs map[string]any `json:"$defs,omitempty"`
Type string `json:"type"`
- Properties map[string]any `json:"properties,omitempty"`
+ Properties map[string]any `json:"properties"`
Required []string `json:"required,omitempty"`
}
Metadata
Metadata
Assignees
Labels
No labels