get_api_collection
Retrieve a specific API collection using its API ID and collection ID. Optionally specify a version ID for API viewers.
Instructions
Get a specific collection from an API
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiId | Yes | API ID | |
| collectionId | Yes | Collection ID | |
| versionId | No | Version ID (required for API viewers) |
Implementation Reference
- src/tools/api/apis/index.ts:180-187 (handler)The getApiCollection method that executes the 'get_api_collection' tool logic. It validates that apiId and collectionId are provided, then makes a GET request to /apis/{apiId}/collections/{collectionId} with optional query params.
async getApiCollection(args: any): Promise<ToolCallResponse> { if (!args.apiId || !args.collectionId) { throw new McpError(ErrorCode.InvalidParams, 'apiId and collectionId are required'); } const { apiId, collectionId, ...params } = args; const response = await this.client.get(`/apis/${apiId}/collections/${collectionId}`, { params }); return this.createResponse(response.data); } - Schema definition for the 'get_api_collection' tool. Defines inputSchema with properties: apiId (string, required), collectionId (string, required), and versionId (string, optional).
name: 'get_api_collection', description: 'Get a specific collection from an API', inputSchema: { type: 'object', properties: { apiId: { type: 'string', description: 'API ID', }, collectionId: { type: 'string', description: 'Collection ID', }, versionId: { type: 'string', description: 'Version ID (required for API viewers)', }, }, required: ['apiId', 'collectionId'], }, }, - src/tools/api/apis/index.ts:51-52 (registration)Case statement in the tool dispatch that routes 'get_api_collection' to the getApiCollection handler method.
case 'get_api_collection': return await this.getApiCollection(args); - src/tools/api/apis/index.ts:22-24 (registration)The getToolDefinitions method that returns TOOL_DEFINITIONS, which includes the definition for 'get_api_collection' from definitions.ts.
getToolDefinitions(): ToolDefinition[] { return TOOL_DEFINITIONS; } - src/tools/api/base.ts:16-30 (helper)BasePostmanTool base class that provides the shared HTTP client (AxiosInstance) used by ApiTools to make Postman API requests.
export class BasePostmanTool { /** * Protected HTTP client for making API requests * All derived classes should use this for Postman API calls */ protected readonly client: AxiosInstance; constructor( apiKey: string | null, options: PostmanToolOptions = {}, existingClient?: AxiosInstance ) { const baseURL = options.baseURL || 'https://api.getpostman.com'; if (existingClient) {