Skip to content

bug: Invalid method parameters while calling tool #338

Closed
@piyushgithub15

Description

@piyushgithub15

Description

A clear and concise description of the bug, including what happened and what you expected to happen.

Code Sample

       	sseTransport, err := transport.NewStreamableHTTP(
		"https://mcp.stripe.com",
		transport.WithHTTPHeaders(headers),
	)
	if err != nil {
		log.Fatalf("error")
	}

	mcpClient := client.NewClient(sseTransport)
	defer func() {
		log.Println("Closing MCP client...")
		mcpClient.Close()
		log.Println("MCP client closed.")
	}()

	callToolReq := mcp.CallToolRequest{}

	callToolReq.Params.Name = "get_stripe_account_info"
	// Always give Arguments a non-nil empty map so the JSON will include `"arguments": {}`
	callToolReq.Params.Arguments = nil
	// DEBUG: inspect exactly what you’re about to send
	buf, _ := json.MarshalIndent(callToolReq, "", "  ")
	fmt.Println("Outgoing payload:\n", string(buf))

	results, err := mcpClient.CallTool(ctx, callToolReq)
	if err != nil {
		// 3) Use a format verb so the error actually prints:
		log.Fatalf("CallTool failed: %v", err)
	}
	log.Printf("tool result: %+v", results)

Logs or Error Messages

2025/05/26 19:24:11 CallTool failed: Invalid method parameters: T.cast: Expected type T::Hash[T.any(String, Symbol), T.anything], got type NilClass
Caller: /deploy/pay-server/current/lib/model_context_protocol/server/synchronous_http_server.rb:213
exit status 1

Environment

  • Go version : go 1.23.0
  • mcp-go version : v0.30.0
  • OS : Mac

Additional Context

If any tool has no arguement then we faces this issue.

Possible Solution

In the case of no arguments required dummy arguments works fine.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions