Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

list_tenants

Read-only

Retrieve all tenants within a specified Octopus Deploy space. Filter results by project, tags, IDs, or name, and use pagination for large datasets.

Instructions

List tenants in a space

This tool lists all tenants in a given space. The space name is required. Optionally provide skip and take parameters for pagination.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYesThe space name
skipNo
takeNo
projectIdNoFilter by specific project ID
tagsNoFilter by tenant tags (comma-separated list)
idsNoFilter by specific tenant IDs
partialNameNoFilter by partial tenant name match

Implementation Reference

  • The handler function that fetches and returns the list of tenants from the Octopus Deploy API, including pagination info and tenant details with public URLs.
    async ({spaceName, skip, take, projectId, tags, ids, partialName}) => {
      const configuration = getClientConfigurationFromEnvironment();
      const client = await Client.create(configuration);
      const spaceId = await resolveSpaceId(client, spaceName);
    
      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",
            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, // Disabling tenants was introduced in 2024.4. Prior to that, all tenants could be considered 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.`
              }))
            }),
          },
        ],
      };
    }
  • Zod schema defining input parameters for the list_tenants tool: spaceName (required), optional pagination (skip, take), and filters (projectId, tags, ids, partialName).
    {
      spaceName: z.string().describe("The space name"),
      skip: z.number().optional(),
      take: z.number().optional(),
      projectId: z.string().optional().describe("Filter by specific project ID"),
      tags: z.string().optional().describe("Filter by tenant tags (comma-separated list)"),
      ids: z.array(z.string()).optional().describe("Filter by specific tenant IDs"),
      partialName: z.string().optional().describe("Filter by partial tenant name match")
    },
  • The registerListTenantsTool function that calls server.tool to register the list_tenants tool with MCP server, including name, description, input schema, output hints, and handler.
    export function registerListTenantsTool(server: McpServer) {
      server.tool(
        "list_tenants",
        `List tenants in a space
      
      This tool lists all tenants in a given space. The space name is required. Optionally provide skip and take parameters for pagination.`,
        {
          spaceName: z.string().describe("The space name"),
          skip: z.number().optional(),
          take: z.number().optional(),
          projectId: z.string().optional().describe("Filter by specific project ID"),
          tags: z.string().optional().describe("Filter by tenant tags (comma-separated list)"),
          ids: z.array(z.string()).optional().describe("Filter by specific tenant IDs"),
          partialName: z.string().optional().describe("Filter by partial tenant name match")
        },
        {
          title: "List all tenants in an Octopus Deploy space",
          readOnlyHint: true,
        },
        async ({spaceName, skip, take, projectId, tags, ids, partialName}) => {
          const configuration = getClientConfigurationFromEnvironment();
          const client = await Client.create(configuration);
          const spaceId = await resolveSpaceId(client, spaceName);
    
          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",
                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, // Disabling tenants was introduced in 2024.4. Prior to that, all tenants could be considered 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.`
                  }))
                }),
              },
            ],
          };
        }
      );
    }
  • Self-registration of the tool in the TOOL_REGISTRY via registerToolDefinition, allowing conditional registration based on config in index.ts.
    registerToolDefinition({
      toolName: "list_tenants",
      config: {toolset: "tenants", readOnly: true},
      registerFn: registerListTenantsTool,
    });
Behavior4/5

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

Annotations provide readOnlyHint=true, which the description doesn't contradict. The description adds valuable behavioral context about pagination support (skip/take parameters) and filtering capabilities (projectId, tags, ids, partialName), which goes beyond what annotations provide. However, it doesn't mention rate limits, authentication needs, or response format details.

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 extremely concise with just two sentences that efficiently convey the core purpose and key usage information. Every word earns its place, and the structure is front-loaded with the main function followed by important details.

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?

For a read-only list tool with good schema coverage but no output schema, the description provides adequate context about what it does and how to use it. It covers the required parameter, pagination, and hints at filtering capabilities. The main gap is lack of information about return format or error conditions.

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?

With 71% schema description coverage, the schema already documents most parameters well. The description mentions spaceName as required and skip/take for pagination, which adds some semantic context, but doesn't explain the filtering parameters (projectId, tags, ids, partialName) beyond what's in the schema. This meets the baseline for good schema coverage.

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 action ('list all tenants') and resource ('in a given space'), with the title annotation providing additional context about Octopus Deploy. However, it doesn't explicitly differentiate from sibling tools like 'get_tenant_by_id' or 'list_spaces', which would require more specific comparison.

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

Usage Guidelines3/5

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

The description implies usage context by specifying 'space name is required' and mentioning pagination, but doesn't explicitly state when to use this tool versus alternatives like 'get_tenant_by_id' for single tenants or 'list_spaces' for spaces themselves. The guidance is functional but not comparative.

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