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": [...],
},
)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_idstring optionalThe session to act in: the UUID at the end of the session's
sessionUrnandmcpUrl. For a pinned endpoint version, use the session UUID at the end of itsmcp_url, not the composite version ID. The session must belong to the authenticated user and team. Send either this header orX-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_idstring optionalThe 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 orX-Session-Id, not both. A malformed value or more than one value returns 400.x_actor_idstring optionalThe 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."rationalestring optionalExample:
Find current information about DigitalOcean.One sentence explaining why the tools are being called. Values longer than 512 characters are truncated.
toolsarray of objects requiredThe tool calls to run in parallel.
Show child properties
cacheobject optionalOptional 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
modestring optionalauto 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.
max_age_secondsinteger optionalExample:
30Oldest 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.
toolstring requiredExample:
exa_web_searchThe tool name, as returned by
GET /toolsorPOST /tools/search. Names are case-insensitive.versionstring optionalExample:
1An immutable tool version. Omit to use the released version.
argumentsobject optionalExample:
{'query': 'DigitalOcean cloud computing', 'max_results': 1}The tool's arguments, matching its
inputSchema.
Request Sample
Response Example
More Information
See /tools/invoke in the API reference for additional detail on responses, headers, parameters, and more.