Skip to content

MCP: add an ask tool that returns a grounded, cited answer #12

Closed

Description

@ericmann

Summary

Add an MCP `ask` tool that runs retrieve→synthesize and returns a grounded, citation-backed answer, instead of clients only getting raw search chunks.

Context

`journal search` already produces an optional grounded AI answer (`answerQuery` in `cmd/search.go`) using the configured synth provider. Over MCP, only the `search` tool exists and it returns chunks. An `ask` tool lets a connected agent (Claude Desktop/Cursor) get "what did I decide about X" answered directly — with citations — which is the "Claude just knows what I wrote last week" experience the author wants. Honors `synth_provider` (local/cloud) and `local_only`.

Acceptance Criteria

  • New MCP `ask` tool: `query` + optional `k`/filters; returns the grounded answer text plus the source `path:line` citations.
  • Uses the existing `answerClient`/`answerQuery` path; respects `synth_provider` and `local_only` (clear error/skip when synthesis is unavailable).
  • Verified over the stdio JSON-RPC handshake; tests with a fake synth client.
  • Passes linting (gofmt + vet; `make lint`); review approved.

Scope

In scope: `cmd/mcp.go` (register the tool + handler) reusing `cmd/search.go` answer logic.
Out of scope: streaming responses; new synthesis kinds; changing the `search` tool.

Technical Notes

Key files:
```

  • cmd/mcp.go (mcp.AddTool registrations — add `ask`)
  • cmd/search.go (answerQuery, answerClient, searchChunks to reuse)
  • cmd/mcp_test.go (stdio handshake test; inject synth.Fake)
    ```
    Dependencies: none new. Testing: `tools/call` round-trip asserting answer + citations; mind the wazero `-p 1` constraint.

Complexity

  • `complexity:medium`

Agent Readiness

  • bounded · [x] measurable · [x] context · [x] patterns linked · [x] no external blockers

Activity

  1. added
    complexity:mediumMultiple files, follows established patterns
    agent-candidateIssue screener flagged as a candidate — human review needed before promoting to agent-ready
    agent-readyIssue is properly scoped for AI agent execution
    and removed on Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-candidateIssue screener flagged as a candidate — human review needed before promoting to agent-readyagent-readyIssue is properly scoped for AI agent executioncomplexity:mediumMultiple files, follows established patterns

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions