aws-samples / aws-samples/sample-nova-sonic-mcp

MCP Tool doesn't pass in parameters

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
31
Forks
10
PR merge metrics
No merged PRs in 30d

Description

When using this sample to connect to an MCP server, I am unable to have aws sonic pass in the correct parameters

MCP Tool
```
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
print(f"Tool 'add' called with parameters: a={a}, b={b}", file=sys.stderr)
result = a + b
print(f"Tool 'add' returning result: {result}", file=sys.stderr)
return result
```

Tool view from /api/mcp-servers:

```
{
"name": "add",
"description": "Add two numbers",
"inputSchema": {
"type": "object",
"properties": {
"a": {
"title": "A",
"type": "integer"
},
"b": {
"title": "B",
"type": "integer"
}
},
"required": [
"a",
"b"
],
"title": "addArguments"
},
"serverName": "DemoMCP"
},
```

Response after attempting to use tool

```
Calling MCP tool: DemoMCP/add with args {"completionId":"c6a6f24f-0723-4537-a689-678e5e6783e4","content":"{}","contentId":"cb12e6d8-9a83-44fd-8cd9-162f42cba722","promptName":"330a7ee4-1742-4df7-a48a-2f67579dafb5","role":"TOOL","sessionId":"6ba9d1a7-00ae-42c5-a8b1-8244cf29aeb5","toolName":"add","toolUseId":"e413b14b-2863-43ef-babd-78af79747e5f"}
Sending tool result for session FFhRVr9h4ObFYttXAAAD, tool use ID: e413b14b-2863-43ef-babd-78af79747e5f
********** [
{
type: 'text',
text: 'Error executing tool add: 2 validation errors for addArguments\n' +
'a\n' +
' Field required [type=missing, input_value={}, input_type=dict]\n' +
' For further information visit https://errors.pydantic.dev/2.11/v/missing\n' +
'b\n' +
' Field required [type=missing, input_value={}, input_type=dict]\n' +
' For further information visit https://errors.pydantic.dev/2.11/v/missing'
}
]
```

Any ideas on how to get the correct args passed in?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.