Skip to content

examples/mcp_calculator.py is not working for me or others who tried it #160

@Riehantunut

Description

@Riehantunut

claude-code-sdk==0.0.21
Claude Code v1.0.109

When running examples/mcp_calculator.py others and I get these printouts:

==================================================
Prompt: List your tools
==================================================
Claude: Here are the tools I have available:

**File Operations:**
- `Read` - Read file contents
- `Write` - Write/overwrite files
- `Edit` - Make exact string replacements in files
- `MultiEdit` - Make multiple edits to a single file
- `NotebookEdit` - Edit Jupyter notebook cells

**Search & Navigation:**
- `Glob` - Find files by pattern (e.g., "**/*.py")
- `Grep` - Search file contents with regex
- `Task` - Launch specialized agents for complex searches

**Shell Operations:**
- `Bash` - Execute shell commands
- `BashOutput` - Get output from background processes
- `KillBash` - Terminate background processes

**Web & Network:**
- `WebSearch` - Search the web
- `WebFetch` - Fetch and analyze web content

**Task Management:**
- `TodoWrite` - Create and manage task lists
- `ExitPlanMode` - Exit planning mode when ready to code

The tools are designed to help with software engineering tasks like reading code, making changes, running tests, searching codebases, and managing complex multi-step tasks.
Result ended
Cost: $0.021489

==================================================
Prompt: Calculate 15 + 27
==================================================
Using tool: mcp__calc__add
  Input: {'a': '15', 'b': '27'}
Tool Result: <tool_use_error>Error: No such tool available: mcp__calc__add</tool_use_error>...
Claude: 42
Result ended
Cost: $0.012948

==================================================
Prompt: What is 100 divided by 7?
==================================================
Using tool: mcp__calc__divide
  Input: {'a': '100', 'b': '7'}
Tool Result: <tool_use_error>Error: No such tool available: mcp__calc__divide</tool_use_error>...
Claude: 14.285714285714286
Result ended
Cost: $0.012739

==================================================
Prompt: Calculate the square root of 144
==================================================
Using tool: mcp__calc__sqrt
  Input: {'number': '144'}
Tool Result: <tool_use_error>Error: No such tool available: mcp__calc__sqrt</tool_use_error>...
Claude: 12
Result ended
Cost: $0.012465

==================================================
Prompt: What is 2 raised to the power of 8?
==================================================
Claude: 256
Result ended
Cost: $0.006611

==================================================
Prompt: Calculate (12 + 8) * 3 - 10
==================================================
Claude: I'll calculate (12 + 8) * 3 - 10 step by step.
Using tool: mcp__calc__add
  Input: {'a': '12', 'b': '8'}
Tool Result: <tool_use_error>Error: No such tool available: mcp__calc__add</tool_use_error>...
Claude: (12 + 8) * 3 - 10 = 20 * 3 - 10 = 60 - 10 = 50
Result ended
Cost: $0.013793

It seems like the MCP tools are not registered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions