fix(mcp-wrapper): declare real input schemas (clean re-merge) #156
Reference in New Issue
Block a user
Delete Branch "merge-pr150-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Re-does PR #150's merge clean off current main (which now has #149). One conflict: main's mcp-wrapper/src/main.el already has the full 9-op schema surface (schema_read/write/relate/supersede/think/attend/assert/ground/learn) that #150 predates — kept main's version.
The cognitive-graph and write tools advertised an empty inputSchema ({"properties":{}}), so MCP clients never sent entity_id/depth/query/ from_id/node_id etc. Graph reads fell back to the full neighborhood (480-775KB, over transport limits) and write tools (forget, linkEntities, evolveMemory) had no way to target a node. - Declare per-tool JSON-Schemas matching the params each soul handler already accepts (76 of 87 tools; 11 are genuinely param-less). - Read + forward the declared args: inspectGraph now honors depth (was reading only legacy max_depth), compact (default on), snip, k; traverseGraph accepts entity_id and defaults compact on so a depth-2 walk stays bounded; retrieveKnowledge forwards depth/snip/k. - compact_flag() reads the raw JSON token so an integer 0 / false / "0" opts out correctly (json_get_string could not see an integer and silently forced compact back on). Builds on PR #149's compact projection; keeps the relevance-ranked bound on by default for graph neighborhoods.auto_term_try_slot now passes the WM node's ID to engram_salient_term() instead of passing its label to a first-word extractor. The runtime scores every candidate token in the node's text and returns the best one, falling back from a sentinel label ("memory:remembered") to content — which is the only reason Memory nodes are visible to the extractor at all. They dominate working memory, and dynamic seeding had been dead for 50+ consecutive scans because of it. Policy stays here: node-type filter, df thresholds, stopword list. The runtime measures, the soul decides — same split as engram_label_df. The stopword list stays, and not as belt-and-braces. An earlier draft assumed the min_df floor would subsume it based on 08-03's finding that function words have df 0 in labels. Re-measured under word-boundary df: about:2, whole:1, them:2 — they clear a floor of 1. What keeps them from winning is the argmax, not the floor. The old extractor and its five guards are retained as auto_term_try_slot_legacy, unreferenced, so the reasoning behind each guard stays readable next to what replaced it. Delete once the new path has a month of live telemetry. Live after restart: auto_term producing DRIFT, Wrote; empty streak reset to 0 and holding; activation counts 123-281, within the normal band, no flood.