API Query Tool
Internal REST API query tool for chat agents providing discovery, monitoring, and troubleshooting capabilities.
Overview
The api_query tool enables chat agents to query the Data Machine REST API (via rest_do_request) for discovery and monitoring. It supports single requests and batch requests.
Parameters
Single request
- endpoint (string, required): REST API endpoint path (e.g.,
/datamachine/v1/handlers) - method (string, optional): HTTP method (defaults to
GET) - data (object, optional): Request body data for
POST,PUT, orPATCH
Batch requests
- requests (array): Array of requests:
{ endpoint, method, data?, key? }. Ifkeyis omitted, a key is derived from the endpoint path.
Available Endpoints
Discovery
GET /datamachine/v1/handlers– List all handlersGET /datamachine/v1/handlers?step_type={fetch|publish|update}– Filter by typeGET /datamachine/v1/handlers/{slug}– Handler details and config schemaGET /datamachine/v1/auth/{handler}/status– Check OAuth connection statusGET /datamachine/v1/providers– List AI providers and modelsGET /datamachine/v1/tools– List available AI tools
Pipelines (Read-Only)
GET /datamachine/v1/pipelines– List all pipelinesGET /datamachine/v1/pipelines/{id}– Get pipeline details with steps and flows
Flows (Read-Only)
GET /datamachine/v1/flows– List all flowsGET /datamachine/v1/flows/{id}– Get flow detailsGET /datamachine/v1/flows/problems– List flows flagged for review due to consecutive failures/no items
Jobs & Monitoring
GET /datamachine/v1/jobs– List all jobsGET /datamachine/v1/jobs?flow_id={id}– Jobs for specific flowGET /datamachine/v1/jobs?status={pending|processing|completed|failed|completed_no_items|agent_skipped}– Filter by status.GET /datamachine/v1/jobs/{id}– Job details
Logs
GET /datamachine/v1/logs/content– Get log contentGET /datamachine/v1/logs/content?job_id={id}– Logs for specific jobDELETE /datamachine/v1/logs– Clear logsPUT /datamachine/v1/logs/level– Set log level
System
GET /datamachine/v1/settings– Get plugin settingsPATCH /datamachine/v1/settings– Update settings (partial)
Files
GET /datamachine/v1/files– List uploaded filesPOST /datamachine/v1/files– Upload fileDELETE /datamachine/v1/files/{filename}– Delete file
Usage Examples
List All Handlers
{
"endpoint": "/datamachine/v1/handlers",
"method": "GET"
}
Check OAuth Status
{
"endpoint": "/datamachine/v1/auth/twitter/status",
"method": "GET"
}
Get Pipeline Details
{
"endpoint": "/datamachine/v1/pipelines/123",
"method": "GET"
}
Monitor Job Status
{
"endpoint": "/datamachine/v1/jobs/456",
"method": "GET"
}
Response Format
Single request response
{
"success": true,
"data": { /* response body */ },
"status": 200,
"tool_name": "api_query"
}
Batch request response
{
"success": true,
"batch": true,
"data": {
"handlers": { /* ... */ },
"pipelines": { /* ... */ }
},
"errors": {
"jobs": "Missing endpoint"
},
"partial": true,
"request_count": 3,
"success_count": 2,
"error_count": 1,
"tool_name": "api_query"
}
Error Handling
Returns structured error responses for:
- Invalid endpoints or methods
- Authentication/authorization failures
- Malformed request data
- Server-side processing errors
Integration
This tool complements specialized workflow tools by providing comprehensive API access for:
- System monitoring and diagnostics
- Configuration verification
- Troubleshooting workflow issues
- Administrative operations
Use specialized Focused Tools like create_pipeline, delete_flow, add_pipeline_step, and configure_flow_step for mutation operations. api_query is strictly read-only for discovery and monitoring.