updateMock
Updates a mock server's name, environment, privacy, or default response using its ID.
Instructions
Updates a mock server (name, environment, privacy, default response).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mockId | Yes | Mock server ID | |
| mock | No | Mock server updates |
Implementation Reference
- tools/postman_tools.py:848-879 (handler)The UpdateMockTool class - the handler that executes the 'updateMock' tool logic. It extends ToolHandler, calls the Postman API PUT /mocks/{mockId} to update a mock server's name, environment, privacy, default response, etc.
class UpdateMockTool(ToolHandler): """Update mock server""" def __init__(self): super().__init__("updateMock") def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Updates a mock server (name, environment, privacy, default response).", inputSchema={ "type": "object", "properties": { "mockId": { "type": "string", "description": "Mock server ID" }, "mock": { "type": "object", "description": "Mock server updates" } }, "required": ["mockId"] }, ) async def run_tool(self, args: dict) -> list[TextContent]: mock_id = args["mockId"] body = {"mock": args.get("mock", {})} result = await postman_api_call("PUT", f"/mocks/{mock_id}", body=body) return [TextContent(type="text", text=json.dumps(result, indent=2))] - tools/postman_tools.py:854-872 (schema)Input schema definition for the updateMock tool, defining input properties: mockId (string, required) and mock (object, optional) for mock server updates.
def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Updates a mock server (name, environment, privacy, default response).", inputSchema={ "type": "object", "properties": { "mockId": { "type": "string", "description": "Mock server ID" }, "mock": { "type": "object", "description": "Mock server updates" } }, "required": ["mockId"] }, ) - tools/postman_tools.py:1861-1862 (registration)Registration of UpdateMockTool() in the register_all_tools() function. This is where the tool is instantiated and included in the list of all 41 registered tools.
UpdateMockTool(), PublishMockTool(), - tools/toolhandler.py:9-24 (helper)The ToolHandler abstract base class that UpdateMockTool inherits from, providing the abstract interface (get_tool_description, run_tool) for all tool handlers.
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