fix: Ignore wait_for_previous argument to support Gemini MCP clients#322
fix: Ignore wait_for_previous argument to support Gemini MCP clients#322bensig merged 1 commit intoMemPalace:developfrom
Conversation
web3guru888
left a comment
There was a problem hiding this comment.
Clean fix — .pop() is the right primitive for this. Gemini shouldn't be injecting undeclared arguments, but servers should be robust to it. ✅
One thought for a follow-up (not blocking this PR): right now this protects against wait_for_previous specifically. If Gemini or another MCP client starts injecting additional non-standard arguments in the future, we'd need another .pop() line.
A more generic guard would be to filter against the declared inputSchema properties:
known_keys = set(schema_props.keys())
tool_args = {k: v for k, v in tool_args.items() if k in known_keys}This goes right after the existing type-coercion loop (which already iterates schema_props), so it's a natural fit. Trade-off is that it silently drops any unknown arg — could mask real typos — but since we already validate required args via the schema, the risk is low.
Not suggesting this should block the PR — the targeted .pop() is fine for now and the fix is needed. Just flagging for future hardening.
- pyproject.toml: widen chromadb to <2.0 for Python 3.14 compat (MemPalace#302) - config.py + miner/convo_miner/mcp_server: add hnsw:space=cosine so similarity = 1 - distance stays in [0,1] instead of negative L2 (MemPalace#304) - searcher.py + layers.py: guard against ChromaDB 1.x empty-outer query results (IndexError on fresh collections) (MemPalace#305) - mcp_server.py: redirect stdout→stderr at import to protect JSON-RPC wire from chromadb/posthog chatter (MemPalace#306) - mcp_server.py: replace 10k-limited col.get with paginating _iter_all_metadatas helper; stop swallowing errors silently (MemPalace#307) - mcp_server.py: drop undocumented wait_for_previous arg injected by Gemini MCP clients (MemPalace#322) - searcher.py + hybrid_searcher.py + mcp_server.py: add min_similarity threshold filter so callers get a clean "no results" signal (MemPalace#350) - entity_detector.py: add CODE_KEYWORDS blocklist (~80 terms) to stop Rust types / React / framework names being detected as entities (MemPalace#349) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
bensig
left a comment
There was a problem hiding this comment.
Code review + security audit clean. One-liner Gemini compat fix.
Describe the bug
When using Mempalace with the Gemini CLI MCP client, the client automatically injects an undocumented wait_for_previous argument into the tool execution request. This causes a TypeError: unexpected keyword argument in mcp_server.py and crashes the tool execution.
Solution
Added a safe .pop("wait_for_previous", None) before passing tool_args to the handler. This safely drops the non-standard argument and restores compatibility with Gemini clients without affecting other standard clients like Claude Desktop or Cursor.