Skip to main content
Glama

createCollection

Create a Postman collection using the v2.1.0 schema format, optionally specifying the target workspace.

Instructions

Creates a collection using the Postman Collection v2.1.0 schema format. If workspace is not specified, creates in the oldest personal workspace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceNoThe workspace's ID
collectionNoCollection object in Postman Collection v2.1.0 format

Implementation Reference

  • The run_tool method of CreateCollectionTool that executes the collection creation logic by making a POST request to /collections with optional workspace parameter.
    async def run_tool(self, args: dict) -> list[TextContent]:
        workspace = args.get("workspace")
        collection = args.get("collection", {})
        
        params = {"workspace": workspace} if workspace else {}
        body = {"collection": collection}
        
        result = await postman_api_call("POST", "/collections", body=body, params=params)
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • The get_tool_description method of CreateCollectionTool that defines the tool's input schema (workspace ID and collection object in v2.1.0 format).
    def get_tool_description(self) -> Tool:
        return Tool(
            name=self.name,
            description="Creates a collection using the Postman Collection v2.1.0 schema format. If workspace is not specified, creates in the oldest personal workspace.",
            inputSchema={
                "type": "object",
                "properties": {
                    "workspace": {
                        "type": "string",
                        "description": "The workspace's ID"
                    },
                    "collection": {
                        "type": "object",
                        "description": "Collection object in Postman Collection v2.1.0 format"
                    }
                },
            },
        )
  • Where CreateCollectionTool is instantiated and registered in the register_all_tools function.
    CreateCollectionTool(),
  • The CreateCollectionTool class definition and __init__ which sets the tool name to 'createCollection'.
    class CreateCollectionTool(ToolHandler):
        """Create a new collection"""
        
        def __init__(self):
            super().__init__("createCollection")
  • The postman_api_call helper function used by CreateCollectionTool.run_tool to make the actual HTTP request to the Postman API.
    async def postman_api_call(
        method: str,
        endpoint: str,
        body: dict | None = None,
        params: dict | None = None,
        headers: dict | None = None
    ) -> dict:
        """Make an API call to Postman API"""
        if not POSTMAN_API_KEY:
            raise RuntimeError("POSTMAN_API_KEY environment variable is not set")
        
        url = f"{POSTMAN_BASE_URL}{endpoint}"
        
        # Prepare headers
        request_headers = {
            "X-Api-Key": POSTMAN_API_KEY,
            "Content-Type": "application/json",
        }
        if headers:
            request_headers.update(headers)
        
        async with httpx.AsyncClient(timeout=30.0) as client:
            try:
                response = await client.request(
                    method=method,
                    url=url,
                    json=body,
                    params=params,
                    headers=request_headers
                )
                response.raise_for_status()
                
                if response.status_code == 204:
                    return {"success": True, "message": "Operation completed successfully"}
                
                return response.json() if response.content else {"success": True}
            
            except httpx.HTTPStatusError as e:
                error_detail = e.response.text
                try:
                    error_json = e.response.json()
                    error_detail = json.dumps(error_json, indent=2)
                except:
                    pass
                raise RuntimeError(f"Postman API error ({e.response.status_code}): {error_detail}")
            except Exception as e:
                raise RuntimeError(f"Request failed: {str(e)}")
Behavior3/5

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

No annotations provided, so description must cover behavior. Discloses schema format and default workspace behavior, but lacks details on permissions, idempotency, or error handling.

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?

Single sentence that is front-loaded with purpose. No wasted words, though some may consider it too brief.

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

Completeness3/5

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

Missing return value information (no output schema) and no mention of success/error responses. For a creation tool with a nested object parameter, more context would be useful.

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

Parameters4/5

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

Schema description coverage is 100%, but description adds key detail: workspace parameter defaults to oldest personal workspace. This goes beyond schema's 'The workspace's ID'.

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?

States specific verb 'Creates' and resource 'collection' using Postman v2.1.0 format, distinguishing from siblings like createCollectionRequest. Default workspace behavior adds clarity.

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

Usage Guidelines3/5

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

Implies usage for creating collections but provides no explicit guidance on when to use this vs other creation tools like createCollectionRequest. No exclusions or alternatives 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