Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

Find accounts in an Octopus Deploy space

find_accounts
Read-onlyIdempotent

Retrieve an account by ID or list all accounts in a space, with optional filtering by name, type, and pagination.

Instructions

Find accounts in a space - can retrieve a single account by ID or list all accounts

This unified tool can either:

  • Get detailed information about a specific account when accountId is provided

  • List all accounts in a space when accountId is omitted

You can optionally filter by various parameters like name, account type, etc. when listing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYes
accountIdNoThe ID of a specific account to retrieve. If omitted, lists all accounts.
skipNoNumber of accounts to skip for pagination (only used when listing)
takeNoNumber of accounts to take for pagination (only used when listing)
idsNoFilter by specific account IDs (only used when listing)
partialNameNoFilter by partial name match (only used when listing)
accountTypeNoFilter by account type (only used when listing)

Implementation Reference

  • The async handler function that executes the find_accounts tool logic. It connects to the Octopus API, retrieves either a single account by ID or lists all accounts with optional filters, and returns the mapped results.
      async ({
        spaceName,
        accountId,
        skip,
        take,
        ids,
        partialName,
        accountType,
      }) => {
        const configuration = getClientConfigurationFromEnvironment();
        const client = await Client.create(configuration);
        const spaceId = await resolveSpaceId(client, spaceName);
    
        // If accountId is provided, get a single account
        if (accountId) {
          validateEntityId(accountId, 'account', ENTITY_PREFIXES.account);
    
          try {
            const response = await client.get<AccountResource>(
              "~/api/{spaceId}/accounts/{id}",
              {
                spaceId,
                id: accountId,
              }
            );
    
            const account = mapAccountResource(response);
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(account),
                },
              ],
            };
          } catch (error) {
            handleOctopusApiError(error, {
              entityType: 'account',
              entityId: accountId,
              spaceName
            });
          }
        }
    
        // Otherwise, list all accounts
        const response = await client.get<ResourceCollection<AccountResource>>(
          "~/api/{spaceId}/accounts{?skip,take,ids,partialName,accountType}",
          {
            spaceId,
            skip,
            take,
            ids,
            partialName,
            accountType,
          }
        );
    
        const accounts = response.Items.map((account: AccountResource) => mapAccountResource(account));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                totalResults: response.TotalResults,
                itemsPerPage: response.ItemsPerPage,
                numberOfPages: response.NumberOfPages,
                lastPageNumber: response.LastPageNumber,
                items: accounts,
              }),
            },
          ],
        };
      }
    );
  • Input schema definition for the find_accounts tool using Zod. Defines parameters: spaceName (required), accountId, skip, take, ids, partialName, and accountType (optional enum).
        {
          title: "Find accounts in an Octopus Deploy space",
          description: `Find accounts in a space - can retrieve a single account by ID or list all accounts
    
    This unified tool can either:
    - Get detailed information about a specific account when accountId is provided
    - List all accounts in a space when accountId is omitted
    
    You can optionally filter by various parameters like name, account type, etc. when listing.`,
          inputSchema: {
            spaceName: z.string(),
            accountId: z.string().optional().describe("The ID of a specific account to retrieve. If omitted, lists all accounts."),
            skip: z.number().optional().describe("Number of accounts to skip for pagination (only used when listing)"),
            take: z.number().optional().describe("Number of accounts to take for pagination (only used when listing)"),
            ids: z.array(z.string()).optional().describe("Filter by specific account IDs (only used when listing)"),
            partialName: z.string().optional().describe("Filter by partial name match (only used when listing)"),
            accountType: z.nativeEnum(AccountType).optional().describe("Filter by account type (only used when listing)"),
          },
          annotations: READ_ONLY_TOOL_ANNOTATIONS,
        },
  • AccountType enum and AccountResource interfaces used by the handler to map API responses. The mapAccountResource function converts raw account data into a structured format with type-specific properties.
    export enum AccountType {
        None = "None",
        UsernamePassword = "UsernamePassword",
        Token = "Token",
        SshKeyPair = "SshKeyPair",
        AzureSubscription = "AzureSubscription",
        AzureServicePrincipal = "AzureServicePrincipal",
        AzureManagementCertificate = "AzureManagementCertificate",
        AzureOidc = "AzureOidc",
        AmazonWebServicesAccount = "AmazonWebServicesAccount",
        AmazonWebServicesOidcAccount = "AmazonWebServicesOidcAccount",
        GoogleCloudAccount = "GoogleCloudAccount",
        GenericOidcAccount = "GenericOidcAccount",
    }
    
    interface AccountResourceLinks {
        Self: string;
        Usages: string;
    }
    
    export interface BaseAccountResource extends ResourceWithSlug {
        Id: string;
        Name: string;
        Description: string;
        AccountType: AccountType;
    }
    
    export interface AccountResource extends BaseAccountResource, NamedResource<AccountResourceLinks>, SpaceScopedResource {
        EnvironmentIds: string[];
        TenantIds: string[];
        TenantTags: string[];
        TenantedDeploymentParticipation: TenantedDeploymentMode;
    }
    
    export interface AzureServicePrincipalAccountResource extends AccountResource {
        SubscriptionNumber: string;
        ClientId: string;
        TenantId: string;
        AzureEnvironment: string;
        ResourceManagementEndpointBaseUri: string;
        ActiveDirectoryEndpointBaseUri: string;
    }
    
    export interface AzureOidcAccountResource extends AccountResource {
        SubscriptionNumber: string;
        ClientId: string;
        TenantId: string;
        AzureEnvironment: string;
        TenantedSubjectGeneration: boolean;
        ResourceManagementEndpointBaseUri: string;
        ActiveDirectoryEndpointBaseUri: string;
        DeploymentSubjectKeys: string[];
        HealthCheckSubjectKeys: string[];
        AccountTestSubjectKeys: string[];
        Audience: string;
        CustomClaims: Record<string, string>;
    }
    
    export interface AzureSubscriptionAccountResource extends AccountResource {
        SubscriptionNumber: string;
        CertificateThumbprint: string;
        AzureEnvironment: string;
        ServiceManagementEndpointBaseUri: string;
        ServiceManagementEndpointSuffix: string;
    }
    
    export interface GenericOidcAccountResource extends AccountResource {
        TenantedSubjectGeneration: boolean;
        DeploymentSubjectKeys: string[];
        HealthCheckSubjectKeys: string[];
        AccountTestSubjectKeys: string[];
        Audience: string;
        CustomClaims: Record<string, string>;
    }
    
    export interface SshKeyPairAccountResource extends AccountResource {
        Username: string;
    }
    
    export interface UsernamePasswordAccountResource extends AccountResource {
        Username: string;
    }
    
    export interface TokenAccountResource extends AccountResource {
    }
    
    export interface AmazonWebServicesAccessKeyAccountResource extends AccountResource {
        AccessKey: string;
    }
    
    export interface AmazonWebServicesOidcAccountResource extends AccountResource {
        RoleArn: string;
        SessionDuration: string;
        DeploymentSubjectKeys: string[];
        HealthCheckSubjectKeys: string[];
        AccountTestSubjectKeys: string[];
        CustomClaims: Record<string, string>;
    }
    
    export interface GoogleCloudAccountResource extends AccountResource {
    }
    
    export function mapAccountResource(account: AccountResource) {
      const baseAccount = {
        spaceId: account.SpaceId,
        id: account.Id,
        name: account.Name,
        description: account.Description,
        slug: account.Slug,
        accountType: account.AccountType,
        environmentIds: account.EnvironmentIds,
        tenantIds: account.TenantIds,
        tenantTags: account.TenantTags,
        tenantedDeploymentParticipation: account.TenantedDeploymentParticipation,
      };
    
      // Add type-specific properties based on AccountType
      switch (account.AccountType) {
        case AccountType.AzureSubscription: {
          const azureAccount = account as AzureSubscriptionAccountResource;
          return {
            ...baseAccount,
            subscriptionNumber: azureAccount.SubscriptionNumber,
            certificateThumbprint: azureAccount.CertificateThumbprint,
            azureEnvironment: azureAccount.AzureEnvironment,
            serviceManagementEndpointBaseUri: azureAccount.ServiceManagementEndpointBaseUri,
            serviceManagementEndpointSuffix: azureAccount.ServiceManagementEndpointSuffix,
          };
        }
    
        case AccountType.AzureServicePrincipal: {
          const azureAccount = account as AzureServicePrincipalAccountResource;
          return {
            ...baseAccount,
            subscriptionNumber: azureAccount.SubscriptionNumber,
            clientId: azureAccount.ClientId,
            tenantId: azureAccount.TenantId,
            azureEnvironment: azureAccount.AzureEnvironment,
            resourceManagementEndpointBaseUri: azureAccount.ResourceManagementEndpointBaseUri,
            activeDirectoryEndpointBaseUri: azureAccount.ActiveDirectoryEndpointBaseUri,
          };
        }
    
        case AccountType.AzureOidc: {
          const azureAccount = account as AzureOidcAccountResource;
          return {
            ...baseAccount,
            subscriptionNumber: azureAccount.SubscriptionNumber,
            clientId: azureAccount.ClientId,
            tenantId: azureAccount.TenantId,
            azureEnvironment: azureAccount.AzureEnvironment,
            tenantedSubjectGeneration: azureAccount.TenantedSubjectGeneration,
            resourceManagementEndpointBaseUri: azureAccount.ResourceManagementEndpointBaseUri,
            activeDirectoryEndpointBaseUri: azureAccount.ActiveDirectoryEndpointBaseUri,
            deploymentSubjectKeys: azureAccount.DeploymentSubjectKeys,
            healthCheckSubjectKeys: azureAccount.HealthCheckSubjectKeys,
            accountTestSubjectKeys: azureAccount.AccountTestSubjectKeys,
            audience: azureAccount.Audience,
            customClaims: azureAccount.CustomClaims,
          };
        }
    
        case AccountType.SshKeyPair: {
          const sshAccount = account as SshKeyPairAccountResource;
          return {
            ...baseAccount,
            username: sshAccount.Username,
          };
        }
    
        case AccountType.UsernamePassword: {
          const userPassAccount = account as UsernamePasswordAccountResource;
          return {
            ...baseAccount,
            username: userPassAccount.Username,
          };
        }
    
        case AccountType.AmazonWebServicesAccount: {
          const awsAccount = account as AmazonWebServicesAccessKeyAccountResource;
          return {
            ...baseAccount,
            accessKey: awsAccount.AccessKey,
          };
        }
    
        case AccountType.AmazonWebServicesOidcAccount: {
          const awsOidcAccount = account as AmazonWebServicesOidcAccountResource;
          return {
            ...baseAccount,
            roleArn: awsOidcAccount.RoleArn,
            sessionDuration: awsOidcAccount.SessionDuration,
            deploymentSubjectKeys: awsOidcAccount.DeploymentSubjectKeys,
            healthCheckSubjectKeys: awsOidcAccount.HealthCheckSubjectKeys,
            accountTestSubjectKeys: awsOidcAccount.AccountTestSubjectKeys,
            customClaims: awsOidcAccount.CustomClaims,
          };
        }
    
        case AccountType.GenericOidcAccount: {
          const genericOidcAccount = account as GenericOidcAccountResource;
          return {
            ...baseAccount,
            tenantedSubjectGeneration: genericOidcAccount.TenantedSubjectGeneration,
            deploymentSubjectKeys: genericOidcAccount.DeploymentSubjectKeys,
            healthCheckSubjectKeys: genericOidcAccount.HealthCheckSubjectKeys,
            accountTestSubjectKeys: genericOidcAccount.AccountTestSubjectKeys,
            audience: genericOidcAccount.Audience,
            customClaims: genericOidcAccount.CustomClaims,
          };
        }
    
        case AccountType.Token:
        case AccountType.GoogleCloudAccount:
        case AccountType.None:
        default:
          return baseAccount;
      }
    }
  • The registerFindAccountsTool function that registers the tool on the MCP server. Also self-registers via registerToolDefinition at line 115-119 with the 'accounts' toolset.
    export function registerFindAccountsTool(server: McpServer) {
      server.registerTool(
        "find_accounts",
        {
          title: "Find accounts in an Octopus Deploy space",
          description: `Find accounts in a space - can retrieve a single account by ID or list all accounts
    
    This unified tool can either:
    - Get detailed information about a specific account when accountId is provided
    - List all accounts in a space when accountId is omitted
    
    You can optionally filter by various parameters like name, account type, etc. when listing.`,
          inputSchema: {
            spaceName: z.string(),
            accountId: z.string().optional().describe("The ID of a specific account to retrieve. If omitted, lists all accounts."),
            skip: z.number().optional().describe("Number of accounts to skip for pagination (only used when listing)"),
            take: z.number().optional().describe("Number of accounts to take for pagination (only used when listing)"),
            ids: z.array(z.string()).optional().describe("Filter by specific account IDs (only used when listing)"),
            partialName: z.string().optional().describe("Filter by partial name match (only used when listing)"),
            accountType: z.nativeEnum(AccountType).optional().describe("Filter by account type (only used when listing)"),
          },
          annotations: READ_ONLY_TOOL_ANNOTATIONS,
        },
        async ({
          spaceName,
          accountId,
          skip,
          take,
          ids,
          partialName,
          accountType,
        }) => {
          const configuration = getClientConfigurationFromEnvironment();
          const client = await Client.create(configuration);
          const spaceId = await resolveSpaceId(client, spaceName);
    
          // If accountId is provided, get a single account
          if (accountId) {
            validateEntityId(accountId, 'account', ENTITY_PREFIXES.account);
    
            try {
              const response = await client.get<AccountResource>(
                "~/api/{spaceId}/accounts/{id}",
                {
                  spaceId,
                  id: accountId,
                }
              );
    
              const account = mapAccountResource(response);
    
              return {
                content: [
                  {
                    type: "text",
                    text: JSON.stringify(account),
                  },
                ],
              };
            } catch (error) {
              handleOctopusApiError(error, {
                entityType: 'account',
                entityId: accountId,
                spaceName
              });
            }
          }
    
          // Otherwise, list all accounts
          const response = await client.get<ResourceCollection<AccountResource>>(
            "~/api/{spaceId}/accounts{?skip,take,ids,partialName,accountType}",
            {
              spaceId,
              skip,
              take,
              ids,
              partialName,
              accountType,
            }
          );
    
          const accounts = response.Items.map((account: AccountResource) => mapAccountResource(account));
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  totalResults: response.TotalResults,
                  itemsPerPage: response.ItemsPerPage,
                  numberOfPages: response.NumberOfPages,
                  lastPageNumber: response.LastPageNumber,
                  items: accounts,
                }),
              },
            ],
          };
        }
      );
    }
  • Import of the findAccounts module in the tools index, which triggers self-registration of the tool via the side-effect import.
    import "./findAccounts.js";
Behavior3/5

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

Annotations already declare readOnly=true, so description's main addition is the dual-mode behavior. Does not disclose pagination limits, error handling, or response format; acceptable given 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?

Concise two-sentence summary followed by bullet list. No wasted words, front-loaded with purpose.

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?

Adequately covers core functionality for a simple read tool with 7 params and no output schema. Missing details like return format or error handling, but not critical for selection.

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 descriptions cover 86% of parameters, including conditional usage ('only used when listing'). Description rephrases but adds no new semantic value beyond 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?

Describes verb and resource clearly, with explicit dual-mode behavior (get by ID or list all). Distinguishes from sibling 'find_*' tools by specifying accounts.

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?

Clearly states when to use each mode (accountId provided vs omitted) and optional filters for listing. Lacks explicit alternatives or when-not-to-use guidance, but conditional usage is well explained.

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