from kapso.builder.nodes.subagent.tools import WebhookTool
tool = WebhookTool(
name="order_api", # Required: tool identifier
url="https://api.example.com/orders", # Required: API endpoint
http_method="POST", # Optional: GET, POST, PUT, PATCH, DELETE
headers={ # Optional: request headers
"Authorization": "Bearer {{api_key}}",
"Content-Type": "application/json"
},
body={ # Optional: request body
"order_id": "{{order_id}}",
"action": "status"
},
body_schema={ # Optional: JSON Schema validation
"type": "object",
"properties": {
"order_id": {"type": "string"},
"action": {"type": "string"}
},
"required": ["order_id"]
},
jmespath_query="data.status", # Optional: extract specific data
mock_response={"status": "shipped"}, # Optional: for testing
mock_response_enabled=True, # Optional: enable mock
description="Check order status" # Optional but recommended
)
node.add_tool(tool)