Skip to content

refactor: collapse mcp surface to ledgerr tools#27

Merged
elasticdotventures merged 1 commit into
mainfrom
codex-reduce-mcp-surface-ledgerr
Apr 17, 2026
Merged

refactor: collapse mcp surface to ledgerr tools#27
elasticdotventures merged 1 commit into
mainfrom
codex-reduce-mcp-surface-ledgerr

Conversation

@elasticdotventures
Copy link
Copy Markdown
Member

@elasticdotventures elasticdotventures commented Apr 16, 2026

Summary

Collapse the advertised MCP surface from 28 tools to 7 top-level ledgerr_* capabilities while keeping the major domain areas visible:

  • ledgerr_documents
  • ledgerr_review
  • ledgerr_reconciliation
  • ledgerr_workflow
  • ledgerr_audit
  • ledgerr_tax
  • ledgerr_ontology

What changed

  • moved published tool discovery to the reduced 7-tool surface
  • switched the public namespace from l3dg3rr_* to ledgerr_*
  • relocated plugin operations under ledgerr_workflow via action: "plugin_info"
  • kept older l3dg3rr_* and proxy-style names as hidden compatibility aliases in server dispatch
  • updated MCP adapter schemas, server dispatch, outcome flow, tests, docs, and scripts
  • recorded the new surface rule in AGENTS.md

Validation

  • cargo test -p ledgerr-mcp
  • just test

Closes #19

Related follow-on gaps:

Copilot AI review requested due to automatic review settings April 16, 2026 21:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the MCP server’s advertised tool surface into a reduced set of 7 top-level ledgerr_* tools with action-based subcommands, while keeping legacy l3dg3rr_*/proxy tool names as hidden compatibility aliases.

Changes:

  • Collapses the MCP tool catalog to 7 ledgerr_* capability families and routes calls via action dispatch in the adapter/server.
  • Updates e2e tests and demo scripts to use the new ledgerr_* tool names and action arguments.
  • Refreshes operator docs/runbooks to reflect the reduced catalog and new invocation patterns.

