Skip to main content

call_tool

Function call_tool 

Source
pub async fn call_tool(
    proxy_url: &str,
    tool_name: &str,
    args: &HashMap<String, Value>,
    raw_args: Option<&[String]>,
    token_env: Option<&str>,
) -> Result<Value, ProxyError>
Expand description

Execute a tool call via the proxy server.

POST {proxy_url}/call with JSON body: { tool_name, args } Scopes are carried inside the JWT — not in the request body.

args carries key-value pairs for HTTP/MCP tools. raw_args, if provided, is sent as an array in the args field for CLI tools.

token_env selects which sandbox env var holds the bearer to send. None uses the default ATI_SESSION_TOKEN (back-compat with every caller before issue #121); Some("PARCHA_TOOLS_SESSION_TOKEN") reads that env var instead, falling back to the default if it’s unset. The caller normally derives this from the target provider’s auth_session_token_env field in the manifest.