feat: MCP tool parity — 6 new tools + fix schema refs#36
Conversation
Add query_legal_deadlines, query_documents, get_payment_plan, query_revenue_sources, get_sync_status, trigger_sync to close coverage gaps between REST API routes and MCP tool surface. Fix get_schema_refs to list all 29 endpoint groups and 16 db tables instead of the previous incomplete 6/12 hardcoded lists. Total MCP tools: 32 → 38. All tests pass (15/15). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe MCP server tool catalog grows from 32 to 38 tools by adding six new tools (query_legal_deadlines, query_documents, get_payment_plan, query_revenue_sources, get_sync_status, trigger_sync). Server-side handlers, SQL logic, and schema refs/endpoints were extended; tests and docs updated to reflect the new catalog. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client as Client
participant Server as MCP Server
participant DB as Database
Client->>Server: request executeTool(toolName, input)
Server->>Server: validate & normalize input
alt query_* or get_* (read)
Server->>DB: SELECT ... (filtered, limited, aggregated)
DB-->>Server: rows/result
Server->>Client: return count/data/aggregates
else trigger_sync (write)
Server->>Server: validate source against allowed list
Server->>DB: INSERT INTO cc_sync_log (source, type, status, meta)
DB-->>Server: insert confirmation
Server->>Client: return acknowledgement { source }
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/routes/mcp.ts`:
- Around line 853-872: The SQL SELECT in the 'get_payment_plan' case is
referencing a non-existent column revenue_summary from cc_payment_plans and then
attempts to JSON.parse it; remove revenue_summary from the SELECT list and
delete it from the JSON parsing loop that iterates over ['schedule', 'warnings',
'revenue_summary'] (adjust the loop to only include existing JSON columns like
'schedule' and 'warnings') so the plan object and subsequent logic no longer
expect revenue_summary.
- Around line 901-911: The INSERT in the 'trigger_sync' case of
src/routes/mcp.ts omits the required sync_type column for cc_sync_log; modify
the INSERT INTO cc_sync_log statement inside the case 'trigger_sync' block to
include the sync_type column and set it to 'manual' (matching other inserts such
as in src/routes/sync.ts), so the VALUES list includes 'manual' for sync_type to
avoid the NOT NULL constraint violation.
- Around line 821-836: The SQL references a non-existent d.dispute_id column;
update the query in the 'query_legal_deadlines' case to read dispute_id from the
metadata JSONB instead of a missing column: SELECT (d.metadata->>'dispute_id')
AS dispute_id (or cast to UUID if needed), change the LEFT JOIN to use ON
(d.metadata->>'dispute_id')::uuid = disp.id (or compare strings if disp.id is
text), and update the WHERE clause to use (${disputeId}::text IS NULL OR
(d.metadata->>'dispute_id') = ${disputeId}) so the filtering uses the JSONB
value; keep the existing status handling and limit logic (symbols: case
'query_legal_deadlines', d.metadata, cc_legal_deadlines, cc_disputes, status,
disputeId, rows).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 05db0aea-08d3-40a6-bb3f-7c08125e9114
📒 Files selected for processing (3)
CLAUDE.mdsrc/routes/mcp.tstests/mcp.test.ts
- query_legal_deadlines: use metadata->>'dispute_id' (no column exists) - get_payment_plan: remove non-existent revenue_summary column - trigger_sync: include required sync_type column in INSERT Addresses CodeRabbit review findings on PR #36. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 46853 🏁 Script executed: Length of output: 11149 🏁 Script executed: Length of output: 8963
Adversarial Review — PR
|
| # | Severity | Finding |
|---|---|---|
| 1 | 🔴 Critical | get_sync_status — MAX(uuid) returns random row, not latest |
| 2 | 🔴 High | trigger_sync — phantom log entry, no sync dispatched, misleading response |
| 3 | 🔴 High | caller.scopes never enforced; all write tools bypass scope checks |
| 4 | 🟡 Medium | query_legal_deadlines — unguarded ::uuid cast corrupts tool on bad data |
| 5 | 🟡 Medium | trigger_sync schema/server allowlist mismatch (books, assets undocumented) |
| 6 | 🟡 Medium | ledger_record_custody — performedBy hardcoded, audit trail broken |
| — | 🟠 Risk | toBe(38) exact count is a brittle merge gate; no handler-parity test |
Items 1–3 are merge blockers per repository policy. Items 4–6 should be addressed before merge given the legal/financial data sensitivity of this service.
🧠 Learnings used
Learnt from: CR
Repo: chittyos/chittycommand PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-03-04T04:42:57.380Z
Learning: Resolve must-fix review comments (security, correctness, compliance, merge blockers) before merge
Learnt from: CR
Repo: chittyos/chittycommand PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-09T16:02:20.597Z
Learning: Applies to src/routes/mcp.ts : Implement MCP server for Codex integration with 28 tools across 8 domains (Core meta, Financial, Ledger, Connect, ChittyChat, Schema, Cert, Register) in `src/routes/mcp.ts`, returning structured JSON using MCP `content: [{ type: "json", json: ... }]` format where applicable
Summary
query_legal_deadlines,query_documents,get_payment_plan,query_revenue_sources,get_sync_status,trigger_sync— closing coverage gaps between REST API routes and MCP tool surfaceget_schema_refs: Now returns all 29 endpoint groups and 16 db tables (was 6/12)Test plan
tsc --noEmit)vitest run)toBe(38)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests