RequestRocketRequestRocketDocs
ControlRequest transforms

Request transforms with an agent

Create a request transform from the Core MCP.

Create a request transform when an outbound request needs code after overrides and before the target call. You need the organisation clientId, the parent proxyId, and source that default-exports a function.

Call get_guide with guide_key: "transform-creation" before the first create. List and get return both request and response transforms. Filter on transformType request. List results omit the code.

Call order

  1. Call list_proxy_transforms with clientId and proxyId to inspect existing transforms.
  2. Call create_proxy_transform with clientId, proxyId, transformType, transformMode, transformActive, and code.
  3. Save the returned transform sKey as transformId.
  4. Call get_proxy_transform with all three ids to read the stored source.
  5. Call update_proxy_transform with the ids and only the fields to change. transformType cannot change.

For conditional transforms, pass effect and any predicate fields. Optional fields also include priority, notes, variables, and alerts.

Example

Ask the agent to call create_proxy_transform with:

{
  "clientId": "organisation-id",
  "proxyId": "proxy-id",
  "transformType": "request",
  "transformMode": "all",
  "transformActive": true,
  "code": "export default function transform(proxyContext, proxyRequest) { return { ...proxyRequest, headers: { ...proxyRequest.headers, \"x-request-path\": proxyContext.path } }; }"
}

A successful tool result has success: true. Its data.transforms[0].sKey is the new transformId.

The function receives (proxyContext, proxyRequest) and returns an object containing any changed method, relative url, headers, params, or data. Imports, require, fetch, and process are rejected.

Next

On this page