getMocks
Retrieve all active mock servers by providing a workspace ID or team ID. Use workspace ID for preferred results.
Instructions
Gets all active mock servers. Always pass workspace or teamId. Prefer workspace when known. Set teamId from GET /me (me.teamId) for team scope.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| teamId | No | Team ID (from GET /me: me.teamId) | |
| workspace | No | Workspace ID (preferred) |
Implementation Reference
- tools/postman_tools.py:812-845 (handler)GetMocksTool class: the handler for the 'getMocks' tool. Registers with name 'getMocks'. Accepts optional 'teamId' and 'workspace' parameters. Calls GET /mocks on the Postman API with the provided params.
class GetMocksTool(ToolHandler): """Get all mock servers""" def __init__(self): super().__init__("getMocks") def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Gets all active mock servers. Always pass workspace or teamId. Prefer workspace when known. Set teamId from GET /me (me.teamId) for team scope.", inputSchema={ "type": "object", "properties": { "teamId": { "type": "string", "description": "Team ID (from GET /me: me.teamId)" }, "workspace": { "type": "string", "description": "Workspace ID (preferred)" } }, }, ) async def run_tool(self, args: dict) -> list[TextContent]: params = {} if args.get("workspace"): params["workspace"] = args["workspace"] elif args.get("teamId"): params["teamId"] = args["teamId"] result = await postman_api_call("GET", "/mocks", params=params) return [TextContent(type="text", text=json.dumps(result, indent=2))] - tools/postman_tools.py:812-835 (schema)Input schema for 'getMocks' tool: accepts optional 'teamId' (string) and 'workspace' (string) properties with descriptions about scope preference.
class GetMocksTool(ToolHandler): """Get all mock servers""" def __init__(self): super().__init__("getMocks") def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Gets all active mock servers. Always pass workspace or teamId. Prefer workspace when known. Set teamId from GET /me (me.teamId) for team scope.", inputSchema={ "type": "object", "properties": { "teamId": { "type": "string", "description": "Team ID (from GET /me: me.teamId)" }, "workspace": { "type": "string", "description": "Workspace ID (preferred)" } }, }, ) - tools/postman_tools.py:1857-1862 (registration)Registration of GetMocksTool() in the register_all_tools() function, which returns the list of all tool handler instances.
# Mocks CreateMockTool(), GetMockTool(), GetMocksTool(), UpdateMockTool(), PublishMockTool(), - tools/toolhandler.py:9-23 (helper)ToolHandler base class (ABC) that GetMocksTool extends. Defines the interface with get_tool_description() and run_tool() abstract methods.
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 - tests/test_postman.py:72-72 (registration)Test verification that 'getMocks' is among the expected tool names in the test suite.
"getMocks",