get_collection_roles
Retrieves the roles assigned to a Postman collection by providing its collection ID.
Instructions
Get roles for a collection
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionId | Yes | The collection ID |
Implementation Reference
- src/tools/api/auth/index.ts:162-171 (handler)The actual handler function `getCollectionRoles` that executes the tool logic. It validates the collectionId parameter, then makes a GET request to `/collections/{collectionId}/roles` on the Postman API and returns the response data.
/** * Get roles for a collection */ async getCollectionRoles(collectionId: string): Promise<ToolCallResponse> { if (!collectionId) { throw new McpError(ErrorCode.InvalidParams, 'collectionId is required'); } const response = await this.client.get(`/collections/${collectionId}/roles`); return this.createResponse(response.data); } - src/tools/api/auth/index.ts:32-58 (handler)The `handleToolCall` dispatcher that routes 'get_collection_roles' tool calls to the `getCollectionRoles` method.
async handleToolCall(name: string, args: any): Promise<ToolCallResponse> { try { switch (name) { case 'list_collection_access_keys': return await this.listCollectionAccessKeys(args); case 'delete_collection_access_key': return await this.deleteCollectionAccessKey(args.keyId); case 'list_workspace_roles': return await this.listWorkspaceRoles(); case 'get_workspace_roles': return await this.getWorkspaceRoles(args); case 'update_workspace_roles': return await this.updateWorkspaceRoles(args); case 'get_collection_roles': return await this.getCollectionRoles(args.collectionId); case 'update_collection_roles': return await this.updateCollectionRoles(args); case 'get_authenticated_user': return await this.getAuthenticatedUser(); default: throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); } } catch (error) { // Let base class interceptor handle API errors throw error; } } - The tool definition (input schema) for 'get_collection_roles'. Defines the tool name, description, and that it requires a 'collectionId' string parameter.
{ name: 'get_collection_roles', description: 'Get roles for a collection', inputSchema: { type: 'object', required: ['collectionId'], properties: { collectionId: { type: 'string', description: 'The collection ID' } } } }, - src/types/auth.ts:32-40 (helper)The `CollectionRole` TypeScript interface describing the shape of collection role data returned by the API.
export interface CollectionRole { id: string; name: string; description?: string; type: 'user' | 'group' | 'team'; roleId: 'VIEWER' | 'EDITOR'; entityId: number; entityType: string; } - src/tools/api/auth/index.ts:22-24 (registration)The `getToolDefinitions()` method which returns `TOOL_DEFINITIONS` from the definitions file, registering all tools (including 'get_collection_roles') with the framework.
getToolDefinitions(): ToolDefinition[] { return TOOL_DEFINITIONS; }