Reviewed changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
scripts/mcp_e2e.sh Updates the e2e script to run tests from the renamed crate/package.
scripts/mcp_cli_demo.sh Updates demo calls to the new ledgerr_* tools and action-based arguments.
docs/mcp-capability-contract.md Rewrites MCP surface documentation to reflect the reduced 7-tool catalog and compatibility notes.
docs/claude-cowork-plugin-marketplace.md Updates marketplace/runtime docs and example tools/call usage for the new surface.
docs/agent-mcp-runbook.md Simplifies the runbook and updates examples/test commands for the new tool surface.
crates/ledgerr-mcp/tests/* Updates MCP e2e/contract tests to validate the reduced advertised catalog and new tool names.
crates/ledgerr-mcp/src/mcp_adapter.rs Implements grouped tools (ledgerr_*) with action dispatch and updates tool catalog/schema generation.
crates/ledgerr-mcp/src/bin/mcp-outcome-test.rs Updates the outcome-test flow to the new tool names/action arguments.
crates/ledgerr-mcp/src/bin/ledgerr-mcp-server.rs Routes tools/call to the new grouped tools while preserving legacy aliases.
README.md Updates README language to describe the reduced 7-tool MCP surface.
AGENTS.md Documents the new “published surface rule” and updates canonical contract path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +177 to +181
WORKFLOW_TOOL => json!({
"type": "object",
"required": ["state_marker"],
"required": ["action"],
"properties": {
"state_marker": { "type": "string" }
"action": {
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ledgerr_workflow schema requires only action, but transition and resume calls require additional mandatory fields (target_state/target_substate and state_marker respectively). Please make the schema action-sensitive (e.g., oneOf per action) so callers can discover the true required arguments via tools/list.

Copilot uses AI. Check for mistakes.
Comment on lines 12 to 16
- Marketplace catalog: [marketplace.json](/home/brianh/promptexecution/mbse/l3dg3rr/.claude-plugin/marketplace.json)
- Plugin manifest: [plugin.json](/home/brianh/promptexecution/mbse/l3dg3rr/plugins/l3dg3rr-plugin-create/.claude-plugin/plugin.json)
- Plugin skill: [SKILL.md](/home/brianh/promptexecution/mbse/l3dg3rr/plugins/l3dg3rr-plugin-create/skills/plugin-create-for-l3dg3rr/SKILL.md)
- MCP server entrypoint: [turbo-mcp-server.rs](/home/brianh/promptexecution/mbse/l3dg3rr/crates/turbo-mcp/src/bin/turbo-mcp-server.rs)
- MCP server entrypoint: [ledgerr-mcp-server.rs](/mnt/c/users/wendy/l3dg3rr/crates/ledgerr-mcp/src/bin/ledgerr-mcp-server.rs)
- Runtime helper commands: [Justfile](/home/brianh/promptexecution/mbse/l3dg3rr/Justfile)
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This markdown link points to a developer-specific absolute path (/mnt/c/users/wendy/...), which will be broken for other users and in GitHub rendering. Please switch to a repository-relative link (e.g., crates/ledgerr-mcp/src/bin/ledgerr-mcp-server.rs) like the other docs in the repo.

Copilot uses AI. Check for mistakes.
Comment on lines +98 to +105
DOCUMENTS_TOOL => json!({
"type": "object",
"required": ["pdf_path", "journal_path", "workbook_path"],
"required": ["action"],
"properties": {
"action": {
"type": "string",
"enum": ["list_accounts", "get_raw_context", "pipeline_status", "validate_filename", "ingest_pdf", "ingest_rows"]
},
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tool_input_schema for ledgerr_documents only requires action, but the handler/parsers require additional fields depending on the action (e.g., ingest_pdf needs pdf_path/journal_path/workbook_path; ingest_rows needs rows). Please update the schema to reflect action-specific required arguments (e.g., via oneOf branches per action) so tools/list is code-aligned and clients can validate inputs before calling.

Copilot uses AI. Check for mistakes.
"items": {
"type": "object",
"required": ["account_id", "date", "amount", "description", "source_ref"],
"required": ["date", "amount", "description", "source_ref"],
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Schema for rows items does not require account_id/account, but parse_rows will error unless one of those fields is present. The schema should enforce this (e.g., require account_id or use anyOf to require either account_id or account) to avoid advertising an input shape that is guaranteed to fail at runtime.

Suggested change
"required": ["date", "amount", "description", "source_ref"],
"required": ["date", "amount", "description", "source_ref"],
"anyOf": [
{ "required": ["account_id"] },
{ "required": ["account"] }
],

Copilot uses AI. Check for mistakes.
Comment on lines +202 to 205
TAX_TOOL => json!({
"type": "object",
"required": ["ontology_path", "from_entity_id", "reconciliation"],
"required": ["action"],
"properties": {
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ledgerr_tax schema only requires action, but assist/ambiguity_review parsing requires ontology_path, from_entity_id, and a nested reconciliation object. This schema/API mismatch will cause clients using tools/list schemas to produce invalid calls. Consider using oneOf with action-specific required fields (and making reconciliation required for the actions that need it).

Copilot uses AI. Check for mistakes.
Comment on lines 229 to +233
"type": "object",
"required": ["path", "entities"],
"required": ["action", "ontology_path"],
"properties": {
"path": { "type": "string" },
"action": { "type": "string", "enum": ["query_path", "export_snapshot", "upsert_entities", "upsert_edges"] },
"ontology_path": { "type": "string" },
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ledgerr_ontology schema globally requires ontology_path but does not require from_entity_id for the query_path action, even though parse_ontology_query_path_request requires it. This should be reflected in the schema (e.g., oneOf per action) to prevent clients from generating calls that will deterministically fail.

Copilot uses AI. Check for mistakes.
@elasticdotventures elasticdotventures merged commit 2c5ade7 into main Apr 17, 2026
7 checks passed
promptexecutionerr pushed a commit that referenced this pull request Apr 17, 2026
…cture

Merges origin/main (PRs #27-#30: MCP surface collapse, codegen contract,
workbook export, persist state) into codex-issue-23-document-queue.

Resolution strategy:
- Keep origin/main's 7-tool contract architecture throughout
- Retain document inventory helpers (lib.rs) and service call path
- Add DocumentInventory as a new action variant in DocumentsArgs so
  document_inventory is now reachable as ledgerr_documents + action
- Add handle_document_inventory + parse helpers to mcp_adapter.rs
- Update PUBLISHED_TOOLS actions list and mcp-capability-contract.md
  to include document_inventory in the ledgerr_documents row

All 41 test suites pass including contract_codegen schema/doc drift checks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

MCP surface redesign: collapse 28 tools into 7 top-level ledgerr_* capabilities

2 participants