Skip to content

feat(mcp): read-only getState tool (portable read-side hedge)#46

Merged
thorwhalen merged 1 commit into
mainfrom
feat/mcp-getstate
Jul 6, 2026
Merged

feat(mcp): read-only getState tool (portable read-side hedge)#46
thorwhalen merged 1 commit into
mainfrom
feat/mcp-getstate

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

What & why

Completes the AI read side started by the resources projection (#44). MCP resources are the correct read side but the least-supported MCP primitive — some hosts (e.g. Cursor) are tools-only. A getState tool is the portable hedge that works on any tools-capable host, including a direct Anthropic/Vercel tool projection (research-11 §3.2, "ship both").

This directly serves the named consumer reelee-web, which consumes buildToolsList to feed Anthropic tools (not MCP) — so a pure getState descriptor slots straight into its flow.

Changes

  • Pure (resources.ts): buildGetStateTool(views, opts) → a wire-safe (app_getState default, ^[a-zA-Z0-9_-]{1,64}$), readOnlyHint tool descriptor whose view param enumerates the listed view ids; callGetState(views, args) → errors-as-data (invalid viewisError; unknown/internal view → null).
  • Server: createMcpServer(registry, { views, getStateTool: true }) merges the tool into tools/list and routes it in tools/call. Default off; requires views. Backward-compatible.
  • McpToolDescriptor gained an optional annotations field (readOnlyHint/destructiveHint/idempotentHint/openWorldHint); the getState tool sets it. Command-tool projection unchanged (deriving annotations from a command side-effect class stays deferred with the confirmation-gate work).
  • +5 tests (28 in the package); typecheck + build + full workspace green.

Docs

README getState section; acture-mcp + acture-ai-assistant skills note the shipped tool; roadmap v1.16. minor changeset (acture-mcp-server 1.2.0 → 1.3.0).

Still deferred

The keymap-customization helper (second v1.14 accelerator) and the sideEffect/requiresConfirmation closed-surface question.

https://claude.ai/code/session_016teVFousRsWNhiiPNpG1p9

Completes the read side started by the resources projection. MCP resources are
the correct read side but the least-supported MCP primitive (some hosts — e.g.
Cursor — are tools-only); a getState TOOL is the portable hedge that works on any
tools-capable host, including a direct Anthropic/Vercel tool projection
(research-11 §3.2, "ship both"). Directly serves reelee-web, which consumes
buildToolsList to feed Anthropic tools (not MCP).

- Pure (resources.ts): buildGetStateTool(views, opts) → a wire-safe
  (app_getState default) readOnlyHint tool descriptor whose `view` param
  enumerates the listed view ids; callGetState(views, args) reads the view as
  errors-as-data (invalid view → isError; unknown/internal → null).
- Server: createMcpServer(registry, { views, getStateTool: true }) merges the
  tool into tools/list and routes it in tools/call. Default off; requires views.
  Fully backward-compatible.
- McpToolDescriptor gained an optional `annotations` field (readOnlyHint etc.);
  the getState tool sets it. Command-tool projection unchanged.
- +5 tests (28 in the package); typecheck + build + workspace green.

Docs: README getState section; acture-mcp + acture-ai-assistant skills note the
shipped tool; roadmap v1.16 entry. minor changeset (1.2.0 → 1.3.0).

Claude-Session: https://claude.ai/code/session_016teVFousRsWNhiiPNpG1p9
@thorwhalen thorwhalen merged commit e58263e into main Jul 6, 2026
1 check passed
@thorwhalen thorwhalen deleted the feat/mcp-getstate branch July 6, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant