getAllSpecs
Retrieves all API specifications in a workspace, supporting cursor-based pagination to manage large result sets.
Instructions
Gets all API specifications in a workspace.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspaceId | Yes | The workspace's ID. | |
| cursor | No | The pointer to the first record of the set of paginated results. To view the next response, use the `nextCursor` value for this parameter. | |
| limit | No | The maximum number of rows to return in the response. |
Implementation Reference
- src/tools/getAllSpecs.ts:29-58 (handler)The handler function that executes the getAllSpecs tool logic. It makes a GET request to /specs endpoint with workspaceId, cursor, and limit query parameters.
export async function handler( args: z.infer<typeof parameters>, extra: { client: PostmanAPIClient; headers?: IsomorphicHeaders; serverContext?: ServerContext } ): Promise<CallToolResult> { try { const endpoint = `/specs`; const query = new URLSearchParams(); if (args.workspaceId !== undefined) query.set('workspaceId', String(args.workspaceId)); if (args.cursor !== undefined) query.set('cursor', String(args.cursor)); if (args.limit !== undefined) query.set('limit', String(args.limit)); const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint; const options: any = { headers: extra.headers, }; const result = await extra.client.get(url, options); return { content: [ { type: 'text', text: `${typeof result === 'string' ? result : JSON.stringify(result, null, 2)}`, }, ], }; } catch (e: unknown) { if (e instanceof McpError) { throw e; } throw asMcpError(e); } } - src/tools/getAllSpecs.ts:8-21 (schema)Zod schema defining input parameters for getAllSpecs: workspaceId (required string), cursor (optional string for pagination), limit (optional integer, default 10).
export const parameters = z.object({ workspaceId: z.string().describe("The workspace's ID."), cursor: z .string() .describe( 'The pointer to the first record of the set of paginated results. To view the next response, use the `nextCursor` value for this parameter.' ) .optional(), limit: z .number() .int() .describe('The maximum number of rows to return in the response.') .default(10), }); - src/enabledResources.ts:100-100 (registration)Registration of 'getAllSpecs' in the 'full' resources list (line 100) and 'minimal' resources list (line 172), determining which tool preset includes it.
'getAllSpecs', - src/index.ts:262-264 (registration)Dynamic tool registration loop that registers all loaded tools (including getAllSpecs) onto the McpServer using server.registerTool().
// Register all tools using the McpServer registerTool method for (const tool of tools) { server.registerTool(