Skip to main content
Server path: /gateway | Type: Embedded | PCID required: No

Tools


agent_invoke

Invoke an agent and get its response. MODES:
  • Default (synchronous): waits for the agent and returns its response. Best for short tasks. If a run exceeds ~50s it does not block or error — it returns an operationId to poll with agent_status, exactly as fire-and-return does.
  • Fire-and-return (pass async: true): returns an operationId immediately without waiting. Then poll agent_status with that operationId (~5-10s interval) until status is COMPLETE (result included) or FAILED. Use this for long-running agents so you are not blocked waiting.
Parameters:

agent_status

Get the status (and, when COMPLETE, the response) of an agent run. Pass the operationId returned by a fire-and-return agent_invoke. Returns RUNNING while in progress; COMPLETE with the agent response; or FAILED with the error. Parameters:

capabilities_discover

Discover available capabilities for a task. Returns lightweight recommendations for tools, agent skills, connections, and/or resources — and, opt-in, invocable workflows and agents. Call capability_details to get full details for selected items. Use the “types” parameter to filter by capability type. GATEWAY USAGE:
  • To find available connections and their PCIDs: call with types: [“connection”] and a request describing the service (e.g., “gmail connections”).
  • To find available tools: call with types: [“tool”] and a request describing what you want to do.
  • To discover invocable workflows/agents (OPT-IN — off by default): call with types: [“workflow”, “agent”]. Each result carries its invoke handle (automationId / agentId); invoke them via workflow_invoke / agent_invoke.
  • Returns IDs inline for every recommended item (PCIDs for connections, collectionIds for resources) — you do NOT need to call gateway_list_workspace afterward to get IDs.
  • If the response includes alternativesAvailable (e.g., {"gmail": 2}), the user has multiple connections for that service and only one was picked. Call gateway_list_workspace to see all options when the user needs to choose.
Parameters:

capability_details

Get the full details of capabilities returned by capabilities_discover — pass the exact names/ids from that response. For a tool: its complete input and output JSON Schema. For a workflow: its input schema (read this before workflow_invoke). For an agent: its description and output contract (read this before agent_invoke). For a connection or resource: its metadata. Use the “types” parameter to filter which kinds you want details for. Parameters:

code-execution_execute

Execute JavaScript code in a sandboxed VM with access to MCP tools and file helpers. Available globals:
  • callTool(serverPath, toolName, toolArgs) — Call a configured MCP tool via HTTP. DO NOT pass PCID — connection is auto-injected from selection context.
  • codeExec.createArtifact(filename, content, fileType) — Create a file (uploads to platform, returns { success, id, url, filename, mimeType, size }). Supported types: csv, txt, json, html, xml, js, ts, md, py. This is a simplified file helper — for full artifact features, use gateway_write_artifact.
  • codeExec.readArtifact(identifier) — Read a file by ID, filename, or URL (returns { success, content, size, filename, mimeType }). This is a simplified reader — for advanced features (search, pagination, smartGrepQuery), use gateway_read_artifact after code execution returns.
  • console.log/error/warn(…args) — Captured to logs array returned in the response.
  • setTimeout/setInterval/clearTimeout/clearInterval — Standard timer functions (cleaned up after execution).
EXAMPLES: // Call MCP tools (DO NOT pass PCID - connection is auto-injected from selection context): const emails = await callTool(“gmail”, “gmail_search_emails”, { query: “is:unread” }); // Create output files: const csv = emails.map(e => ${e.from},${e.subject}).join(‘\n’); await codeExec.createArtifact(‘emails.csv’, csv, ‘csv’); // Read an artifact from the conversation: const data = await codeExec.readArtifact(‘file_abc123’); console.log(data.content); // Return result to agent: return { count: emails.length }; LARGE RESULTS: If the returned value serializes to >200 bytes, an artifact is created automatically and the response includes an artifactId with a truncated preview. The agent can use read_artifact to access the full result. IMPORTANT — NO UNBOUNDED LOOPS:
  • NEVER write while(true), while(hasMore), or open-ended loops that call callTool() repeatedly. Each callTool() is an HTTP round-trip and loops will timeout.
  • If a tool doesn’t have a pagination parameter (e.g. “page”), do NOT attempt manual pagination — you will get the same page repeatedly.
  • If you need more data than one API call returns, return what you have and tell the user the tool’s page limit was reached.
  • Bounded loops (e.g. for(let i=0; i<items.length; i++)) over local data are fine.
  • Be suspicious of round numbers (30, 50, 100) — they usually mean you hit a perPage limit, not the actual total.
Default timeout: 10 minutes (max 15 minutes). GATEWAY CONNECTION HANDLING: Connections are auto-injected for all callTool() calls inside the sandbox — do NOT put PCIDs in the code.
  • If the user has one connection per service, it is used automatically.
  • If the user has multiple connections for the same service, use the connectionSelections parameter to specify which one: {“gmail”: “<pcid>”}. Obtain PCIDs via capabilities_discover with types: [“connection”].
  • callTool(server, tool, args) uses the same server identifiers as gateway_invoke (from capability_details), e.g. “gmail”, “dynamic/<id>”, “remote/<id>”.
  • When connectionSelections is omitted, the first connection per service is used as default.
