Skip to content

DX: fix goalSessionStore not wired in stdio MCP, normalize error formats #214

@windoliver

Description

@windoliver

Summary

Two DX issues that directly impact agent and operator experience.

1. goalSessionStore not wired in stdio MCP (agent-facing bug)

Problem: src/mcp/serve.ts creates a LocalRuntime that exposes runtime.goalSessionStore, but never passes it into the MCP deps object. As a result, all four goal/session MCP tools always return [NOT_CONFIGURED] Goal/session store is not configured:

  • grove_goal
  • grove_set_goal
  • grove_list_sessions
  • grove_create_session

The HTTP server (src/server/serve.ts) does wire goalSessionStore correctly. This means agents using stdio MCP (the primary transport for Claude Code, Codex, etc.) have broken goal/session tools, while HTTP-connected agents work fine.

Fix: Pass runtime.goalSessionStore into deps in src/mcp/serve.ts (and verify src/mcp/serve-http.ts for parity).

Impact: High — goal/session tools are registered and described to agents, but silently fail on the most common transport.

2. Inconsistent error format across MCP tools

Problem: Error strings sent back to agents use different formats depending on the code path:

Source Format Example
operation-adapter.ts [CODE] message [CLAIM_CONFLICT] target already claimed
error-handler.ts [CODE] message [RATE_LIMIT] exceeded limit
Goal/session tools [NOT_CONFIGURED] message [NOT_CONFIGURED] Goal/session store...
Validation in operation-adapter VALIDATION_ERROR: message VALIDATION_ERROR: summary required
Ingest tools [VALIDATION_ERROR] message [VALIDATION_ERROR] no files found
HTTP MCP 500 plain string "Internal server error"

Agents trying to programmatically parse errors need to handle bracket-wrapped codes, colon-suffixed codes, and plain text.

Fix: Normalize to [CODE] message format everywhere. A one-line helper formatToolError(code, message) could enforce this.

Files: src/mcp/operation-adapter.ts, src/mcp/error-handler.ts, src/mcp/tools/goal.ts, src/mcp/tools/session.ts, src/mcp/tools/contributions.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions