getCollections
Retrieve all Postman collections within a specified workspace. Provide the workspace ID to get the list.
Instructions
Gets all collections in a workspace. Workspace ID is required - ask user if not provided.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace's ID (required) | |
| limit | No | Maximum number of rows to return | |
| name | No | Filter by collections matching this name | |
| offset | No | Zero-based offset for pagination |
Implementation Reference
- tools/postman_tools.py:212-222 (handler)The async run_tool method that executes the getCollections logic. Makes a GET /collections call to the Postman API with workspace (required), limit, name, and offset query parameters.
async def run_tool(self, args: dict) -> list[TextContent]: params = {"workspace": args["workspace"]} if args.get("limit"): params["limit"] = args["limit"] if args.get("name"): params["name"] = args["name"] if args.get("offset"): params["offset"] = args["offset"] result = await postman_api_call("GET", "/collections", params=params) return [TextContent(type="text", text=json.dumps(result, indent=2))] - tools/postman_tools.py:184-210 (schema)The get_tool_description method defining the input schema for getCollections. Requires workspace (string), with optional limit (integer), name (string), and offset (integer) parameters.
def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Gets all collections in a workspace. Workspace ID is required - ask user if not provided.", inputSchema={ "type": "object", "properties": { "workspace": { "type": "string", "description": "The workspace's ID (required)" }, "limit": { "type": "integer", "description": "Maximum number of rows to return" }, "name": { "type": "string", "description": "Filter by collections matching this name" }, "offset": { "type": "integer", "description": "Zero-based offset for pagination" } }, "required": ["workspace"] }, ) - tools/postman_tools.py:1841-1841 (registration)Registration of GetCollectionsTool() in the register_all_tools() function, which returns it as part of the list of all tool handlers.
GetCollectionsTool(), - tools/postman_tools.py:178-182 (helper)The GetCollectionsTool class definition and __init__ method, which extends ToolHandler and registers with the name 'getCollections'.
class GetCollectionsTool(ToolHandler): """Get all collections in a workspace""" def __init__(self): super().__init__("getCollections")