Skip to main content
Glama

createCollectionRequest

Add a new HTTP request to a Postman collection or folder by specifying method, URL, headers, and body parameters.

Instructions

Creates a request in a collection. Recommended to pass 'name' property. See Postman Collection Format docs for full properties.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionIdYesThe collection's ID
folderIdNoFolder ID (optional, creates at collection level if omitted)
nameNoRequest name
methodNoHTTP method (GET, POST, etc.)
urlNoRequest URL
descriptionNoRequest description
authNoAuthentication information
headerDataNoRequest headers
queryParamsNoQuery parameters
dataModeNoRequest body data mode
dataNoForm data
rawModeDataNoRaw mode data
graphqlModeDataNoGraphQL mode data
dataOptionsNoData mode options
eventsNoScript events

Implementation Reference

  • The CreateCollectionRequestTool class defines the 'createCollectionRequest' tool. It extends ToolHandler and implements the run_tool method that makes a POST request to /collections/{collection_id}/requests to create a request within a collection.
    class CreateCollectionRequestTool(ToolHandler):
        """Create a request in a collection"""
        
        def __init__(self):
            super().__init__("createCollectionRequest")
        
        def get_tool_description(self) -> Tool:
            return Tool(
                name=self.name,
                description="Creates a request in a collection. Recommended to pass 'name' property. See Postman Collection Format docs for full properties.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "collectionId": {
                            "type": "string",
                            "description": "The collection's ID"
                        },
                        "folderId": {
                            "type": "string",
                            "description": "Folder ID (optional, creates at collection level if omitted)"
                        },
                        "name": {
                            "type": "string",
                            "description": "Request name"
                        },
                        "method": {
                            "type": "string",
                            "description": "HTTP method (GET, POST, etc.)"
                        },
                        "url": {
                            "type": "string",
                            "description": "Request URL"
                        },
                        "description": {
                            "type": "string",
                            "description": "Request description"
                        },
                        "auth": {
                            "type": "string",
                            "description": "Authentication information"
                        },
                        "headerData": {
                            "type": "array",
                            "description": "Request headers"
                        },
                        "queryParams": {
                            "type": "array",
                            "description": "Query parameters"
                        },
                        "dataMode": {
                            "type": "string",
                            "description": "Request body data mode"
                        },
                        "data": {
                            "type": "string",
                            "description": "Form data"
                        },
                        "rawModeData": {
                            "type": "string",
                            "description": "Raw mode data"
                        },
                        "graphqlModeData": {
                            "type": "string",
                            "description": "GraphQL mode data"
                        },
                        "dataOptions": {
                            "type": "string",
                            "description": "Data mode options"
                        },
                        "events": {
                            "type": "string",
                            "description": "Script events"
                        }
                    },
                    "required": ["collectionId"]
                },
            )
        
        async def run_tool(self, args: dict) -> list[TextContent]:
            collection_id = args.pop("collectionId")
            body = {k: v for k, v in args.items() if v is not None}
            
            result = await postman_api_call("POST", f"/collections/{collection_id}/requests", body=body)
            return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • The inputSchema within get_tool_description defines the expected parameters for the createCollectionRequest tool, including collectionId (required), folderId, name, method, url, description, auth, headerData, queryParams, dataMode, data, rawModeData, graphqlModeData, dataOptions, and events.
    def get_tool_description(self) -> Tool:
        return Tool(
            name=self.name,
            description="Creates a request in a collection. Recommended to pass 'name' property. See Postman Collection Format docs for full properties.",
            inputSchema={
                "type": "object",
                "properties": {
                    "collectionId": {
                        "type": "string",
                        "description": "The collection's ID"
                    },
                    "folderId": {
                        "type": "string",
                        "description": "Folder ID (optional, creates at collection level if omitted)"
                    },
                    "name": {
                        "type": "string",
                        "description": "Request name"
                    },
                    "method": {
                        "type": "string",
                        "description": "HTTP method (GET, POST, etc.)"
                    },
                    "url": {
                        "type": "string",
                        "description": "Request URL"
                    },
                    "description": {
                        "type": "string",
                        "description": "Request description"
                    },
                    "auth": {
                        "type": "string",
                        "description": "Authentication information"
                    },
                    "headerData": {
                        "type": "array",
                        "description": "Request headers"
                    },
                    "queryParams": {
                        "type": "array",
                        "description": "Query parameters"
                    },
                    "dataMode": {
                        "type": "string",
                        "description": "Request body data mode"
                    },
                    "data": {
                        "type": "string",
                        "description": "Form data"
                    },
                    "rawModeData": {
                        "type": "string",
                        "description": "Raw mode data"
                    },
                    "graphqlModeData": {
                        "type": "string",
                        "description": "GraphQL mode data"
                    },
                    "dataOptions": {
                        "type": "string",
                        "description": "Data mode options"
                    },
                    "events": {
                        "type": "string",
                        "description": "Script events"
                    }
                },
                "required": ["collectionId"]
            },
  • The register_all_tools() function registers CreateCollectionRequestTool() alongside all other tool handlers, making it available at index position for 'Requests/Responses'.
    def register_all_tools() -> list[ToolHandler]:
        """Register all Postman tool handlers"""
        return [
            # User Info
            GetAuthenticatedUserTool(),
            GetEnabledToolsTool(),
            
            # Collections
            CreateCollectionTool(),
            GetCollectionTool(),
            GetCollectionsTool(),
            PutCollectionTool(),
            DuplicateCollectionTool(),
            GetDuplicateCollectionTaskStatusTool(),
            
            # Requests/Responses
            CreateCollectionRequestTool(),
            UpdateCollectionRequestTool(),
            CreateCollectionResponseTool(),
  • Test file includes 'createCollectionRequest' in the expected tool names list, verifying the tool is properly registered.
    "createCollectionRequest",
  • The postman_api_call helper function is used by the handler to make HTTP requests 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)}")
Behavior2/5

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

No annotations provided, and the description lacks disclosure of behavioral traits such as side effects, error handling, or auth requirements. It only states the action.

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

Conciseness4/5

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

Two sentences, front-loaded with the main action. The second sentence adds a tip and reference to docs. Efficient but could incorporate more structure.

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

Completeness2/5

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

With 15 parameters, no output schema, and no annotations, the description is incomplete. It does not explain return values, behavior on failure, or how the request is added to the collection.

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 coverage is 100%, so baseline is 3. The description adds a recommendation for 'name' parameter, but no further semantic value beyond the schema.

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 request in a collection') and the resource, distinguishing it from siblings like createCollectionResponse.

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

Usage Guidelines2/5

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

No guidance on when to use vs alternatives (e.g., updateCollectionRequest) or when not to use. The recommendation to pass 'name' is minimal and not contextual.

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