Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

MCP tool calls fail: invalid JSON when passing session_name / session_id (Cursor agent)

未关闭
#17 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

  • #25 来自 @tony —— 已关闭,未合并

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
技术栈
python
领域
api

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

bug

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 JSON
  • Unexpected 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 (with session_name / session_id) and select_window fail entirely; the agent falls back to shell tmux commands.
  • Any tool parameter that is a string could theoretically hit the same class of bug if the serializer mishandles it.

Steps to reproduce (agent)

  1. Use Cursor with the libtmux MCP server configured (stdio).
  2. From the agent, call list_windows with session_name set to a bare session name (e.g. cv), or list_windows / related tools with session_id (e.g. $10).
  3. 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_arg and create_session.environment. This issue is orthogonal: it is invalid JSON at the wire level, not a semantic coercion problem.

Suggestions

  1. Upstream: If reproducible only in Cursor, report or cross-link to Cursor with a minimal failing tool call payload.
  2. Docs: Optionally note in MCP/client docs that agents should prefer globally unique pane_id targeting where possible to reduce reliance on session filters.
  3. 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.

主要语言
Python
星标
13
派生
0
平均合并
22 分钟
30 天内合并 PR
4

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

tmux-python/libtmux-mcp 的其他 Issue

查看 tmux-python/libtmux-mcp 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。