Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

get_deployment_target

Retrieve detailed information about a specific deployment target (machine) in Octopus Deploy by providing the space name and target ID.

Instructions

Get a specific deployment target (machine) by ID

This tool retrieves detailed information about a specific deployment target using its ID. The space name and target ID are both required.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYes
targetIdYes

Implementation Reference

  • The core handler function for the 'get_deployment_target' tool. It resolves the space ID, fetches the deployment target using the Octopus Deploy API client, maps the response to a structured object, and returns it as JSON text content.
    async ({ spaceName, targetId }) => {
      const configuration = getClientConfigurationFromEnvironment();
      const client = await Client.create(configuration);
      const spaceId = await resolveSpaceId(client, spaceName);
    
      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),
          },
        ],
      };
    }
  • Input schema for the tool using Zod validation: requires 'spaceName' and 'targetId' as strings.
      spaceName: z.string(),
      targetId: z.string(),
    },
  • The registration function that defines and registers the 'get_deployment_target' tool on the MCP server, including name, description, input schema, metadata, and handler.
    export function registerGetDeploymentTargetTool(server: McpServer) {
      server.tool(
        "get_deployment_target",
        `Get a specific deployment target (machine) by ID
    
    This tool retrieves detailed information about a specific deployment target using its ID. The space name and target ID are both required.`,
        {
          spaceName: z.string(),
          targetId: z.string(),
        },
        {
          title: "Get a specific deployment target from an Octopus Deploy space",
          readOnlyHint: true,
        },
        async ({ spaceName, targetId }) => {
          const configuration = getClientConfigurationFromEnvironment();
          const client = await Client.create(configuration);
          const spaceId = await resolveSpaceId(client, spaceName);
    
          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),
              },
            ],
          };
        }
      );
    }
  • Self-registration of the tool into the TOOL_REGISTRY for conditional registration in tools/index.ts.
    registerToolDefinition({
      toolName: "get_deployment_target",
      config: { toolset: "machines", readOnly: true },
      registerFn: registerGetDeploymentTargetTool,
    });

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