API Request
api_request is not registered by the current default builtin tool registry. This page is kept for compatibility with older documentation links while the HTTP tool surface is being consolidated.
For current builds:
- use
web_fetchfor fetching web pages or HTTP response content - use
web_searchfor web search - use MushroomAgent's service APIs (
http,websocket,func) when another application needs to call the agent - inspect your actual local tool set with
mushroom-agent tools list
Current alternatives
| Need | Use |
|---|---|
| Fetch a URL and return content | web_fetch |
| Search the web | web_search |
| Call MushroomAgent from another service | HTTP /v1/chat, WebSocket chat/realtime, or Func communication |
| Run local integration scripts | exec or process |
Historical shape
Older docs described an api_request tool with API-style fields. Do not assume these fields are available unless mushroom-agent tools list shows an api_request tool in your runtime.
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" }
}