mcp: fix Gemini register_version schema + optional types#562
Conversation
…rain to JSON-serializable dict | list[dict] for create_version\n- Use for optional args in RAG tools\n- Add AGENTS.md with repo guidelines
|
Caution Review failedThe pull request is closed. WalkthroughType annotations were tightened for public tool functions. The documents version tool now restricts content to JSON-serializable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✨ Finishing Touches
🧪 Generate unit tests
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: 0
🧹 Nitpick comments (2)
python/src/mcp_server/features/documents/version_tools.py (1)
31-33: Good fix: constrainingcontentremoves bareAnyfrom MCP schema; consider two small schema-oriented tweaks
Consider typing
field_nameas a Literal to emit an enum in the tool schema, which helps Gemini/clients validate inputs earlier:from typing import Literal # ... async def create_version( ctx: Context, project_id: str, field_name: Literal["docs", "features", "data", "prd"], content: dict[str, Any] | list[dict[str, Any]], change_summary: str | None = None, document_id: str | None = None, created_by: str = "system", ) -> str: ...For consistency with Python 3.12 style used elsewhere in the PR, prefer
str | NoneoverOptional[str]forchange_summary/document_idhere (and the other tool functions in this file).python/src/mcp_server/modules/rag_module.py (1)
81-81: Signature change tosource_domain: str | Nonelooks right; one minor semantics nitCurrent check uses
if source_domain:which ignores empty strings. If empty string should be treated as “provided but invalid,” switch toif source_domain is not None:and validate non-empty separately; otherwise, keep as-is.Also applies to: 138-138
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
python/src/mcp_server/features/documents/version_tools.py(1 hunks)python/src/mcp_server/modules/rag_module.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
python/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
python/**/*.py: Target Python 3.12 with a 120-character line length
Use Ruff for linting and Mypy for type checking before commit
Files:
python/src/mcp_server/features/documents/version_tools.pypython/src/mcp_server/modules/rag_module.py
{python/**/*.py,archon-ui-main/src/**/*.{ts,tsx,js,jsx}}
📄 CodeRabbit inference engine (CLAUDE.md)
{python/**/*.py,archon-ui-main/src/**/*.{ts,tsx,js,jsx}}: Remove dead code immediately; do not keep legacy/unused functions
Avoid comments that reference change history (e.g., LEGACY, CHANGED, REMOVED); keep comments focused on current functionality
Files:
python/src/mcp_server/features/documents/version_tools.pypython/src/mcp_server/modules/rag_module.py
|
Thank you for this @leoric-crown! |
* mcp: fix Gemini register_version schema and optional types\n\n- Constrain to JSON-serializable dict | list[dict] for create_version\n- Use for optional args in RAG tools\n- Add AGENTS.md with repo guidelines * mcp: remove unintended AGENTS.md from PR --------- Co-authored-by: Cole Medin <cole@dynamous.ai>
) * fix(cataclysm): Restore CATACLYSM_STUDIOS_INC business documents Restores 189 files that were deleted in commit 4490fcde (tier architecture implementation). These documents contain important business, legal, and project planning materials: ABOUT/: - MVP & Community Engagement, Content Strategy - Research SIM/TCM documentation, FAQs - YouTube Channel Content Strategy Charters/: - Fordham Hill Board/Business/Residents Decks (PowerPoint) - Infra & Cloud Guild Charters (Word) - RPE Topic Synthesis Appendix Constitutions/: - Cataclysm DAO Constitution v0.1 Food Cooperative & Group Buying System: - Tokenomics & Smart Contract Design (v1.0, v2.0) - System design documents - Integration of hybrid manufacturing & tokenized co-ops Projections/: - 5-Year Business Projections (AI + Tokenomics) - Community Wealth Building models - Containerized Micro Business Model - Docker-Style Scalable Business Container PMOVES-PROVISIONS/: - docker-stacks/jellyfin-ai/api-gateway (Node.js) Data & Charts: - AI tokenomics business projections (CSV) - Breakeven analysis, business model summaries These are critical business documents that should not have been deleted. Restoring from commit before 4490fcde. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(submodules): Register untracked submodules and fix paths Fixed submodule registrations: - Added PMOVES-AgentGym (was missing from .gitmodules) - Added PMOVES-E2B-Danger-Room (was missing from .gitmodules) - Fixed pmoves-surf path → PMOVES-surf (case mismatch) - Removed PMOVES-E2B-Danger-Room-Deskdesktop (typo duplicate) - Registered 11 previously untracked submodules in git index Submodules now properly tracked: - PMOVES-AgentGym - PMOVES-Archon - PMOVES-Deep-Serch - PMOVES-E2B-Danger-Room - PMOVES-E2B-Danger-Room-Desktop - PMOVES-HiRAG - PMOVES-Remote-View - PMOVES-Tailscale - PMOVES-surf - PMOVES.YT - Pmoves-Jellyfin-AI-Media-Stack 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(agent-zero): Add instruments, knowledge bases and sync scripts Added Agent Zero instruments: - custom/ directory for custom tools - default/yt_download/ - YouTube download instrument (Python + shell) - .gitkeep files for empty directories Added Agent Zero knowledge bases: - custom/ and default/ directories for knowledge storage - main/about/ - GitHub readme and installation docs - solutions/ for solution knowledge Added scripts: - sync-upstream-forks.sh - Sync forked submodules with upstream Documentation: - docs/submodules-audit-p4-p5-summary.md - P4-P5 audit summary 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore(submodules): Update submodule SHAs and fix .gitmodules - Add PMOVES-AgentGym submodule registration - Add PMOVES-E2B-Danger-Room submodule registration - Fix pmoves-surf -> PMOVES-surf path case - Remove typo submodule PMOVES-E2B-Danger-Room-Deskdesktop - Update all submodule SHAs after security hardening 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: Comprehensive security documentation refresh (2026-01-29) ## Overview Update all core documentation to reflect Phase 2 completion of security hardening, including dual-tiered security architecture, USER directives, and production deployment patterns. ## Updated Files (5) - PMOVES.AI-Edition-Hardened-Full.md: Added dual-tiered security section - architecture/network-tier-segmentation.md: Cross-references to 6-tier env - PMOVES_Git_Organization.md: Updated Phase 3 with week-by-week plan - Security-Hardening-Roadmap.md: Marked Phase 1-2 complete (95/100 score) - PMOVES.AI Services and Integrations.md: Restructured as defense-in-depth ## New Files (10) - architecture/6-tier-environment-architecture.md: Secret tier architecture - production/Tailscale-Integration.md: VPN configuration guide - production/GHCR-Namespace-Publishing.md: Image publishing patterns - external-references-summary-2026-01-29.md: Latest GitHub/Docker findings - Security-Hardening-Summary-2025-01-29.md: Consolidated security summary - templates/: Standard documentation templates - submodules-upstream-audit.md: Fork audit results ## Key Highlights - 5-tier network segmentation (physical isolation) - 6-tier environment architecture (logical secret isolation) - USER directive 100% adoption across 35/35 custom services - GHCR lowercase namespace normalization - Tailscale VPN for production access - TensorZero as "secrets fence" for LLM API keys ## Security Score - Current: 95/100 (Phase 1-2 complete) - Target: 98/100 (Phase 3 Q1 2026) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(events): Implement event-driven coordination bus for Agent Zero Implements an event bus for agent coordination based on PMOVES-ToKenism-Multi patterns, enabling pub/sub messaging with NATS and schema validation. ## Changes - **Event Bus** (`bus.py`): Async NATS-backed event bus with retry logic - Event envelope with id, timestamp, type, source, data, metadata - publish(), subscribe(), request() methods - Singleton get_event_bus() function - Metrics tracking (published, processed, failed) - **Event Subjects** (`subjects.py`): Standard event subject constants - Agent lifecycle: AGENT_STARTED, AGENT_STOPPED, AGENT_ERROR - Task events: TASK_CREATED, TASK_ASSIGNED, TASK_COMPLETED, TASK_FAILED - Tool events: TOOL_STARTED, TOOL_COMPLETED, TOOL_FAILED - A2A events: A2A_TASK_SUBMITTED, A2A_TASK_RECEIVED, A2A_ARTIFACT_READY - Wildcard subjects: ALL_PMOVES_EVENTS, ALL_AGENT_EVENTS, etc. - **Schema Validator** (`schema.py`): JSON schema validation for events - 10 predefined schemas for common event types - Schema registry with load from directory support - **Test Suite** (`test_bus.py`): 6 comprehensive test cases ## Features - NATS JetStream support for reliable delivery - Wildcard subscriptions (`pmoves.>` for all events) - Schema validation with graceful fallback - Request-reply pattern support - Connection retry with exponential backoff ## Integration - Subject pattern: `pmoves.{service}.{event}.v1` - Compatible with existing NATS infrastructure - Metrics available via get_metrics() ## References - PMOVES-ToKenism-Multi event bus architecture - PMOVES.AI NATS subject catalog - PMOVES.AI AGENTS implementation roadmap 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(events): Address race conditions and memory leaks from PR review Critical Fixes: 1. Event ID collision - Changed from time.time() to uuid.uuid4() for collision-free unique IDs (tested with 10,000 events, zero collisions) 2. Thread-safe metrics - Added _metrics_lock (asyncio.Lock) to protect metrics updates from race conditions (tested with 100 concurrent tasks) 3. Memory leak in subscriptions - Implemented weakref-based handler tracking with automatic cleanup when handlers are garbage collected 4. Unbounded subscription growth - Added unsubscribe() method and subscription IDs for proper resource management 5. JetStream acknowledgment - Added proper ack/nak handling for JetStream messages with error recovery Important Fixes: 1. Connection failure handling - Added reconnection callbacks (_on_disconnect, _on_reconnect, _on_error, _on_close) with infinite reconnect attempts 2. Improved metrics API - Made get_metrics() async with lock protection, added get_metrics_sync() for non-blocking reads 3. JetStream support - Added use_jetstream parameter and js context initialization 4. Better error recovery - Messages are nacked on handler errors for automatic retry in JetStream Testing: - Added test_critical_fixes.py with 8 unit tests (7 passing) - Added test_thread_safety.py with 9 integration tests (requires NATS) - Verified: 10,000 unique event IDs with UUID v4 - Verified: Thread-safe metrics with 100 concurrent tasks - Verified: Subscription tracking structures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Codex Agent <codex-agent@example.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This PR fixes the following failed MCP tool load in Gemini CLI:
Summary of changes:
Rationale:
These type adjustments align tool schemas with MCP expectations so Gemini recognizes the register version tools reliably.
Notes: No functional behavior changed beyond type annotations; low risk.
Summary by CodeRabbit
Refactor
Chores