Spaces:
Sleeping
Sleeping
File size: 6,367 Bytes
32dc112 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# π§ͺ Testing Guide
## Quick Start: Test with Sample Files
We've created sample files in the `examples/` directory to demonstrate all MissionControlMCP tools.
### Run All Tests
```bash
python demo.py
```
This will test:
- β
**Text Extraction** - Keywords & summarization from business report
- β
**Email Classification** - Intent detection on 3 sample emails
- β
**Data Visualization** - Line and bar charts from CSV data
- β
**KPI Generation** - Calculate business metrics
- β
**RAG Semantic Search** - Semantic search across documents
---
## Test Individual Tools
### 1. Text Extractor
```python
from tools.text_extractor import extract_text
# Read sample report
with open("examples/sample_report.txt", "r") as f:
text = f.read()
# Extract keywords
keywords = extract_text(text, operation="keywords")
print(keywords)
# Generate summary
summary = extract_text(text, operation="summarize", max_length=200)
print(summary['result'])
```
### 2. Email Intent Classifier
```python
from tools.email_intent_classifier import classify_email_intent
# Test complaint email
with open("examples/sample_email_complaint.txt", "r") as f:
email = f.read()
result = classify_email_intent(email)
print(f"Intent: {result['intent']} (confidence: {result['confidence']})")
```
### 3. Data Visualizer
```python
from tools.data_visualizer import visualize_data
# Load CSV data
with open("examples/business_data.csv", "r") as f:
data = f.read()
# Create revenue trend chart
chart = visualize_data(
data=data,
chart_type="line",
x_column="month",
y_column="revenue",
title="Revenue Trends"
)
# Save chart
import base64
with open("revenue_chart.png", "wb") as f:
f.write(base64.b64decode(chart['image_base64']))
```
### 4. KPI Generator
```python
from tools.kpi_generator import generate_kpis
import json
data = {
"revenue": 5500000,
"costs": 3400000,
"customers": 2700,
"current_revenue": 5500000,
"previous_revenue": 5400000,
"employees": 50
}
result = generate_kpis(json.dumps(data), metrics=["revenue", "growth", "efficiency"])
print(f"Generated {len(result['kpis'])} KPIs")
print(result['summary'])
```
### 5. RAG Semantic Search
```python
from tools.rag_search import search_documents
# Load sample documents
with open("examples/sample_documents.txt", "r") as f:
content = f.read()
documents = [doc.strip() for doc in content.split("##") if doc.strip()]
# Search
results = search_documents("What is machine learning?", documents, top_k=3)
for res in results['results']:
print(f"Score: {res['score']:.4f} - {res['document'][:100]}...")
```
---
## Test with Claude Desktop
### 1. Configure Claude Desktop
Edit `%AppData%\Claude\claude_desktop_config.json`:
```json
{
"mcpServers": {
"mission-control": {
"command": "python",
"args": ["C:/path/to/mission_control_mcp/mcp_server.py"]
}
}
}
```
### 2. Restart Claude Desktop
### 3. Try These Prompts
**Text Processing:**
```
Extract keywords from this text: [paste sample_report.txt content]
```
**Email Classification:**
```
Classify this email: [paste sample_email_complaint.txt content]
```
**Data Visualization:**
```
Create a line chart showing revenue trends from this data: [paste business_data.csv]
```
**KPI Generation:**
```
Calculate KPIs from this business data: {"revenue": 5000000, "costs": 3000000, "customers": 2500}
```
**Semantic Search:**
```
Search these documents for information about AI: [paste sample_documents.txt]
```
---
## Test MCP Server Directly
### Run the MCP Server
```bash
python mcp_server.py
```
### Test Individual Tools
```bash
python test_individual.py
```
This runs isolated tests on each tool (8 total).
### MCP Server Tests
```bash
python demo.py
```
Tests all MCP tool handlers and server integration.
---
## Sample Files Overview
| File | Purpose | Tool |
|------|---------|------|
| `sample_report.txt` | Business report (2,200 chars) | Text Extractor |
| `business_data.csv` | 12 months financial data | Data Visualizer, KPI Generator |
| `sample_email_complaint.txt` | Customer complaint | Email Classifier |
| `sample_email_inquiry.txt` | Sales inquiry | Email Classifier |
| `sample_email_urgent.txt` | Urgent system alert | Email Classifier |
| `sample_documents.txt` | 5 topic documents | RAG Search |
---
## Expected Results
### Text Extraction
- **Keywords:** customer, revenue, growth, operational, market, performance
- **Summary:** ~200 character executive summary
### Email Classification
- **Complaint:** request + order intents (confidence: 1.00)
- **Inquiry:** meeting + inquiry intents (confidence: 1.00)
- **Urgent:** urgent intent (confidence: 1.00)
### Data Visualization
- **Line Chart:** 48KB base64 PNG (1000x600px)
- **Bar Chart:** 26KB base64 PNG (1000x600px)
### KPI Generation
- **9 KPIs calculated:** total_revenue, profit, profit_margin_percent, revenue_growth, etc.
- **Summary:** Executive insights on revenue growth and profitability
### RAG Search
- **Query:** "What is machine learning?"
- **Top Result:** Document 1 (AI Overview) - Score: 0.56
- **Semantic matching:** Finds relevant content even with different wording
---
## Troubleshooting
### FAISS Errors
```bash
pip install faiss-cpu sentence-transformers
```
### Import Errors
```bash
cd mission_control_mcp
pip install -r requirements.txt
```
### Python Version
Requires Python 3.11+. Check with:
```bash
python --version
```
---
## Performance Benchmarks
| Tool | Sample File | Execution Time |
|------|-------------|----------------|
| Text Extractor | 2,200 chars | ~0.5s |
| Email Classifier | 500 chars | ~0.1s |
| Data Visualizer | 12 data points | ~1.2s |
| KPI Generator | 10 metrics | ~0.3s |
| RAG Search | 6 documents | ~2.5s (first run, includes model load) |
---
## Next Steps
1. β
Run `python demo.py` to verify all tools work
2. β
Try individual tool tests with your own data
3. β
Configure Claude Desktop integration
4. β
Test with Claude using sample prompts
5. β
Create custom workflows combining multiple tools
**Happy Testing!** π
|