anthropics / anthropics/claude-code

[MCP tool boolean parameter always serialized as string, causing "Expected bool, got string" error]

Abierto
#91,803 1 comentario 0 reacciones 0 asignados Ver en GitHub
area:mcp area:tools bug platform:windows
Lenguaje dominante
Python
Estrellas
145k
Forks
23.1k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code

### What's Wrong?

When calling an MCP tool that requires a boolean parameter, the value is always sent to the MCP server as a string ("true", "True", "1"), never as a native JSON boolean — the tool rejects the call with a type validation error.

Affected tool: ads_boost_ig_post, from the Meta Ads MCP (server id 97087554-d6e2-4022-b05d-0d227ea3758a), parameter `confirmed`.

### What Should Happen?

The `confirmed` parameter should be serialized as a native JSON boolean when the tool call is sent, so the MCP server accepts it and the tool call succeeds.

### Error Messages/Logs

```shell
Invalid value for `confirmed`. Got: 'true'. Error: Expected bool, got string
```

### Steps to Reproduce

1. Connect to an MCP server that exposes a tool with a required boolean parameter (in this case, ads_boost_ig_post from the Meta Ads MCP, parameter `confirmed`)
2. Call the tool with confirmed=true
3. Observe the error: "Invalid value for `confirmed`. Got: 'true'. Error: Expected bool, got string"
4. Retry with confirmed=True and confirmed=1 — same error in both cases
5. Note: the tool's schema, when inspected via ToolSearch, appears generic ({"type": "object"}, no per-field types) — this may be why the client doesn't know to serialize this field as a boolean

### Claude Model

Sonnet (default)

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.232 (Claude Code)

### Platform

Anthropic API

### Operating System

Windows

### Terminal/Shell

Other

### Additional Information

Full investigation writeup available if needed — happy to share more context/repro details.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start by reproducing the MCP tool call with the Meta Ads MCP tool ads_boost_ig_post and inspect its ToolSearch schema, especially the confirmed parameter. Trace where the tool-call arguments are serialized; done means confirmed reaches the MCP server as a native JSON boolean and the call succeeds without the type validation error.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, backend-api-design
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
55/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.