MCP Tools

list_requests

Lists the requests and drafts in Relay, with the workspaces that hold them.

Overview

Call list_requests to find the ids other tools need: request ids for generate_code and get_scripts, collection and folder ids for set_scripts and export_collection, and workspace ids for imports. The result lists every request saved in a collection, with the path of folders that holds it, and every draft. It also lists every workspace, with its environments and where it's stored, and every collection, with its folders.

{
  "workspaceId": "7D1E6C2A-4F0B-4C55-9A57-3B8E2F1D9C40",
  "includeDrafts": false
}

Parameters

Prop

Type

Return Value

An object with three arrays, workspaces, collections and requests, and totalCount, the number of requests that matched.

{
  "workspaces": [
    {
      "id": "7D1E6C2A-4F0B-4C55-9A57-3B8E2F1D9C40",
      "name": "Orders API",
      "isCurrent": true,
      "environments": [
        { "id": "C3A9F0E2-1B7D-4E8A-8F21-6D5C0B9A7E13", "name": "Staging", "isActive": true }
      ],
      "activeEnvironment": "Staging",
      "location": "/Users/me/Developer/orders/relay",
      "readOnly": false
    }
  ],
  "collections": [
    {
      "id": "A1F3D5B7-0C2E-4A6B-8D9F-1E3C5A7B9D02",
      "name": "Orders",
      "workspaceId": "7D1E6C2A-4F0B-4C55-9A57-3B8E2F1D9C40",
      "folders": [
        { "id": "E6B4A2C0-8D1F-4B37-9E5A-3C7D9F1B5A28", "name": "Checkout", "path": ["Orders", "Checkout"] }
      ]
    }
  ],
  "requests": [
    {
      "id": "5B2C8E41-9D3A-4F67-B0E8-1A4C7D2F6E95",
      "name": "Create Order",
      "method": "POST",
      "kind": "http",
      "url": "{{baseUrl}}/orders",
      "workspaceId": "7D1E6C2A-4F0B-4C55-9A57-3B8E2F1D9C40",
      "workspaceName": "Orders API",
      "collectionId": "A1F3D5B7-0C2E-4A6B-8D9F-1E3C5A7B9D02",
      "path": ["Orders", "Checkout"],
      "folderId": "E6B4A2C0-8D1F-4B37-9E5A-3C7D9F1B5A28",
      "isDraft": false,
      "hasScripts": true
    },
    {
      "id": "0F8E2D4C-6B1A-4935-8C7E-2D4F6A8B0C13",
      "name": "api.example.com/health",
      "method": "GET",
      "kind": "http",
      "url": "https://api.example.com/health",
      "workspaceId": null,
      "workspaceName": null,
      "isDraft": true,
      "hasScripts": false
    }
  ]
}

Each workspace has these fields:

Prop

Type

Each collection has these fields:

Prop

Type

Each request has these fields:

Prop

Type

Discussion

Saved requests come first, workspace by workspace and in the order of the sidebar, followed by drafts. Without workspaceId, every draft is listed, including drafts that aren't tied to a workspace. With workspaceId, only drafts tied to that workspace are listed.

The workspaces array always lists every workspace, even when you pass workspaceId. The collections array follows workspaceId but not query or limit.

hasScripts reports only the request's own scripts. Call get_scripts to see the folder and collection scripts that also run.

The tool returns an error when no workspace has the workspaceId you pass. The message lists the workspaces that exist.

See Also

  • get_active_workspace: Returns the workspace of the Relay window you used last.
  • generate_code: Generates code that sends a request, using a code generator.
  • get_scripts: Reads the scripts of a request, folder or collection.