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
| Name | Required | Description | Default |
|---|---|---|---|
| collectionId | Yes | Collection ID (not UID) | |
| requestId | Yes | Request ID | |
| name | No | Request name | |
| method | No | HTTP method | |
| url | No | Request URL | |
| description | No | Request description | |
| auth | No | Authentication info | |
| headerData | No | Headers | |
| queryParams | No | Query parameters | |
| dataMode | No | Body data mode | |
| data | No | Form data | |
| rawModeData | No | Raw mode data | |
| graphqlModeData | No | GraphQL mode data | |
| dataOptions | No | Data options | |
| events | No | Script events |
Implementation Reference
- tools/postman_tools.py:425-509 (handler)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))] - tools/postman_tools.py:431-501 (schema)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"] }, ) - tools/postman_tools.py:1847-1849 (registration)Registration of UpdateCollectionRequestTool() in the register_all_tools() function, which returns a list of all tool handlers.
CreateCollectionRequestTool(), UpdateCollectionRequestTool(), CreateCollectionResponseTool(), - tools/postman_tools.py:21-67 (helper)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)}") - tests/test_postman.py:60-60 (registration)Test assertion in test_tool_names that expects 'updateCollectionRequest' to be in the set of registered tool names.
"updateCollectionRequest",