Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

list_environments

Read-only

Retrieve all configured environments in a specified Octopus Deploy space to understand deployment targets and optionally filter results by partial name match.

Instructions

List environments in a space

This tool lists all environments in a given space. The space name is required. Use this tool as early as possible to understand which environments are configured. Optionally filter by partial name match using partialName parameter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYes
partialNameNo
skipNo
takeNo

Implementation Reference

  • The handler function that executes the list_environments tool. It connects to Octopus Deploy using configuration from environment variables, lists environments in the specified space with optional filters (partialName, skip, take), and returns paginated results as JSON in a text content block.
    async ({ spaceName, partialName, skip, take }) => {
      const configuration = getClientConfigurationFromEnvironment();
      const client = await Client.create(configuration);
      const environmentRepository = new EnvironmentRepository(client, spaceName);
    
      const environmentsResponse = await environmentRepository.list({ partialName, skip, take });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              totalResults: environmentsResponse.TotalResults,
              itemsPerPage: environmentsResponse.ItemsPerPage,
              numberOfPages: environmentsResponse.NumberOfPages,
              lastPageNumber: environmentsResponse.LastPageNumber,
              items: environmentsResponse.Items.map((environment: DeploymentEnvironment) => ({
                spaceId: environment.SpaceId,
                id: environment.Id,
                name: environment.Name,
                description: environment.Description,
                sortOrder: environment.SortOrder,
                useGuidedFailure: environment.UseGuidedFailure,
                allowDynamicInfrastructure: environment.AllowDynamicInfrastructure,
                extensionSettings: environment.ExtensionSettings,
              }))
            }),
          },
        ],
      };
    }
  • Input schema defined with Zod: requires spaceName (string), optional partialName (string for filtering), skip and take (numbers for pagination).
    {
      spaceName: z.string(),
      partialName: z.string().optional(),
      skip: z.number().optional(),
      take: z.number().optional()
    },
  • Self-registration of the list_environments tool into the TOOL_REGISTRY, marking it as core toolset and read-only. This is triggered by the import in src/tools/index.ts.
    registerToolDefinition({
      toolName: "list_environments",
      config: { toolset: "core", readOnly: true },
      registerFn: registerListEnvironmentsTool,
    });
  • The registerListEnvironmentsTool function called to register the tool on the MCP server, including name, description, schemas, and handler.
    export function registerListEnvironmentsTool(server: McpServer) {
      server.tool(
        "list_environments",
        `List environments in a space
      
      This tool lists all environments in a given space. The space name is required. Use this tool as early as possible to understand which environments are configured. Optionally filter by partial name match using partialName parameter.`,
        {
          spaceName: z.string(),
          partialName: z.string().optional(),
          skip: z.number().optional(),
          take: z.number().optional()
        },
        {
          title: "List all environments in an Octopus Deploy space",
          readOnlyHint: true,
        },
        async ({ spaceName, partialName, skip, take }) => {
          const configuration = getClientConfigurationFromEnvironment();
          const client = await Client.create(configuration);
          const environmentRepository = new EnvironmentRepository(client, spaceName);
    
          const environmentsResponse = await environmentRepository.list({ partialName, skip, take });
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  totalResults: environmentsResponse.TotalResults,
                  itemsPerPage: environmentsResponse.ItemsPerPage,
                  numberOfPages: environmentsResponse.NumberOfPages,
                  lastPageNumber: environmentsResponse.LastPageNumber,
                  items: environmentsResponse.Items.map((environment: DeploymentEnvironment) => ({
                    spaceId: environment.SpaceId,
                    id: environment.Id,
                    name: environment.Name,
                    description: environment.Description,
                    sortOrder: environment.SortOrder,
                    useGuidedFailure: environment.UseGuidedFailure,
                    allowDynamicInfrastructure: environment.AllowDynamicInfrastructure,
                    extensionSettings: environment.ExtensionSettings,
                  }))
                }),
              },
            ],
          };
        }
      );
    }
Behavior3/5

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

Annotations provide readOnlyHint=true, indicating a safe read operation. The description adds context about the tool's purpose and early usage, but doesn't disclose additional behavioral traits like pagination behavior (implied by skip/take parameters), rate limits, or authentication needs. With annotations covering safety, the description adds some value but lacks rich behavioral details, aligning with a baseline score.

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 front-loaded with the core purpose in the first sentence, followed by additional details in two concise sentences. Each sentence adds value: the first states the action, the second clarifies the required parameter, and the third provides usage guidance and an optional filter. There is no wasted text, making it efficient and well-structured.

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?

Given no output schema and 0% schema description coverage, the description provides basic purpose and usage but lacks details on return values, pagination (skip/take), or error handling. Annotations cover read-only safety, but for a tool with 4 parameters and no output schema, the description is incomplete, leaving gaps in understanding full behavior and results.

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 description coverage is 0%, so the description must compensate. It explains the required 'spaceName' and optional 'partialName' for filtering, covering 2 of 4 parameters. However, it doesn't mention 'skip' and 'take' parameters, leaving them undocumented. This partial coverage provides some semantics but doesn't fully address the schema gap, resulting in a baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'List environments in a space' and 'lists all environments in a given space.' It specifies the verb ('list') and resource ('environments'), and the required parameter ('space name is required'). However, it doesn't explicitly differentiate from sibling tools like 'list_spaces' or 'list_projects,' which reduces clarity in a broader context.

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

Usage Guidelines4/5

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

The description provides clear usage context: 'Use this tool as early as possible to understand which environments are configured.' This gives a practical guideline for when to use it. It also mentions an optional filter ('Optionally filter by partial name match using partialName parameter'), but it doesn't specify when not to use it or name alternatives among siblings, which limits the score.

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/OctopusDeploy/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server