Skip to main content
Glama

createSpec

Upload API spec files to Postman's Spec Hub with support for OpenAPI, AsyncAPI, protobuf, and GraphQL. Specify workspace, name, and type to organize your specs.

Instructions

Creates an API spec in Postman's Spec Hub. Supports OpenAPI 2.0/3.0/3.1, AsyncAPI 2.0, protobuf 2/3, GraphQL. Max file size 10MB.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesList of spec files with path and content. Use '/' in path to create folders.
nameYesSpecification name
typeYesSpec type (openapi, asyncapi, proto, graphql)
workspaceIdYesWorkspace ID

Implementation Reference

  • The CreateSpecTool class that implements the 'createSpec' tool. It extends ToolHandler, registers with name 'createSpec', and on execution sends a POST request to /apis with files, name, type, and workspaceId.
    class CreateSpecTool(ToolHandler):
        """Create API specification"""
        
        def __init__(self):
            super().__init__("createSpec")
        
        def get_tool_description(self) -> Tool:
            return Tool(
                name=self.name,
                description="Creates an API spec in Postman's Spec Hub. Supports OpenAPI 2.0/3.0/3.1, AsyncAPI 2.0, protobuf 2/3, GraphQL. Max file size 10MB.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "files": {
                            "type": "array",
                            "description": "List of spec files with path and content. Use '/' in path to create folders."
                        },
                        "name": {
                            "type": "string",
                            "description": "Specification name"
                        },
                        "type": {
                            "type": "string",
                            "description": "Spec type (openapi, asyncapi, proto, graphql)"
                        },
                        "workspaceId": {
                            "type": "string",
                            "description": "Workspace ID"
                        }
                    },
                    "required": ["files", "name", "type", "workspaceId"]
                },
            )
        
        async def run_tool(self, args: dict) -> list[TextContent]:
            body = {
                "files": args["files"],
                "name": args["name"],
                "type": args["type"],
                "workspaceId": args["workspaceId"]
            }
            
            result = await postman_api_call("POST", "/apis", body=body)
            return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • The tool is registered in the register_all_tools() function as one of the Spec tools.
    CreateSpecTool(),
  • The abstract base class ToolHandler that CreateSpecTool inherits from, providing the contract 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
Behavior4/5

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

No annotations are provided, so the description must carry the behavioral burden. It discloses supported API specification formats (OpenAPI, AsyncAPI, etc.) and the maximum file size of 10MB, which are critical behavioral constraints not in the schema. However, it does not mention side effects, auth requirements, or expected responses.

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?

The description is a single sentence containing all key information: action, supported formats, and constraint. No filler or redundancy. It is front-loaded with the primary action and efficiently conveys the essential details.

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?

The tool is relatively complex (multiple formats, file handling, size limit) and lacks an output schema. The description covers input constraints well but omits return value details (e.g., does it return the created spec ID?). For a creation tool, this omission limits completeness.

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?

With 100% schema coverage, the baseline is 3. The description adds value beyond schema by clarifying the file path convention ('Use '/' in path to create folders') and implicitly linking the 'type' parameter to the listed formats. This extra guidance improves parameter understanding.

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?

The description begins with 'Creates an API spec in Postman's Spec Hub,' clearly stating the verb and resource. It also lists supported formats and a file size limit, further specifying the tool's function and distinguishing it from siblings like 'createSpecFile' or 'getSpec'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when creating a spec, but does not explicit when to use this tool over alternatives like 'createSpecFile'. Given the sibling tools include file-level creation, the absence of comparative guidance leaves the agent to infer usage from context.

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