API Request
api_request is the HTTP tool for interface calls. Unlike web_fetch, it doesn't emphasize text extraction but rather "API-style requests with structured results".
Required fields
| Parameter | Description |
|---|---|
base_url | API root URL, e.g. http://api.internal:8080 |
method | GET, POST, PUT, PATCH, DELETE |
path | relative API path, e.g. /v1/users |
Optional fields
queryheadersbodytimeout
When body is an object or array, the implementation automatically converts to JSON and adds Content-Type: application/json.
Return shape
Results are unified into:
{
"ok": true,
"status": 200,
"result": {},
"error": null
}
When failed, ok=false with HTTP status or exception info.
Config
tools:
api_request:
enabled: true
timeout: 20
max_bytes: 200000
follow_redirects: true
user_agent: "MushroomAgent api_request/1.0"
Use it for
- internal services
- structured REST APIs
- interfaces requiring custom headers, body, or query params
- business API calls more structured than
web_fetch
Example
{
"tool": "api_request",
"base_url": "http://api.internal:8080",
"method": "POST",
"path": "/v1/jobs",
"body": { "name": "sync" }
}