get_tenant_by_id
Retrieve detailed information about a specific Octopus Deploy tenant using its unique identifier to manage customer-specific deployments, configurations, and logical groupings.
Instructions
Get details for a specific tenant by its ID. 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
| Name | Required | Description | Default |
|---|---|---|---|
| spaceName | Yes | The space name | |
| tenantId | Yes | The ID of the tenant to retrieve |
Implementation Reference
- src/tools/getTenantById.ts:21-46 (handler)The core handler function that fetches the tenant details using the Octopus Deploy API client and TenantRepository, then formats and returns the data as a text content block including a public URL.async ({ spaceName, tenantId }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const tenantRepository = new TenantRepository(client, spaceName); const tenant = await tenantRepository.get(tenantId); return { content: [ { type: "text", text: JSON.stringify({ id: tenant.Id, name: tenant.Name, description: tenant.Description, 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.` }), }, ], }; }
- src/tools/getTenantById.ts:13-16 (schema)Zod input schema defining the required parameters: spaceName (string) and tenantId (string).{ spaceName: z.string().describe("The space name"), tenantId: z.string().describe("The ID of the tenant to retrieve") },
- src/tools/getTenantById.ts:9-48 (registration)The registration function that calls server.tool to register the get_tenant_by_id tool with MCP server, including description, input schema, metadata, and handler reference.export function registerGetTenantByIdTool(server: McpServer) { server.tool( "get_tenant_by_id", `Get details for a specific tenant by its ID. ${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 tenantRepository = new TenantRepository(client, spaceName); const tenant = await tenantRepository.get(tenantId); return { content: [ { type: "text", text: JSON.stringify({ id: tenant.Id, name: tenant.Name, description: tenant.Description, 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.` }), }, ], }; } ); }
- src/tools/getTenantById.ts:50-54 (registration)Self-registration of the tool into the global TOOL_REGISTRY, enabling conditional registration via src/tools/index.ts based on configuration.registerToolDefinition({ toolName: "get_tenant_by_id", config: { toolset: "tenants", readOnly: true }, registerFn: registerGetTenantByIdTool, });
- src/tools/index.ts:58-65 (registration)Central tool registration function that iterates over TOOL_REGISTRY and calls registerFn for enabled tools, including get_tenant_by_id if conditions met.export function registerTools(server: McpServer, config: ToolsetConfig = {}) { // Iterate through all registered tools and register those that are enabled for (const [, toolRegistration] of TOOL_REGISTRY) { if (isToolEnabled(toolRegistration, config)) { toolRegistration.registerFn(server); } } }