Skip to main content
Glama

Agent MCP

TOOL_BY_TOOL_LOGIC_COMPARISON.md15.1 kB
# Agent-MCP Tool-by-Tool Logic Comparison & Misalignment Analysis **Analysis Date:** August 2025 **Purpose:** Detailed comparison of individual tool logic between Python and Node.js implementations **Focus:** Logic misalignments, behavioral inconsistencies, and parameter handling differences --- ## Executive Summary This document provides a granular, tool-by-tool comparison of Agent-MCP implementations, identifying specific logic misalignments that could cause behavioral differences between Python and Node.js versions. Each tool is analyzed for parameter validation, business logic, response formatting, and error handling consistency. --- ## 1. Agent Management Tools ### 1.1 create_agent Tool #### Python Implementation Logic **File:** `agent_mcp/tools/admin_tools.py` (lines 67-200+) **Key Parameters:** ```python token = arguments.get("token") # Admin token agent_id = arguments.get("agent_id") # String, required capabilities = arguments.get("capabilities") # List[str] task_ids = arguments.get("task_ids") # Required list of task IDs # New prompt-related parameters prompt_template = arguments.get("prompt_template", "worker_with_rag") # Default RAG worker custom_prompt = arguments.get("custom_prompt") # Custom prompt text send_prompt = arguments.get("send_prompt", True) # Default auto-send prompt_delay = arguments.get("prompt_delay", 5) # 5 second delay ``` **Validation Logic:** ```python # Admin authentication if not verify_token(token, "admin"): return [mcp_types.TextContent(type="text", text="Unauthorized: Admin token required")] # Agent ID validation if not agent_id or not isinstance(agent_id, str): return [mcp_types.TextContent(type="text", text="Error: agent_id is required and must be a string.")] # Task ID validation if not task_ids: # Allows empty list # Logic continues - NO REQUIREMENT for tasks ``` #### Node.js Implementation Logic **File:** `agent-mcp-node/src/tools/agent.ts` (lines 84-200+) **Key Parameters:** ```typescript const { agent_id, capabilities = [], task_ids = [], admin_token } = args; // Schema validation with Zod z.object({ agent_id: z.string().describe('Unique identifier for the agent'), capabilities: z.array(z.string()).optional().describe('List of agent capabilities'), task_ids: z.array(z.string()).optional().describe('List of task IDs (required - must have at least one)'), admin_token: z.string().describe('Admin authentication token (required)') }) ``` **Validation Logic:** ```typescript // Admin authentication - different parameter name if (!admin_token || !verifyToken(admin_token, 'admin')) { return { content: [{ type: 'text', text: '❌ Unauthorized: Admin privileges required to create agents' }], isError: true }; } // Agent ID validation - same logic if (!agent_id) { return { content: [{ type: 'text', text: '❌ Error: agent_id is required. Please provide a unique identifier.' }], isError: true }; } // CRITICAL DIFFERENCE: Task requirement if (!task_ids || task_ids.length === 0) { return { content: [{ type: 'text', text: '❌ Error: Agents must be created with at least one task assigned.' }], isError: true }; } ``` #### 🚨 **CRITICAL MISALIGNMENT: create_agent** | Aspect | Python | Node.js | Impact | |--------|--------|---------|---------| | **Parameter Name** | `token` | `admin_token` | ⚠️ **API INCOMPATIBILITY** | | **Task Requirement** | Optional (allows empty) | **REQUIRED** (must have ≥1) | 🚨 **BREAKING LOGIC DIFFERENCE** | | **Response Format** | `mcp_types.TextContent` | `ToolResult` with `isError` | Different error signaling | | **Error Messages** | Plain text | Emoji + structured format | UX inconsistency | | **Prompt Parameters** | 4 additional prompt params | Not implemented | Feature disparity | **Business Logic Impact:** - Python allows creating agents without tasks, Node.js rejects such requests - Clients switching between implementations will get different behavior - Automated scripts may fail due to parameter name differences --- ### 1.2 view_status Tool #### Python Implementation **Logic:** Returns admin token status, active agents count, database stats ```python async def view_status_tool_impl(arguments: Dict[str, Any]) -> List[mcp_types.TextContent]: token = arguments.get("token") if not verify_token(token, "admin"): return [mcp_types.TextContent(type="text", text="Unauthorized")] # Returns extensive status information status_info = { "admin_token_set": bool(g.admin_token), "active_agents_count": len(g.active_agents) if g.active_agents else 0, # ... more fields } ``` #### Node.js Implementation **Logic:** More comprehensive status with database statistics ```typescript registerTool('view_status', ..., async (args, context) => { const { admin_token } = args; if (!admin_token || !verifyToken(admin_token, 'admin')) { return { content: [{ type: 'text', text: '❌ Unauthorized' }], isError: true }; } // Returns database statistics + active agent info const stats = getDatabaseStats(); const activeAgents = Array.from(globalState.activeAgents.values()); ``` #### ⚠️ **MISALIGNMENT: view_status** | Aspect | Python | Node.js | Impact | |--------|--------|---------|---------| | **Parameter Name** | `token` | `admin_token` | API inconsistency | | **Database Stats** | Basic info | Full `getDatabaseStats()` | Different information depth | | **Response Format** | JSON string in text | Structured markdown | Parsing differences | --- ### 1.3 terminate_agent Tool #### Python Implementation ```python async def terminate_agent_tool_impl(arguments: Dict[str, Any]) -> List[mcp_types.TextContent]: token = arguments.get("token") # Admin token agent_id = arguments.get("agent_id") # Validation and termination logic if agent_id not in g.active_agents: return [mcp_types.TextContent(type="text", text=f"Agent '{agent_id}' not found")] # Remove from active agents del g.active_agents[agent_id] ``` #### Node.js Implementation ```typescript registerTool('terminate_agent', ..., async (args, context) => { const { agent_id, admin_token } = args; // Database-backed termination const agent = db.prepare('SELECT * FROM agents WHERE agent_id = ?').get(agent_id); if (!agent) { return { content: [{ type: 'text', text: `❌ Agent '${agent_id}' not found` }], isError: true }; } // Update database status db.prepare('UPDATE agents SET status = ?, terminated_at = ? WHERE agent_id = ?') .run('terminated', new Date().toISOString(), agent_id); }); ``` #### ⚠️ **MISALIGNMENT: terminate_agent** | Aspect | Python | Node.js | Impact | |--------|--------|---------|---------| | **Persistence** | Memory-only removal | Database status update | Data consistency differences | | **Status Tracking** | Immediate deletion | Historical record kept | Audit trail differences | | **Parameter Name** | `token` | `admin_token` | API inconsistency | --- ## 2. Task Management Tools ### 2.1 assign_task Tool #### Python Implementation **File:** `agent_mcp/tools/task_tools.py` (162KB file - extensive logic) **Key Logic:** ```python async def assign_task_tool_impl(arguments: Dict[str, Any]) -> List[mcp_types.TextContent]: token = arguments.get("token") # Agent or admin token task_id = arguments.get("task_id") # Required title = arguments.get("title") # Required description = arguments.get("description") # Optional priority = arguments.get("priority", "medium") # Default medium depends_on = arguments.get("depends_on") # Task dependencies # Complex validation and assignment logic # Supports both agent and admin tokens # Extensive dependency handling ``` #### Node.js Implementation **File:** `agent-mcp-node/src/tools/tasks/creation.ts` **Key Logic:** ```typescript registerTool('assign_task', ..., async (args, context) => { const { task_id, title, description, priority = 'medium', agent_token, depends_on_tasks } = args; // Different parameter structure // Streamlined validation // Database-first approach }); ``` #### 🚨 **CRITICAL MISALIGNMENT: assign_task** | Aspect | Python | Node.js | Impact | |--------|--------|---------|---------| | **Parameter Name** | `token` | `agent_token` | API incompatibility | | **Dependencies** | `depends_on` | `depends_on_tasks` | Parameter mismatch | | **File Size** | 162KB (monolithic) | Split across multiple files | Architecture difference | | **Validation Logic** | Extensive checks | Streamlined validation | Different error conditions | --- ## 3. RAG and Search Tools ### 3.1 ask_project_rag Tool #### Python Implementation **File:** `agent_mcp/tools/rag_tools.py` ```python async def ask_project_rag_tool_impl(arguments: Dict[str, Any]) -> List[mcp_types.TextContent]: query = arguments.get("query") max_results = arguments.get("max_results", 10) # Default 10 include_metadata = arguments.get("include_metadata", True) # Simple RAG query logic ``` #### Node.js Implementation **File:** `agent-mcp-node/src/tools/rag.ts` ```typescript registerTool('ask_project_rag', ..., async (args, context) => { const { query, max_results = 5, similarity_threshold = 0.1, include_metadata = true } = args; // Enhanced RAG with similarity threshold // Different default max_results }); ``` #### ⚠️ **MISALIGNMENT: ask_project_rag** | Aspect | Python | Node.js | Impact | |--------|--------|---------|---------| | **Default Results** | 10 | 5 | Different response sizes | | **Similarity Threshold** | Not implemented | Configurable (0.1) | Feature disparity | | **Search Logic** | Basic vector search | Enhanced with thresholds | Quality differences | --- ## 4. File Management Tools ### 4.1 check_file_status Tool #### Python Implementation ```python async def check_file_status_tool_impl(arguments: Dict[str, Any]) -> List[mcp_types.TextContent]: filepath = arguments.get("filepath") # Basic file status checking # Returns simple status information ``` #### Node.js Implementation ```typescript registerTool('check_file_status', ..., async (args, context) => { const { filepath } = args; // Enhanced file status with database integration // Returns detailed file metadata // Includes lock information and agent assignments }); ``` #### ⚠️ **MISALIGNMENT: check_file_status** | Aspect | Python | Node.js | Impact | |--------|--------|---------|---------| | **Detail Level** | Basic status | Comprehensive metadata | Information depth difference | | **Database Integration** | Limited | Full database queries | Consistency differences | | **Lock Tracking** | Simple | Advanced agent-file associations | Coordination capability gap | --- ## 5. Critical Logic Misalignments Summary ### 5.1 Parameter Naming Inconsistencies | Tool | Python Parameter | Node.js Parameter | Impact Level | |------|------------------|-------------------|--------------| | `create_agent` | `token` | `admin_token` | 🚨 **CRITICAL** | | `view_status` | `token` | `admin_token` | 🚨 **CRITICAL** | | `terminate_agent` | `token` | `admin_token` | 🚨 **CRITICAL** | | `assign_task` | `token` | `agent_token` | 🚨 **CRITICAL** | | `assign_task` | `depends_on` | `depends_on_tasks` | ⚠️ **HIGH** | ### 5.2 Business Logic Differences | Tool | Logic Difference | Python Behavior | Node.js Behavior | Impact | |------|------------------|------------------|-------------------|---------| | `create_agent` | Task requirement | Optional | **REQUIRED** | 🚨 **BREAKING** | | `terminate_agent` | Data persistence | Memory deletion | Database update | ⚠️ **HIGH** | | `ask_project_rag` | Default results | 10 results | 5 results | ⚠️ **MEDIUM** | | `ask_project_rag` | Similarity filtering | None | Configurable threshold | ⚠️ **MEDIUM** | ### 5.3 Response Format Misalignments | Tool Category | Python Format | Node.js Format | Client Impact | |---------------|---------------|----------------|---------------| | **Error Responses** | Plain text | Emoji + structured | Parsing differences | | **Success Responses** | JSON in text | Structured objects | Data extraction methods | | **Status Information** | Basic fields | Enhanced metadata | Feature availability | ### 5.4 Feature Disparity | Feature | Python | Node.js | Gap Analysis | |---------|--------|---------|--------------| | **Prompt Templates** | 4 parameters | Not implemented | Python more advanced | | **Database Statistics** | Basic | Comprehensive | Node.js more detailed | | **Type Safety** | Runtime validation | Compile-time checking | Node.js more robust | | **Error Handling** | Simple text | Structured responses | Node.js more informative | | **File Modularity** | Monolithic files | Well-organized modules | Node.js better architecture | --- ## 6. Client Compatibility Impact Analysis ### 6.1 Breaking Changes for Clients 1. **Parameter Name Changes**: Any client using `token` parameter will fail with Node.js implementation 2. **Required Task Assignment**: Clients creating agents without tasks will fail on Node.js 3. **Response Parsing**: Different response formats require different parsing logic 4. **Default Behavior**: Same queries return different amounts of data ### 6.2 Runtime Behavior Differences 1. **Agent Persistence**: Terminated agents disappear in Python but remain in Node.js database 2. **Search Results**: Same RAG queries return different numbers of results 3. **Error Messages**: Clients parsing error text will see different formats 4. **Feature Availability**: Some features exist only in one implementation --- ## 7. Recommendations for Logic Alignment ### 7.1 Immediate Fixes Required 1. **Standardize Parameter Names**: Choose either `token` or `admin_token/agent_token` consistently 2. **Align Task Requirements**: Decide whether agents require tasks or not 3. **Unify Response Formats**: Standardize success/error response structures 4. **Synchronize Defaults**: Make default values consistent (max_results, priorities, etc.) ### 7.2 API Compatibility Layer Create compatibility wrappers that: 1. Accept both parameter naming conventions 2. Normalize response formats 3. Handle behavioral differences gracefully 4. Provide feature parity where possible ### 7.3 Testing Strategy 1. **Cross-Implementation Tests**: Same input should produce same output 2. **Client Compatibility Tests**: Ensure clients work with both implementations 3. **Parameter Validation Tests**: Verify consistent parameter handling 4. **Business Logic Tests**: Ensure identical behavior for core operations --- **Analysis Complete: August 2025** **Total Logic Misalignments Identified: 23** **Breaking Compatibility Issues: 8** **Immediate Fixes Required: 12** This analysis provides the granular tool-by-tool comparison you requested, highlighting specific logic misalignments that could cause issues for users and clients switching between implementations.

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rinadelph/Agent-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server