Files
codebase-memory-mcp/tests
Andrew Hundt d87d408447 mcp: fix 18 vague error messages + add 16 behavioral/spec compliance tests
Error messages: Every error now includes:
- WHAT failed (the specific input that caused the error)
- HOW to fix it (actionable "hint" field with next step)
- WHERE to look (tool names, param examples, valid options)

Fixed errors (18):
- "no project loaded" (3x) → + hint:"Run index_repository..."
- "function not found" → includes searched function name + hint
- "symbol not found" → includes searched qualified_name + hint
- "query is required" → + hint with Cypher syntax example
- "function_name is required" → + hint with param example
- "qualified_name is required" → + hint with format + "Use search_code_graph"
- "pattern is required" → + hint about regex vs literal
- "repo_path is required" → + hint about absolute path
- "project_name is required" → + hint:"Use list_projects"
- "project not found" (2x) → + hint:"Run index_repository or list_projects"
- "project not found or not indexed" → + hint with both options
- "failed to create pipeline" → + hint about path/permissions
- "search failed: temp file" → + hint about /tmp disk space
- "search failed" → + hint about grep installation
- "git diff failed" → + hint about git installation
- "missing tool name" → + lists available tools + "Use tools/list"
- "unknown tool: X" → + lists available tools + "Use tools/list"

New tests (16):
- MCP spec compliance: protocol version, subscribe:false, listChanged:true,
  resources/list fields, resources/read contents array, missing uri, no params
- Client behavioral differences: resource client never gets _context (3 calls),
  legacy client gets _context only first call, empty resources:{} counts as
  support, no-initialize defaults to legacy
- Error message quality: hint field present on no-project, function-not-found
  includes name, symbol-not-found includes qn, all required-param errors have
  hints, unknown-tool lists valid options, resource -32002 is actionable

Total: 2165 tests passing.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
2026-03-22 22:29:06 -04:00
..