Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

Find tenants in an Octopus Deploy space

find_tenants
Read-onlyIdempotent

Retrieve a specific tenant by ID or list all tenants in a space with optional filters for project, tags, and pagination.

Instructions

Find tenants in a space - can retrieve a single tenant by ID or list all tenants

This unified tool can either:

  • Get details for a specific tenant when tenantId is provided, including the projects and environments the tenant is associated with

  • List all tenants in a space when tenantId is omitted

Tenants represent customers or clients in Octopus Deploy, allowing you to manage deployments and configurations specific to each tenant. Tenants can be grouped into tenant tags for easier management and deployment targeting. Tenants can also represent geographical locations, organizational units, or any other logical grouping.

Optionally provide filtering and pagination parameters when listing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYesThe space name
tenantIdNoThe ID of a specific tenant to retrieve. If omitted, lists all tenants.
skipNoNumber of tenants to skip for pagination (only used when listing)
takeNoNumber of tenants to take for pagination (only used when listing)
projectIdNoFilter by specific project ID (only used when listing)
tagsNoFilter by tenant tags (comma-separated list, only used when listing)
idsNoFilter by specific tenant IDs (only used when listing)
partialNameNoFilter by partial tenant name match (only used when listing)

Implementation Reference

  • Main handler function for find_tenants tool. Retrieves a single tenant by ID (if tenantId provided) or lists all tenants with optional filtering/pagination.
    export async function findTenantsHandler(params: FindTenantsParams) {
      const { spaceName, tenantId, skip, take, projectId, tags, ids, partialName } = params;
      const configuration = getClientConfigurationFromEnvironment();
      const client = await Client.create(configuration);
      const spaceId = await resolveSpaceId(client, spaceName);
    
      // If tenantId is provided, get a single tenant
      if (tenantId) {
        validateEntityId(tenantId, "tenant", ENTITY_PREFIXES.tenant);
    
        try {
          const tenant = await client.get<TenantResource>(
            "~/api/{spaceId}/tenant/{tenantId}",
            { spaceId, tenantId },
          );
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({
                  id: tenant.Id,
                  name: tenant.Name,
                  slug: tenant.Slug,
                  description: tenant.Description,
                  isDisabled: tenant.IsDisabled,
                  projectEnvironments: tenant.ProjectEnvironments,
                  tenantTags: tenant.TenantTags,
                  clonedFromTenantId: tenant.ClonedFromTenantId,
                  spaceId: tenant.SpaceId,
                  publicUrl: getPublicUrl(
                    `${configuration.instanceURL}/app#/{spaceId}/tenants/{tenantId}/overview`,
                    {
                      spaceId: tenant.SpaceId,
                      tenantId: tenant.Id,
                    },
                  ),
                  publicUrlInstruction: `You can view more details about this tenant in the Octopus Deploy web portal at the provided publicUrl.`,
                }),
              },
            ],
          };
        } catch (error) {
          handleOctopusApiError(error, {
            entityType: "tenant",
            entityId: tenantId,
            spaceName,
          });
        }
      }
    
      // Otherwise, list tenants
      const tenantsResponse = await client.get<ResourceCollection<TenantResource>>(
        "~/api/{spaceId}/tenants{?skip,take,projectId,tags,ids,partialName}",
        {
          spaceId,
          skip,
          take,
          projectId,
          tags,
          ids,
          partialName,
        },
      );
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify({
              totalResults: tenantsResponse.TotalResults,
              itemsPerPage: tenantsResponse.ItemsPerPage,
              numberOfPages: tenantsResponse.NumberOfPages,
              lastPageNumber: tenantsResponse.LastPageNumber,
              items: tenantsResponse.Items.map((tenant) => ({
                id: tenant.Id,
                name: tenant.Name,
                slug: tenant.Slug,
                description: tenant.Description,
                isDisabled: tenant.IsDisabled ?? false,
                tenantTags: tenant.TenantTags,
                clonedFromTenantId: tenant.ClonedFromTenantId,
                spaceId: tenant.SpaceId,
                publicUrl: getPublicUrl(
                  `${configuration.instanceURL}/app#/{spaceId}/tenants/{tenantId}/overview`,
                  {
                    spaceId: tenant.SpaceId,
                    tenantId: tenant.Id,
                  },
                ),
                publicUrlInstruction: `You can view more details about this tenant in the Octopus Deploy web portal at the provided publicUrl.`,
              })),
            }),
          },
        ],
      };
    }
  • TypeScript interface defining input parameters for findTenantsHandler.
    export interface FindTenantsParams {
      spaceName: string;
      tenantId?: string;
      skip?: number;
      take?: number;
      projectId?: string;
      tags?: string;
      ids?: string[];
      partialName?: string;
    }
  • Registration function that registers the find_tenants tool with the MCP server, including description, Zod input schema, and read-only annotations.
    export function registerFindTenantsTool(server: McpServer) {
      server.registerTool(
        "find_tenants",
        {
          title: "Find tenants in an Octopus Deploy space",
          description: `Find tenants in a space - can retrieve a single tenant by ID or list all tenants
    
      This unified tool can either:
      - Get details for a specific tenant when tenantId is provided, including the projects and environments the tenant is associated with
      - List all tenants in a space when tenantId is omitted
    
      ${tenantsDescription}
    
      Optionally provide filtering and pagination parameters when listing.`,
          inputSchema: {
            spaceName: z.string().describe("The space name"),
            tenantId: z.string().optional().describe("The ID of a specific tenant to retrieve. If omitted, lists all tenants."),
            skip: z.number().optional().describe("Number of tenants to skip for pagination (only used when listing)"),
            take: z.number().optional().describe("Number of tenants to take for pagination (only used when listing)"),
            projectId: z
              .string()
              .optional()
              .describe("Filter by specific project ID (only used when listing)"),
            tags: z
              .string()
              .optional()
              .describe("Filter by tenant tags (comma-separated list, only used when listing)"),
            ids: z
              .array(z.string())
              .optional()
              .describe("Filter by specific tenant IDs (only used when listing)"),
            partialName: z
              .string()
              .optional()
              .describe("Filter by partial tenant name match (only used when listing)"),
          },
          annotations: READ_ONLY_TOOL_ANNOTATIONS,
        },
        findTenantsHandler,
      );
  • Self-registration of the find_tenants tool into the global TOOL_REGISTRY, marking it as part of the 'tenants' toolset and read-only.
    registerToolDefinition({
      toolName: "find_tenants",
      config: { toolset: "tenants", readOnly: true },
      registerFn: registerFindTenantsTool,
    });
  • Import in src/tools/index.ts that triggers the self-registration of findTenants.ts when the module is loaded.
    import "./findTenants.js";
    import "./findDeploymentTargets.js";
    import "./findCertificates.js";
    import "./findAccounts.js";
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true, indicating a safe read operation. The description adds behavioral context by noting that when retrieving a specific tenant, the response includes associated projects and environments, and that listing supports optional filtering and pagination. No contradiction with 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 well-structured paragraphs. The first sentence immediately states the core function. Each paragraph serves a purpose: core function, mode explanation, background. No redundant or irrelevant information.

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?

The description explains the tool's two modes, the concept of tenants, and mentions that single retrieval includes projects/environments. With comprehensive schema descriptions and annotations indicating a safe read operation, the description provides sufficient context for correct tool invocation. It could detail the output format but is adequate for the tool's simplicity.

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

Parameters4/5

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

Schema description coverage is 100%, so all parameters are documented. The description reinforces the dual mode (tenantId vs listing) and explains that filtering/pagination apply only when listing. It also adds context about what a tenant represents. This goes slightly beyond the schema, warranting a 4.

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 tool's purpose: 'Find tenants in a space - can retrieve a single tenant by ID or list all tenants'. It uses specific verbs (find/retrieve/list) and resources (tenants), and distinguishes the two operational modes. This differentiates it from sibling tools like find_accounts or find_certificates.

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 guidance on when to use each mode: provide tenantId for a single tenant, omit to list all. It also states when filtering and pagination parameters apply (only when listing). However, it does not explicitly contrast with sibling tools or provide 'when not to use' guidance, though the resource-specific naming makes it obvious.

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