Skip to main content
Glama

updateCollectionRequest

Update specific fields of a request in a Postman collection without changing its folder, using collection ID and request ID.

Instructions

Updates a request in a collection (PATCH-like: only updates provided fields). Cannot change folder. Use collection ID (not UID).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionIdYesCollection ID (not UID)
requestIdYesRequest ID
nameNoRequest name
methodNoHTTP method
urlNoRequest URL
descriptionNoRequest description
authNoAuthentication info
headerDataNoHeaders
queryParamsNoQuery parameters
dataModeNoBody data mode
dataNoForm data
rawModeDataNoRaw mode data
graphqlModeDataNoGraphQL mode data
dataOptionsNoData options
eventsNoScript events

Implementation Reference

  • The UpdateCollectionRequestTool class that implements the 'updateCollectionRequest' tool. The __init__ registers it with name 'updateCollectionRequest', get_tool_description defines the schema (collectionId, requestId, and optional fields like name, method, url, etc.), and run_tool implements the logic: pops collectionId and requestId from args, builds body from remaining non-None values, and calls PUT /collections/{collection_id}/requests/{request_id} via postman_api_call.
    class UpdateCollectionRequestTool(ToolHandler):
        """Update a request in a collection"""
        
        def __init__(self):
            super().__init__("updateCollectionRequest")
        
        def get_tool_description(self) -> Tool:
            return Tool(
                name=self.name,
                description="Updates a request in a collection (PATCH-like: only updates provided fields). Cannot change folder. Use collection ID (not UID).",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "collectionId": {
                            "type": "string",
                            "description": "Collection ID (not UID)"
                        },
                        "requestId": {
                            "type": "string",
                            "description": "Request ID"
                        },
                        "name": {
                            "type": "string",
                            "description": "Request name"
                        },
                        "method": {
                            "type": "string",
                            "description": "HTTP method"
                        },
                        "url": {
                            "type": "string",
                            "description": "Request URL"
                        },
                        "description": {
                            "type": "string",
                            "description": "Request description"
                        },
                        "auth": {
                            "type": "string",
                            "description": "Authentication info"
                        },
                        "headerData": {
                            "type": "array",
                            "description": "Headers"
                        },
                        "queryParams": {
                            "type": "array",
                            "description": "Query parameters"
                        },
                        "dataMode": {
                            "type": "string",
                            "description": "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 options"
                        },
                        "events": {
                            "type": "string",
                            "description": "Script events"
                        }
                    },
                    "required": ["collectionId", "requestId"]
                },
            )
        
        async def run_tool(self, args: dict) -> list[TextContent]:
            collection_id = args.pop("collectionId")
            request_id = args.pop("requestId")
            body = {k: v for k, v in args.items() if v is not None}
            
            result = await postman_api_call("PUT", f"/collections/{collection_id}/requests/{request_id}", body=body)
            return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Input schema for updateCollectionRequest tool, defined in get_tool_description. Specifies required fields (collectionId, requestId) and optional fields (name, method, url, description, auth, headerData, queryParams, dataMode, data, rawModeData, graphqlModeData, dataOptions, events).
    def get_tool_description(self) -> Tool:
        return Tool(
            name=self.name,
            description="Updates a request in a collection (PATCH-like: only updates provided fields). Cannot change folder. Use collection ID (not UID).",
            inputSchema={
                "type": "object",
                "properties": {
                    "collectionId": {
                        "type": "string",
                        "description": "Collection ID (not UID)"
                    },
                    "requestId": {
                        "type": "string",
                        "description": "Request ID"
                    },
                    "name": {
                        "type": "string",
                        "description": "Request name"
                    },
                    "method": {
                        "type": "string",
                        "description": "HTTP method"
                    },
                    "url": {
                        "type": "string",
                        "description": "Request URL"
                    },
                    "description": {
                        "type": "string",
                        "description": "Request description"
                    },
                    "auth": {
                        "type": "string",
                        "description": "Authentication info"
                    },
                    "headerData": {
                        "type": "array",
                        "description": "Headers"
                    },
                    "queryParams": {
                        "type": "array",
                        "description": "Query parameters"
                    },
                    "dataMode": {
                        "type": "string",
                        "description": "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 options"
                    },
                    "events": {
                        "type": "string",
                        "description": "Script events"
                    }
                },
                "required": ["collectionId", "requestId"]
            },
        )
  • Registration of UpdateCollectionRequestTool() in the register_all_tools() function, which returns a list of all tool handlers.
    CreateCollectionRequestTool(),
    UpdateCollectionRequestTool(),
    CreateCollectionResponseTool(),
  • The postman_api_call helper function used by run_tool to make the HTTP PUT request to the Postman API endpoint /collections/{collection_id}/requests/{request_id}.
    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)}")
  • Test assertion in test_tool_names that expects 'updateCollectionRequest' to be in the set of registered tool names.
    "updateCollectionRequest",
Behavior3/5

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

No annotations are provided, so the description carries full burden. It explains the partial update behavior and folder constraint, but omits details like authorization needs, response format, or side effects. Adequate but not comprehensive.

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, no redundant information. First sentence introduces purpose and behavior, second adds constraints. Front-loaded and efficient.

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?

Given 15 parameters and no output schema or annotations, the description is too brief. It lacks information about return values, error conditions, permissions, and parameter interactions. Does not fully compensate for missing structured metadata.

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 coverage is 100%, baseline is 3. Description adds value by clarifying the PATCH-like semantics (only provided fields updated) and emphasizing the use of collection ID over UID, going 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?

Description clearly states the tool updates a request in a collection with a PATCH-like behavior, and specifies a constraint (cannot change folder) and ID usage (collection ID not UID). This distinguishes it from createCollectionRequest and putCollection.

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?

Description implies partial updates (PATCH-like) and notes a limitation (cannot change folder), but does not explicitly compare with alternatives like putCollection or createCollectionRequest. The guidance is present but not exhaustive.

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