generateCollection
Generates a Postman collection from an API specification and provides a polling link to track task completion.
Instructions
Creates a collection from an API spec. Returns polling link to task status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| specId | Yes | Spec ID | |
| name | Yes | Generated collection name | |
| elementType | Yes | Collection element type | |
| options | No | Advanced creation options (see OpenAPI to Postman Converter docs) |
Implementation Reference
- tools/postman_tools.py:1252-1295 (handler)GenerateCollectionTool class - the handler that executes the 'generateCollection' tool. Calls POST /apis/{spec_id}/collections to create a collection from an API spec.
class GenerateCollectionTool(ToolHandler): """Generate collection from spec""" def __init__(self): super().__init__("generateCollection") def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Creates a collection from an API spec. Returns polling link to task status.", inputSchema={ "type": "object", "properties": { "specId": { "type": "string", "description": "Spec ID" }, "name": { "type": "string", "description": "Generated collection name" }, "elementType": { "type": "string", "description": "Collection element type" }, "options": { "type": "object", "description": "Advanced creation options (see OpenAPI to Postman Converter docs)" } }, "required": ["specId", "name", "elementType"] }, ) async def run_tool(self, args: dict) -> list[TextContent]: spec_id = args["specId"] body = { "name": args["name"], "elementType": args["elementType"], "options": args.get("options", {}) } result = await postman_api_call("POST", f"/apis/{spec_id}/collections", body=body) return [TextContent(type="text", text=json.dumps(result, indent=2))] - tools/postman_tools.py:1258-1284 (schema)Input schema for generateCollection: requires specId, name, elementType; optional options object.
def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Creates a collection from an API spec. Returns polling link to task status.", inputSchema={ "type": "object", "properties": { "specId": { "type": "string", "description": "Spec ID" }, "name": { "type": "string", "description": "Generated collection name" }, "elementType": { "type": "string", "description": "Collection element type" }, "options": { "type": "object", "description": "Advanced creation options (see OpenAPI to Postman Converter docs)" } }, "required": ["specId", "name", "elementType"] }, ) - tools/postman_tools.py:1876-1876 (registration)Registration of GenerateCollectionTool() in the register_all_tools() function (line 1876).
GenerateCollectionTool(), - tools/toolhandler.py:9-23 (helper)ToolHandler abstract base class that GenerateCollectionTool extends.
class ToolHandler(ABC): """Base class for all Postman tool handlers""" def __init__(self, name: str): self.name = name @abstractmethod def get_tool_description(self) -> Tool: """Return the MCP Tool description for this handler""" pass @abstractmethod async def run_tool(self, arguments: dict) -> list[TextContent | ImageContent | EmbeddedResource]: """Execute the tool with the given arguments""" pass