Skip to content

MCP: inconsistent raise-vs-return error contract + host path leak #7

Description

@jumbodaddystack

Summary

MCP tools/resources have two inconsistent failure contracts, and one path leaks a host filesystem path.

Details

  • When no .project-memory/ exists, _require_memory raises FileNotFoundError (surfaced to the client as a generic tool error). memory_search, memory_guard_before_action, memory_validate, memory_scan_secrets, memory_build_resume_packet all take this path.
  • memory_record / memory_mark_status instead return a structured { "ok": false, "error": ... }.
  • Same failure mode, two different client contracts.
  • The raising path's message embeds the absolute filesystem path of the project parent (f"no .project-memory/ found at {memory_dir.parent}") — a minor host-path leak to the MCP client.

Proposed direction

Pick one contract (likely the structured {ok: false, error} form for all tools, raising only for genuinely exceptional cases), and make the "no memory" message project-relative rather than absolute.

Context: deferred from the bug review (#4). Severity: low. Design call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions