Spaces:
No application file
No application file
File size: 1,572 Bytes
84473fd 7faf776 84473fd 7faf776 84473fd 7faf776 84473fd 7faf776 84473fd 7faf776 84473fd 7faf776 84473fd 7faf776 84473fd 7faf776 | 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 | 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()
# Create demo workflow
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}')
# Create three instructions with parameters
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!') |