Skip to main content
Glama

getEnvironments

Retrieve all Postman environments, with optional filtering by workspace ID.

Instructions

Gets all environments. Optionally filter by workspace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceNoWorkspace ID (optional)

Implementation Reference

  • The GetEnvironmentsTool class implements the 'getEnvironments' tool handler. It extends ToolHandler, registers with name 'getEnvironments' in __init__, defines the input schema (with optional workspace filter) in get_tool_description, and executes the logic in run_tool by making a GET request to /environments with optional workspace query parameter.
    class GetEnvironmentsTool(ToolHandler):
        """Get all environments"""
        
        def __init__(self):
            super().__init__("getEnvironments")
        
        def get_tool_description(self) -> Tool:
            return Tool(
                name=self.name,
                description="Gets all environments. Optionally filter by workspace.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "workspace": {
                            "type": "string",
                            "description": "Workspace ID (optional)"
                        }
                    },
                },
            )
        
        async def run_tool(self, args: dict) -> list[TextContent]:
            params = {}
            if args.get("workspace"):
                params["workspace"] = args["workspace"]
            
            result = await postman_api_call("GET", "/environments", params=params)
            return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Input schema for getEnvironments: defines an optional 'workspace' property (type string, description 'Workspace ID (optional)'). No required fields.
    def get_tool_description(self) -> Tool:
        return Tool(
            name=self.name,
            description="Gets all environments. Optionally filter by workspace.",
            inputSchema={
                "type": "object",
                "properties": {
                    "workspace": {
                        "type": "string",
                        "description": "Workspace ID (optional)"
                    }
                },
            },
        )
  • The GetEnvironmentsTool() is registered in register_all_tools() on line 1854 within the environments section, creating an instance that gets returned in the list of all tool handlers.
    "environments": 4,
  • ToolHandler is the abstract base class that GetEnvironmentsTool extends. It provides the __init__ (setting self.name), get_tool_description abstract method, and run_tool abstract method used by all tool implementations.
    """
    Abstract base class for Postman MCP tool handlers
    """
    from abc import ABC, abstractmethod
    from typing import Any
    from mcp.types import Tool, TextContent, ImageContent, EmbeddedResource
    
    
    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
Behavior2/5

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

Without annotations, the description must fully disclose behaviors. It indicates a read operation but does not mention return format, pagination, or potential error states. This is minimal transparency.

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?

Extremely concise: two short sentences with no redundant information. Every word serves a purpose.

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?

For a simple retrieval tool with one optional parameter, the description is adequate but not fully complete. It omits any mention of return type or scope, which would be helpful given no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single parameter. The description restates the filter functionality without adding new semantic meaning beyond the schema.

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 clearly states the verb 'Gets' and the resource 'environments', with an optional filter by workspace. It distinguishes itself from sibling 'getEnvironment' which retrieves a single environment.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'getEnvironment' or 'getWorkspaces'. The description does not specify any prerequisites or 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