MCP tool calls fail: invalid JSON when passing session_name / session_id (Cursor agent)
Chưa có ai nhận issue này.
- #25 của @tony — đã đóng, không merge
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start by reproducing the Cursor agent calls to list_windows and select_window with session_name or session_id, and capture the malformed payload. Compare this behavior with the existing _coerce_dict_arg and create_session.environment handling; done means determining whether a repository-side error or documentation change is possible, or whether the failure belongs upstream to Cursor or the MCP client.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When driving libtmux-mcp from Cursor’s agent, some tool invocations fail before the Python server runs: the MCP layer rejects the request because the JSON payload for tool arguments is malformed.
This is not the same as the existing workaround for dict-shaped parameters sent as JSON strings (_coerce_dict_arg / Composer dict-stringification). Here, string values that must be JSON strings are emitted without quotes, producing invalid JSON.
Symptoms
Errors observed on the client/MCP bridge when calling tools that accept optional session targeting, for example:
Unexpected token '$', "{"session_id": $10}" is not valid JSONUnexpected token 'c', "{"session_name": cv}" is not valid JSON
Valid JSON would require:
"session_id": "$10""session_name": "cv"
Impact
- Tools such as
list_windows(withsession_name/session_id) andselect_windowfail entirely; the agent falls back to shelltmuxcommands. - Any tool parameter that is a string could theoretically hit the same class of bug if the serializer mishandles it.
Steps to reproduce (agent)
- Use Cursor with the libtmux MCP server configured (stdio).
- From the agent, call
list_windowswithsession_nameset to a bare session name (e.g.cv), orlist_windows/ related tools withsession_id(e.g.$10). - Observe MCP parse/validation errors instead of a normal tool result.
(Exact UI steps depend on Cursor version; the failure is visible in the agent tool-call error output.)
Expected behavior
Tool arguments are serialized as valid JSON. String parameters are JSON-encoded (quoted, with proper escaping).
Actual behavior
The serialized arguments are not valid JSON (unquoted $10, unquoted cv), so the request fails at parse time.
Nature of the bug
- Likely location: MCP client / Cursor’s tool-argument serialization for this model or code path—not libtmux-mcp’s Python handlers (they never run).
- Relation to existing work: The project already documents dict parameters arriving as JSON strings (Composer 1/1.5) in
_coerce_dict_argandcreate_session.environment. This issue is orthogonal: it is invalid JSON at the wire level, not a semantic coercion problem.
Suggestions
- Upstream: If reproducible only in Cursor, report or cross-link to Cursor with a minimal failing tool call payload.
- Docs: Optionally note in MCP/client docs that agents should prefer globally unique
pane_idtargeting where possible to reduce reliance on session filters. - Investigation: Confirm whether FastMCP / MCP server can surface a clearer error when the client sends malformed JSON (may be outside server control).
Environment (observed)
- OS: Linux (WSL2)
- Cursor agent + libtmux-mcp MCP server (stdio)
- tmux sessions present (e.g. session name
cv, id$10)
If maintainers prefer this tracked as documentation-only or upstream-meta, feel free to relabel; the goal is to capture the failure mode and distinguish it from _coerce_dict_arg-style workarounds.
- Ngôn ngữ chính
- Python
- Star
- 13
- Fork
- 0
- Merge trung bình
- 22 phút
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tmux-python/libtmux-mcp
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
tmux-python/libtmux-mcp#121 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
tmux-python/libtmux-mcp#120 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
tmux-python/libtmux-mcp#119 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
tmux-python/libtmux-mcp#118 ·
-
pytest filterwarnings suppresses the DeprecationWarnings this project needs to seeCó thể đã có người làm @tony đã nhận 89 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
tmux-python/libtmux-mcp#111 ·
Tất cả issue của tmux-python/libtmux-mcp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
foxglove/mcap#1907 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
namespace operations
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
EclipseFdn/open-vsx.org#14623 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
developmentseed/titiler-cmr#261 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
andrewyng/openworker#774 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
aggfuncĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
worldbank/blackmarblepy#160 ·