pydo.gateway_tools.run()

Generated on 13 Nov 2026 from pydo version v0.46.0

Usage

client.gateway_tools.run(
    x_session_id=None,
    x_endpoint_id=None,
    x_actor_id=None,
    body={
        "rationale": "Find current information about DigitalOcean.",
        "tools": [...],
    },
)
Returns JSON Raises HttpResponseError

Description

Runs 1 to 10 tool calls in parallel and returns one result per call, in request order. This is the REST form of the action_invoke MCP tool.

Each call is checked against the session’s tool selection and policy, uses the session actor’s connections, and applies any output view bound to the tool in the session. A well-formed request returns 200 even when some calls fail. Check each item’s result.status, and use success_count and error_count to branch without scanning every item.

A call whose policy requires approval fails with _meta.status set to requires_approval. Have the session’s owner approve it, then repeat the call with the same arguments. A call that needs the end user to connect a provider fails with _meta.status set to requires_authorization or requires_connection_configuration.

Tools opted into result caching use the session’s settings automatically. Set cache on an individual tools entry to bypass caching or require a fresher result. The result’s _meta.cache reports cache hits. Hits still incur the standard gateway invocation charge but no additional provider charge, because the provider is not called.

Parameters

x_session_id string optional

The session to act in: the UUID at the end of the session's sessionUrn and mcpUrl. For a pinned endpoint version, use the session UUID at the end of its mcp_url, not the composite version ID. The session must belong to the authenticated user and team. Send either this header or X-Endpoint-Id, not both; both returns 400. With neither, the request uses your default endpoint when default endpoints are enabled for your team, and otherwise returns 403.

x_endpoint_id string optional

The endpoint to act in, as a lowercase endpoint UUID. The request uses the endpoint's current head version, which the response reports in X-Action-Gateway-Endpoint-Version. The endpoint must belong to the authenticated user and team; an unknown or inaccessible endpoint returns 404. Send either this header or X-Session-Id, not both. A malformed value or more than one value returns 400.

x_actor_id string optional

The actor you expect the session or endpoint to be bound to. It does not select an actor or connections; those come from the session's or endpoint's actor_id. When sent, it must equal that binding. A different value, including any value for a target with no actor, returns 403 with the message "The session is not bound to the request's actor."

rationale string optional

Example: Find current information about DigitalOcean.

One sentence explaining why the tools are being called. Values longer than 512 characters are truncated.

tools array of objects required

The tool calls to run in parallel.

Show child properties
cache object optional

Optional per-call caching controls. Send beside arguments, not inside them. Accepted only for tools opted into caching in this session; tool search advertises these tools with a cache field. Omitting controls uses the session's settings. Direct MCP tools/call requests use session settings without overrides; use action_invoke for per-call controls.

Show child properties
mode string optional

auto uses a sufficiently recent cached result or calls the provider and can store a successful result. bypass skips lookup and storage without clearing or refreshing existing entries.

One of: auto, bypass

Default: auto

max_age_seconds integer optional

Example: 30

Oldest cached result this call accepts, in seconds. Zero bypasses caching. Values above 300 are clamped to 300; larger values cannot increase the session or tool lifetime. This controls accepted result age, not the lifetime of a newly stored entry.

Min: 0

tool string required

Example: exa_web_search

The tool name, as returned by GET /tools or POST /tools/search. Names are case-insensitive.

version string optional

Example: 1

An immutable tool version. Omit to use the released version.

arguments object optional

Example: {'query': 'DigitalOcean cloud computing', 'max_results': 1}

The tool's arguments, matching its inputSchema.

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "rationale": "Find current information about DigitalOcean.",
  "tools": [
    {
      "tool": "exa_web_search",
      "arguments": {
        "query": "DigitalOcean cloud computing",
        "max_results": 1
      }
    }
  ]
}

resp = client.gateway_tools.run(body=req)

Response Example

Show Response Example
{
  "total_count": 1,
  "success_count": 1,
  "error_count": 0,
  "results": [
    {
      "index": 0,
      "tool": "exa_web_search",
      "version": "1",
      "result": {
        "status": "succeeded",
        "output": {
          "provider": "exa",
          "results": [
            {
              "title": "DigitalOcean | Cloud Infrastructure for Developers",
              "url": "https://www.digitalocean.com/"
            }
          ]
        },
        "call_id": "call_8b7c6d5e-4f3a-4b2c-9d1e-0f9a8b7c6d5e"
      }
    }
  ]
}

More Information

See /tools/invoke in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.