Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

get_tenant_by_id

Read-only

Retrieve tenant details by ID to view associated projects and environments for managing customer-specific deployments in Octopus Deploy.

Instructions

Get details for a specific tenant by its ID, including the projects and environments the tenant is associated with. 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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYesThe space name
tenantIdYesThe ID of the tenant to retrieve

Implementation Reference

  • The async handler function that creates an Octopus Deploy client, resolves the space ID, fetches the tenant resource by ID, formats key details into JSON, generates a public URL, and returns it as tool content.
    async ({spaceName, tenantId}) => {
      const configuration = getClientConfigurationFromEnvironment();
      const client = await Client.create(configuration);
      const spaceId = await resolveSpaceId(client, spaceName);
    
      const tenant = await client.get<TenantResource>("~/api/{spaceId}/tenant/{tenantId}", {spaceId, tenantId});
    
      return {
        content: [
          {
            type: "text",
            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.`
            }),
          },
        ],
      };
    }
  • Input schema defined using Zod, specifying spaceName and tenantId as required string parameters with descriptions.
    {
      spaceName: z.string().describe("The space name"),
      tenantId: z.string().describe("The ID of the tenant to retrieve")
    },
  • The registerGetTenantByIdTool function called to register the tool on the MCP server, specifying name, description, input schema, output metadata, and handler.
    export function registerGetTenantByIdTool(server: McpServer) {
      server.tool(
        "get_tenant_by_id",
        `Get details for a specific tenant by its ID, including the projects and environments the tenant is associated with. ${tenantsDescription}`,
        {
          spaceName: z.string().describe("The space name"),
          tenantId: z.string().describe("The ID of the tenant to retrieve")
        },
        {
          title: "Get tenant details by ID from Octopus Deploy",
          readOnlyHint: true,
        },
        async ({spaceName, tenantId}) => {
          const configuration = getClientConfigurationFromEnvironment();
          const client = await Client.create(configuration);
          const spaceId = await resolveSpaceId(client, spaceName);
    
          const tenant = await client.get<TenantResource>("~/api/{spaceId}/tenant/{tenantId}", {spaceId, tenantId});
    
          return {
            content: [
              {
                type: "text",
                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.`
                }),
              },
            ],
          };
        }
      );
    }
  • Self-registration of the tool definition into the TOOL_REGISTRY, which is used by index.ts to conditionally register enabled tools.
    registerToolDefinition({
      toolName: "get_tenant_by_id",
      config: {toolset: "tenants", readOnly: true},
      registerFn: registerGetTenantByIdTool,
    });
Behavior3/5

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

Annotations already declare readOnlyHint=true, indicating a safe read operation. The description adds context about what details are retrieved (projects, environments, tenant tags) and explains the concept of tenants in Octopus Deploy, which is useful. However, it does not disclose additional behavioral traits like error handling, rate limits, or authentication needs beyond what annotations provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by explanatory context. However, the last two sentences about tenant grouping and representation are somewhat redundant and could be condensed, slightly reducing efficiency.

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 tool's complexity (simple retrieval with 2 parameters), high schema coverage, and annotations, the description is mostly complete. It explains the resource and included details, but lacks output format information (no output schema provided), which could help the agent understand the return structure.

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 100%, with clear parameter descriptions in the input schema. The description does not add meaning beyond the schema, as it does not explain parameter formats or usage examples. Baseline 3 is appropriate since the schema adequately documents the parameters.

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 specific action ('Get details for a specific tenant by its ID') and resource ('tenant'), distinguishing it from sibling tools like 'list_tenants' (which lists all tenants) and 'get_tenant_variables' (which focuses on variables). It explicitly mentions what details are included ('projects and environments the tenant is associated with'), providing precise scope.

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 implies usage context by specifying 'by its ID' and listing included details, which helps differentiate it from list tools. However, it does not explicitly state when to use this tool versus alternatives like 'get_tenant_variables' or provide exclusions, leaving some ambiguity for the agent.

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