Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
specIdYesSpec ID
nameYesGenerated collection name
elementTypeYesCollection element type
optionsNoAdvanced creation options (see OpenAPI to Postman Converter docs)

Implementation Reference

  • 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))]
  • 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"]
            },
        )
  • Registration of GenerateCollectionTool() in the register_all_tools() function (line 1876).
    GenerateCollectionTool(),
  • 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
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the asynchronous nature via 'Returns polling link', which is beyond basic mutation. However, it omits auth needs or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the action, no wasted words. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given siblings and a nested options parameter, the description covers the polling link but lacks differentiation from siblings and explanation of the options parameter. Adequate but not comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds no extra meaning beyond the schema; it contextualizes the purpose but doesn't enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Creates a collection from an API spec') and distinguishes from siblings like createCollection by specifying the source. It also adds a key behavioral trait: returns a polling link.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for generating from an API spec, which differentiates from createCollection, but lacks explicit when-to-use or alternatives. No exclusions are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Sourav4670/postman-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server