getSpec
Retrieves details of an API specification using its spec ID. Provides information about the specification stored in Postman.
Instructions
Gets information about an API specification.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| specId | Yes | Spec ID |
Implementation Reference
- tools/postman_tools.py:960-985 (handler)The GetSpecTool class implements the 'getSpec' tool. It extends ToolHandler, initializes with name 'getSpec', defines the input schema (requiring a 'specId' string), and the run_tool method which calls the Postman API GET /apis/{spec_id} to retrieve API specification information.
class GetSpecTool(ToolHandler): """Get API specification""" def __init__(self): super().__init__("getSpec") def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Gets information about an API specification.", inputSchema={ "type": "object", "properties": { "specId": { "type": "string", "description": "Spec ID" } }, "required": ["specId"] }, ) async def run_tool(self, args: dict) -> list[TextContent]: spec_id = args["specId"] result = await postman_api_call("GET", f"/apis/{spec_id}") return [TextContent(type="text", text=json.dumps(result, indent=2))] - tools/postman_tools.py:966-980 (schema)Input schema for 'getSpec' tool defines a required 'specId' string property. The tool gets information about an API specification.
def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Gets information about an API specification.", inputSchema={ "type": "object", "properties": { "specId": { "type": "string", "description": "Spec ID" } }, "required": ["specId"] }, ) - tools/postman_tools.py:1866-1866 (registration)The 'getSpec' tool is registered in the register_all_tools() function as GetSpecTool() on line 1866.
GetSpecTool(), - tools/toolhandler.py:9-23 (helper)ToolHandler is the abstract base class that GetSpecTool extends. It provides the abstract interface with get_tool_description() and run_tool() 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