get_api_versions
Retrieve all versions of an API by providing its API ID, with optional pagination using cursor and limit.
Instructions
Get all versions of an API
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiId | Yes | API ID | |
| cursor | No | Pagination cursor | |
| limit | No | Maximum number of results |
Implementation Reference
- src/tools/api/apis/index.ts:228-239 (handler)The handler function that executes the 'get_api_versions' tool logic. It validates that apiId is provided, then makes a GET request to /apis/{apiId}/versions with optional pagination params (cursor, limit).
/** * Get all versions of an API * @param args Parameters including apiId (required) */ async getApiVersions(args: any): Promise<ToolCallResponse> { if (!args.apiId) { throw new McpError(ErrorCode.InvalidParams, 'apiId is required'); } const { apiId, ...params } = args; const response = await this.client.get(`/apis/${apiId}/versions`, { params }); return this.createResponse(response.data); } - The input schema definition for the 'get_api_versions' tool. Specifies required parameter 'apiId' (string) and optional parameters 'cursor' (string) and 'limit' (number).
{ name: 'get_api_versions', description: 'Get all versions of an API', inputSchema: { type: 'object', properties: { apiId: { type: 'string', description: 'API ID', }, cursor: { type: 'string', description: 'Pagination cursor', }, limit: { type: 'number', description: 'Maximum number of results', }, }, required: ['apiId'], }, }, - src/tools/api/apis/index.ts:59-60 (registration)The switch-case statement in handleToolCall that routes the tool name 'get_api_versions' to the getApiVersions handler method.
case 'get_api_versions': return await this.getApiVersions(args); - src/server.ts:122-127 (helper)Registration of ApiTools tool definitions (including 'get_api_versions') into the global tool definitions list in the PostmanAPIServer.
this.toolDefinitions = [ ...this.workspaceTools.getToolDefinitions(), ...this.environmentTools.getToolDefinitions(), ...this.collectionTools.getToolDefinitions(), ...this.userTools.getToolDefinitions(), ...this.apiTools.getToolDefinitions(),