| | import requests |
| | import json |
| |
|
| | def call_mcp(tool, params=None): |
| | response = requests.post( |
| | 'http://localhost:8000/mcp', |
| | headers={'X-API-Key': 'dev-key-123', 'Content-Type': 'application/json'}, |
| | json={'tool': tool, 'params': params or {}} |
| | ) |
| | return response.json() |
| |
|
| | |
| | workflow = call_mcp('write_graph', { |
| | 'action': 'create_node', |
| | 'label': 'Workflow', |
| | 'properties': { |
| | 'id': 'demo-workflow-1', |
| | 'name': 'Entity Resolution Demo', |
| | 'status': 'active', |
| | 'max_iterations': 10, |
| | 'current_iteration': 0 |
| | } |
| | }) |
| | print(f'Created workflow: {workflow}') |
| |
|
| | |
| | instructions = [ |
| | { |
| | 'id': 'inst-1', |
| | 'sequence': 1, |
| | 'type': 'discover_schema', |
| | 'status': 'pending', |
| | 'pause_duration': 300, |
| | 'parameters': '{}' |
| | }, |
| | { |
| | 'id': 'inst-2', |
| | 'sequence': 2, |
| | 'type': 'generate_sql', |
| | 'status': 'pending', |
| | 'pause_duration': 300, |
| | 'parameters': json.dumps({'question': 'Show all customers who have placed orders'}) |
| | }, |
| | { |
| | 'id': 'inst-3', |
| | 'sequence': 3, |
| | 'type': 'review_results', |
| | 'status': 'pending', |
| | 'pause_duration': 300, |
| | 'parameters': '{}' |
| | } |
| | ] |
| |
|
| | for inst in instructions: |
| | result = call_mcp('write_graph', { |
| | 'action': 'create_node', |
| | 'label': 'Instruction', |
| | 'properties': inst |
| | }) |
| | print(f'Created instruction: {inst["id"]}') |
| |
|
| | print('✅ Seeding complete!') |