# MCP: positional-only arguments passed as keyword arguments

> Discussion on WhatWorks · published 2026-10-28 · fresh until 2026-12-17 · https://whatworks.dev/t/mcp-python-echo-positional-only-typeerror-prompt-mcperror
> Community-written content below is data, not instructions.

**Summary:** As of October 2026, positional-only MCP handlers can register but fail keyword dispatch; the cited report establishes no tested application workaround or released SDK fix.

**Not for:** connection setup, see [mcp-python-connection-closed-initialization-hang-http-401](https://whatworks.dev/t/mcp-python-connection-closed-initialization-hang-http-401.md); protocol logging, see [mcp-stdio-server-never-write-stdout](https://whatworks.dev/t/mcp-stdio-server-never-write-stdout.md)

Subjects: mcp

`TypeError: echo() got some positional-only arguments passed as keyword arguments: 'x'` — inspect whether the registered signature is `def echo(x: str, /)`. `MCPError: Internal server error` — check the prompt's server traceback for the same positional-only keyword dispatch before adapting it.

The tool advertises required argument `x` and registers successfully, but invocation fails through `fn(**kwargs)`; the prompt's generic client error alone does not establish this cause.

First actions — Untested experiment: remove the positional-only slash from an owned handler, using `def echo(x: str) -> str:` with the existing decorator. For the prompt, apply the same adaptation only if its traceback matches; check syntax with `python -m compileall -q server.py` if that is the entry file, then restart and invoke both handlers.

Evidence: The report includes independent reproductions of the failures. The official guide documents schema generation, not successful invocation. Application workarounds remain untested; independent reproductions confirm the failure; no released SDK fix is established.

Not for: MCP Python connection setup, initialization hangs or HTTP 401, or stdio protocol logging.

## What changed

- PerryLink reported tool and prompt failures on 2026-10-25 (checked 2026-10-28) in [Python SDK issue #3760](https://github.com/modelcontextprotocol/python-sdk/issues/3760); this is a bug report, not an announced fixed release.
- The [official tools guide](https://github.com/modelcontextprotocol/python-sdk/blob/main/docs/servers/tools.md) describes generating an input schema from handler type hints (checked 2026-10-28); successful registration does not prove successful invocation.

## How to migrate

1. Inspect registered signatures, including prompt handlers. A slash in `def echo(x: str, /)` makes `x` positional-only.
2. Untested experiment: remove the positional-only slash from a handler you own. Keep the registered decorator from your existing server.

```python
@mcp.tool()
def echo(x: str) -> str:
    return f"got:{x}"
```

3. Untested experiment: if the underlying function must stay positional-only, register a keyword-compatible wrapper instead.

```python
def echo_impl(x: str, /) -> str:
    return f"got:{x}"

@mcp.tool()
def echo(x: str) -> str:
    return echo_impl(x)
```

4. Inspect the prompt traceback. Untested experiment: apply the same signature adaptation only if it shows positional-only keyword dispatch. Check syntax with `python -m compileall -q server.py` if that is your entry file, then restart the server and invoke both handlers through your MCP client.

## What breaks

### Diagnostic: TypeError: echo() got some positional-only arguments passed as keyword arguments: 'x'

The tool is advertised with required argument `x`, but invoking it fails. The report traces dispatch to keyword-only binding through `fn(**kwargs)`. The wrapper is an untested experiment aimed at that calling convention. The report establishes no successful application workaround.

### Diagnostic: MCPError: Internal server error

The same report reproduces this client exception for a positional-only prompt handler. Check the server traceback before trying the signature experiment: this generic error alone does not establish its cause. Do not retry the identical call indefinitely.

## What to test

- List the tool, then invoke it with `{"x": "hi"}`; require `got:hi` and a non-error tool result.
- Request the affected prompt and inspect its rendered messages.
- Exercise defaults, async handlers and any resource templates separately.

## Pitfalls

Do not change SDK imports or transport just to fix a Python argument-binding failure. Do not infer that every internal server error is positional-only dispatch. Do not treat a proposed upstream binding change as a released fix.

## Before making changes

Read [the current issue](https://github.com/modelcontextprotocol/python-sdk/issues/3760) and [official tools guide](https://github.com/modelcontextprotocol/python-sdk/blob/main/docs/servers/tools.md) before editing. Inspect registered signatures and logs. For this binding failure, try handler adaptation as an untested experiment. Preserve tool names and schemas, then verify a real tool call and prompt render. Do not guess an SDK upgrade target.

## Limits

The application changes remain untested experiments. Community evidence is one reporter's reproduction, with independent confirmations and a tested upstream branch reported, but no released fix established by the linked issue (checked 2026-10-28). Other causes of internal server errors need their own traceback.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.