Parameters:

gateway_invoke

Invoke a single MCP tool on a registered server. Good for simple, one-shot tool calls. NOTE: Results are returned in full (not truncated). This is fine for most calls, but if a tool is likely to return a large amount of data (e.g., searching hundreds of emails, bulk exports, large query results), prefer code-execution_execute instead — it automatically saves large results as artifacts. CONNECTION HANDLING:
  • Connections are auto-injected. If the user has one connection for a service (e.g., one Gmail account), it is used automatically — do NOT pass PCID.
  • If the user has MULTIPLE connections for the same service, pass a PCID (Pinkfish Connection ID) to select which one. Discover available connections and their PCIDs via capabilities_discover with types: [“connection”].
  • Do NOT pass PCID in the “arguments” object — use the top-level PCID parameter instead.
For complex multi-step operations, data processing, file creation, or tool calls expected to return large results, use code-execution_execute instead. Parameters:

gateway_list_artifacts

List the files in a storage container. Returns each file’s name, id, size, MIME type and creation date — use this to find a file’s id before gateway_read_artifact. Parameters:

gateway_list_workspace

List everything in the user’s workspace: connections, resources (datastores, filestores, knowledge bases, vaults), and invocable workflows + agents. Returns every item with its ID (PCID for connections, collectionId for resources, automationId for workflows, agentId for agents) and name. Prefer capabilities_discover for task-relevant work — that tool returns IDs inline for recommended items and is more efficient. Use gateway_list_workspace only when:
  1. You need to enumerate everything independent of a task (e.g., “show me all my connections”)
  2. The user has multiple connections for the same service and you need to see all of them to disambiguate (e.g., “which Gmail should I use?”)
  3. capabilities_discover returned alternativesAvailable and you want to show alternatives to the user
Parameters: None

gateway_read_artifact

Read a stored artifact by file_id + chatId (both returned by gateway_write_artifact / gateway_list_artifacts). Pick at most ONE extraction mode — smartGrepQuery (natural-language), search (keyword), start_line/end_line (line range), or json_path (JSON) — or omit all for a raw read with offset/limit paging. (To read a workflow run’s output files instead, use workflow_results.) Parameters:

gateway_write_artifact

Store content you already have as a downloadable file (CSV, JSON, TXT, MD, HTML, JS, TS, PY). (To store a file from a URL instead, use gateway_write_artifact_from_url.) Returns the file id and the chatId storage container it was placed in — reuse that chatId with gateway_list_artifacts / gateway_read_artifact. Parameters:

gateway_write_artifact_from_url

Fetch a file from a URL (server-side) and store it as a downloadable artifact. Use this when you have a link (e.g. a OneDrive/Google Drive download URL); to store content you already have, use gateway_write_artifact. Returns the file id and the chatId storage container it was placed in. Parameters:

workflow_invoke

Invoke a workflow by its automation ID and return its results. Runs the workflow’s latest published release under your identity — you can only invoke workflows you already have access to. Use the automationId returned by capabilities_discover (call it with types: [“workflow”] to discover invocable workflows). MODES:
  • Default (synchronous): waits for the run and returns its result. Best for short workflows. If a run exceeds ~50s it does not block or error — it returns an operationId to poll with workflow_status, exactly as fire-and-return does.
  • Fire-and-return (pass async: true): returns an operationId immediately without waiting. Then poll workflow_status with that operationId (~5-10s interval) until status is COMPLETE (result included) or FAILED. Use this for long-running workflows so you are not blocked waiting on the run.
RESULTS & OUTPUT FILES:
  • When the workflow’s API trigger(s) declare a designated output, the result includes a designatedOutputs array — one entry per trigger: &#123;triggerName, stepIndex, fileName, mimeType, size, content?&#125; — with content inlined for text under the size cap.
  • The result also includes an outputFiles array of the run’s output files: &#123;name, size, mimeType&#125;. To read one that was not inlined (binary, large, or non-designated), call workflow_results with this automationId + the returned runId + the file name.
Parameters:

workflow_results

Read a workflow run’s OUTPUT FILES by automationId + runId. You usually do NOT need this: a completed workflow_invoke / workflow_status already returns small outputs inline (designatedOutputs) and lists every file in outputFiles. Use this only to fetch a file that was not inlined — large, binary, or non-designated. runId is REQUIRED (pass the one workflow_invoke / workflow_status returned). Operations: “list” (enumerate files), “read” (contents — pass stepIndex to disambiguate a filename reused across steps), “getUrl” (a short-lived download URL), “search” (grep within a file). Parameters:

workflow_status

Get the status (and, when COMPLETE, the result) of a workflow run. Pass EITHER the operationId returned by a fire-and-return workflow_invoke, OR a runId together with its automationId. Returns RUNNING while in progress; on COMPLETE returns the run result (summary + designatedOutputs + outputFiles listing, same shape as a synchronous workflow_invoke); on FAILED returns the error. Read any listed output file with workflow_results. Parameters: