Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

Find deployment targets in an Octopus Deploy space

find_deployment_targets
Read-onlyIdempotent

Retrieve deployment targets in a space by ID or list all with filters for name, roles, health status, and more.

Instructions

Find deployment targets (machines) in a space - can retrieve a single target by ID or list all targets

This unified tool can either:

  • Get detailed information about a specific deployment target when targetId is provided

  • List all deployment targets in a space when targetId is omitted

You can optionally filter by various parameters like name, roles, health status, etc. when listing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYes
targetIdNoThe ID of a specific deployment target to retrieve. If omitted, lists all deployment targets.
skipNoNumber of targets to skip for pagination (only used when listing)
takeNoNumber of targets to take for pagination (only used when listing)
nameNoFilter by exact name (only used when listing)
idsNoFilter by specific target IDs (only used when listing)
partialNameNoFilter by partial name match (only used when listing)
rolesNoA list of roles / target tags to filter by (only used when listing)
isDisabledNoFilter by disabled status (only used when listing)
healthStatusesNoPossible values: Healthy, Unhealthy, Unavailable, Unknown, HasWarnings (only used when listing)
commStylesNoFilter by communication styles (only used when listing)
tenantIdsNoFilter by tenant IDs (only used when listing)
tenantTagsNoFilter by tenant tags (only used when listing)
environmentIdsNoFilter by environment IDs (only used when listing)
thumbprintNoFilter by thumbprint (only used when listing)
deploymentIdNoFilter by deployment ID (only used when listing)
shellNamesNoFilter by shell names (only used when listing)
deploymentTargetTypesNoFilter by deployment target types (only used when listing)

Implementation Reference

  • The main tool registration and handler function for 'find_deployment_targets'. Registers the tool with inputSchema (spaceName, targetId, skip, take, name, ids, partialName, roles, isDisabled, healthStatuses, commStyles, tenantIds, tenantTags, environmentIds, thumbprint, deploymentId, shellNames, deploymentTargetTypes). The handler either gets a single deployment target by ID or lists all targets with filters, returning formatted JSON results.
    export function registerFindDeploymentTargetsTool(server: McpServer) {
      server.registerTool(
        "find_deployment_targets",
        {
          title: "Find deployment targets in an Octopus Deploy space",
          description: `Find deployment targets (machines) in a space - can retrieve a single target by ID or list all targets
    
    This unified tool can either:
    - Get detailed information about a specific deployment target when targetId is provided
    - List all deployment targets in a space when targetId is omitted
    
    You can optionally filter by various parameters like name, roles, health status, etc. when listing.`,
          inputSchema: {
            spaceName: z.string(),
            targetId: z.string().optional().describe("The ID of a specific deployment target to retrieve. If omitted, lists all deployment targets."),
            skip: z.number().optional().describe("Number of targets to skip for pagination (only used when listing)"),
            take: z.number().optional().describe("Number of targets to take for pagination (only used when listing)"),
            name: z.string().optional().describe("Filter by exact name (only used when listing)"),
            ids: z.array(z.string()).optional().describe("Filter by specific target IDs (only used when listing)"),
            partialName: z.string().optional().describe("Filter by partial name match (only used when listing)"),
            roles: z.array(z.string()).optional().describe("A list of roles / target tags to filter by (only used when listing)"),
            isDisabled: z.boolean().optional().describe("Filter by disabled status (only used when listing)"),
            healthStatuses: z.array(z.string()).optional().describe("Possible values: Healthy, Unhealthy, Unavailable, Unknown, HasWarnings (only used when listing)"),
            commStyles: z.array(z.string()).optional().describe("Filter by communication styles (only used when listing)"),
            tenantIds: z.array(z.string()).optional().describe("Filter by tenant IDs (only used when listing)"),
            tenantTags: z.array(z.string()).optional().describe("Filter by tenant tags (only used when listing)"),
            environmentIds: z.array(z.string()).optional().describe("Filter by environment IDs (only used when listing)"),
            thumbprint: z.string().optional().describe("Filter by thumbprint (only used when listing)"),
            deploymentId: z.string().optional().describe("Filter by deployment ID (only used when listing)"),
            shellNames: z.array(z.string()).optional().describe("Filter by shell names (only used when listing)"),
            deploymentTargetTypes: z.array(z.string()).optional().describe("Filter by deployment target types (only used when listing)"),
          },
          annotations: READ_ONLY_TOOL_ANNOTATIONS,
        },
        async ({
          spaceName,
          targetId,
          skip,
          take,
          name,
          ids,
          partialName,
          roles,
          isDisabled,
          healthStatuses,
          commStyles,
          tenantIds,
          tenantTags,
          environmentIds,
          thumbprint,
          deploymentId,
          shellNames,
          deploymentTargetTypes,
        }) => {
          const configuration = getClientConfigurationFromEnvironment();
          const client = await Client.create(configuration);
          const spaceId = await resolveSpaceId(client, spaceName);
    
          // If targetId is provided, get a single deployment target
          if (targetId) {
            validateEntityId(targetId, 'machine', ENTITY_PREFIXES.machine);
    
            try {
              const target = await client.get<DeploymentTargetResource>(
                "~/api/{spaceId}/machines/{id}",
                {
                  spaceId,
                  id: targetId,
                }
              );
    
              const deploymentTarget = {
                spaceId: target.SpaceId,
                id: target.Id,
                name: target.Name,
                slug: target.Slug,
                isDisabled: target.IsDisabled,
                healthStatus: target.HealthStatus,
                statusSummary: target.StatusSummary,
                environmentIds: target.EnvironmentIds,
                roles: target.Roles,
                tenantedDeploymentParticipation: target.TenantedDeploymentParticipation,
                tenantIds: target.TenantIds,
                tenantTags: target.TenantTags,
                endpoint: {
                  id: target.Endpoint.Id,
                  communicationStyle: target.Endpoint.CommunicationStyle,
                  uri: target.Endpoint.Uri,
                  fingerprint: target.Endpoint.Fingerprint,
                  proxyId: target.Endpoint.ProxyId,
                  tentacleVersionDetails: target.Endpoint.TentacleVersionDetails,
                },
                shellName: target.ShellName,
                machinePolicyId: target.MachinePolicyId,
                hasLatestCalamari: target.HasLatestCalamari,
                isInProcess: target.IsInProcess,
                links: target.Links,
              };
    
              return {
                content: [
                  {
                    type: "text",
                    text: JSON.stringify(deploymentTarget),
                  },
                ],
              };
            } catch (error) {
              handleOctopusApiError(error, {
                entityType: 'deployment target',
                entityId: targetId,
                spaceName,
                helpText: "Use find_deployment_targets without targetId to find valid target IDs."
              });
            }
          }
    
          // Otherwise, list all deployment targets
          const response = await client.get<ResourceCollection<DeploymentTargetResource>>(
            "~/api/{spaceId}/machines{?skip,take,name,ids,partialName,roles,isDisabled,healthStatuses,commStyles,tenantIds,tenantTags,environmentIds,thumbprint,deploymentId,shellNames,deploymentTargetTypes}",
            {
              spaceId,
              skip,
              take,
              name,
              ids,
              partialName,
              roles,
              isDisabled,
              healthStatuses,
              commStyles,
              tenantIds,
              tenantTags,
              environmentIds,
              thumbprint,
              deploymentId,
              shellNames,
              deploymentTargetTypes,
            }
          );
    
          const deploymentTargets = response.Items.map((target: DeploymentTargetResource) => ({
            spaceId: target.SpaceId,
            id: target.Id,
            name: target.Name,
            slug: target.Slug,
            isDisabled: target.IsDisabled,
            healthStatus: target.HealthStatus,
            statusSummary: target.StatusSummary,
            environmentIds: target.EnvironmentIds,
            roles: target.Roles,
            tenantedDeploymentParticipation: target.TenantedDeploymentParticipation,
            tenantIds: target.TenantIds,
            tenantTags: target.TenantTags,
            endpoint: {
              communicationStyle: target.Endpoint.CommunicationStyle,
              uri: target.Endpoint.Uri,
              fingerprint: target.Endpoint.Fingerprint,
            },
            shellName: target.ShellName,
            machinePolicyId: target.MachinePolicyId,
            hasLatestCalamari: target.HasLatestCalamari,
            isInProcess: target.IsInProcess,
          }));
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  totalResults: response.TotalResults,
                  itemsPerPage: response.ItemsPerPage,
                  numberOfPages: response.NumberOfPages,
                  lastPageNumber: response.LastPageNumber,
                  items: deploymentTargets,
                }),
              },
            ],
          };
        }
      );
    }
  • Self-registration into the global TOOL_REGISTRY map via registerToolDefinition. Configures the tool under the 'machines' toolset as read-only.
    registerToolDefinition({
      toolName: "find_deployment_targets",
      config: { toolset: "machines", readOnly: true },
      registerFn: registerFindDeploymentTargetsTool,
    });
  • Import of the findDeploymentTargets module in the tools index, which triggers its self-registration via the TOOL_REGISTRY.
    import "./findDeploymentTargets.js";
  • Type definitions for DeploymentTargetResource and related types (MachineResource, EndpointResource, etc.) used by the handler to type the API response.
    export interface MachineResource extends NamedResource, SpaceScopedResource, ResourceWithSlug {
        IsDisabled: boolean;
        MachinePolicyId: string;
        HealthStatus: MachineModelHealthStatus;
        HasLatestCalamari: boolean;
        StatusSummary: string;
        IsInProcess: boolean;
        Endpoint: EndpointResource;
        ShellName: string;
    }
    
    export interface DeploymentTargetResource extends MachineResource {
        EnvironmentIds: string[];
        Roles: string[];
        TenantedDeploymentParticipation: TenantedDeploymentMode;
        TenantIds: string[];
        TenantTags: string[];
    }
Behavior4/5

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

Annotations already indicate read-only, non-destructive, idempotent behavior. The description adds the dual-mode behavior and filtering options, which provides useful context beyond annotations. It does not discuss potential error responses or rate limits, but the safety profile is well-covered by annotations.

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 concise with three short, well-structured paragraphs. The key information is front-loaded, and every sentence adds value without redundancy. It efficiently conveys the tool's functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of 18 parameters and no output schema, the description covers the essential behaviors (two modes, filtering) and infers return type. It lacks explicit details on errors or response format, but for a read-only find tool with strong annotations, it is fairly complete.

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 94%, extensively documenting each parameter. The description reinforces the conditional nature of targetId vs listing parameters but adds minimal new meaning beyond what the schema already says. This meets the baseline for high-coverage schemas.

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 'Find deployment targets (machines) in a space' and distinguishes between retrieving a single target by ID and listing all targets. This differentiates it from sibling tools like find_accounts or find_certificates by specifying the resource and action.

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 context on when to use each mode (targetId provided vs omitted) and lists available filters for listing. However, it does not explicitly compare against sibling tools or provide 'when not to use' guidance, which would be beneficial given the many similar find_* tools.

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