Commit 553239f
committed
Test: Add automated test script for agentic MCP tools
Created test_agentic_tools.py - a comprehensive test harness for all 7
agentic MCP tools with support for long-running multi-step workflows.
## Features:
### 1. Long-Running Task Support
- Extended timeouts: 60-90 seconds per tool (vs 2-5s for regular tools)
- Real-time progress indicators with dots every 5 seconds
- Handles multi-step reasoning workflows that can take 10-60+ seconds
- Graceful timeout handling with informative messages
### 2. Tests All 7 Agentic Tools
- agentic_code_search - Config loading mechanism analysis
- agentic_dependency_analysis - AgenticOrchestrator dependencies
- agentic_call_chain_analysis - Execution flow tracing
- agentic_architecture_analysis - Hub nodes and coupling metrics
- agentic_api_surface_analysis - GraphToolExecutor public API
- agentic_context_builder - Tier-aware prompt system context
- agentic_semantic_question - LRU cache deep dive
### 3. SurrealDB Integration
- Checks for SurrealDB configuration before running
- Provides setup instructions if not configured
- Supports both local and cloud SurrealDB instances
- Interactive prompt to continue if SurrealDB not detected
### 4. Configuration Display
- Shows LLM provider, model, context window
- Auto-calculates tier (Small/Medium/Large/Massive)
- Displays prompt type and max steps based on tier
- Shows SurrealDB connection details
- Supports MCP_CODE_AGENT_MAX_OUTPUT_TOKENS override
### 5. Progress Tracking
- Real-time output streaming
- Progress dots for long-running operations
- Success/failure detection from JSON responses
- Extracts reasoning step count and final answers
- Test summary with pass/fail counts and durations
### 6. Environment Integration
- Loads .env file automatically (requires python-dotenv)
- Falls back to environment variables
- Uses same configuration system as test_mcp_tools.py
- Supports cargo run or pre-built binaries
## Usage:
```bash
# Install dependencies
pip install python-dotenv
# Setup SurrealDB (option 1 - local)
curl -sSf https://install.surrealdb.com | sh
surreal start --bind 127.0.0.1:3004 --user root --pass root memory
# Or use SurrealDB Cloud (option 2 - free 1GB)
# Sign up at https://surrealdb.com/cloud
# Configure .env
export SURREALDB_URL=ws://localhost:3004
export SURREALDB_NAMESPACE=codegraph
export SURREALDB_DATABASE=main
export CODEGRAPH_MODEL=qwen2.5-coder:14b
export CODEGRAPH_LLM_PROVIDER=ollama
# Run tests
./test_agentic_tools.py
# Expected output:
# ✓ Loaded configuration from .env
# ✓ SurrealDB configured: ws://localhost:3004
# Context Tier: Medium (50K-150K)
# Prompt Type: BALANCED
# Max Steps: 10
# ...
# ✅ SUCCESS in 23.4s (8 reasoning steps)
# Total: 7/7 passed
```
## Implementation Notes:
- Uses --features ai-enhanced (required for agentic tools)
- Timeout values tuned for multi-step workflows:
* Standard analysis: 60s
* Architecture/context: 90s (more complex)
- Parses JSON responses to extract step counts and answers
- Exit code 0 if all pass, 1 if any fail
Complements test_mcp_tools.py which tests standard MCP tools.1 parent cc9b72b commit 553239f
1 file changed
+475
-0
lines changed
0 commit comments