Skip to main content

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_fetch for fetching web pages or HTTP response content
  • use web_search for 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

NeedUse
Fetch a URL and return contentweb_fetch
Search the webweb_search
Call MushroomAgent from another serviceHTTP /v1/chat, WebSocket chat/realtime, or Func communication
Run local integration scriptsexec 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

ParameterDescription
base_urlAPI root URL, e.g. http://api.internal:8080
methodGET, POST, PUT, PATCH, DELETE
pathrelative API path, e.g. /v1/users

Optional fields

  • query
  • headers
  • body
  • timeout

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" }
}