get_tenant_variables
Retrieve tenant variables from Octopus Deploy by type: all, common, or project-specific variables for deployment configuration.
Instructions
Get tenant variables by type
This tool retrieves different types of tenant variables. Use variableType parameter to specify which type:
"all": Get all tenant variables
"common": Get common variables only
"project": Get project-specific variables only
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spaceName | Yes | The space name | |
| tenantId | Yes | The ID of the tenant to retrieve variables for | |
| variableType | Yes | Type of variables to retrieve | |
| includeMissingVariables | No | Include missing variables in the response (for common/project types) |
Implementation Reference
- src/tools/getTenantVariables.ts:26-60 (handler)Handler function that connects to Octopus Deploy client, fetches tenant repository, and retrieves variables based on variableType ('all', 'common', or 'project'), optionally including missing variables.async ({ spaceName, tenantId, variableType, includeMissingVariables = false }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const tenantRepository = new TenantRepository(client, spaceName); let variables; switch (variableType) { case "all": { const tenant = await tenantRepository.get(tenantId); variables = await tenantRepository.getVariables(tenant); break; } case "common": variables = await tenantRepository.getCommonVariablesById(tenantId, includeMissingVariables); break; case "project": variables = await tenantRepository.getProjectVariablesById(tenantId, includeMissingVariables); break; } return { content: [ { type: "text", text: JSON.stringify({ tenantId, variableType, includeMissingVariables, variables }), }, ], }; }
- Zod input schema defining parameters: spaceName (string), tenantId (string), variableType (enum: all/common/project), includeMissingVariables (optional boolean).{ spaceName: z.string().describe("The space name"), tenantId: z.string().describe("The ID of the tenant to retrieve variables for"), variableType: z.enum(["all", "common", "project"]).describe("Type of variables to retrieve"), includeMissingVariables: z.boolean().optional().describe("Include missing variables in the response (for common/project types)") },
- src/tools/getTenantVariables.ts:7-62 (registration)Main registration function registerGetTenantVariablesTool that calls server.tool() to register the tool with name, description, input schema, output metadata, and handler.export function registerGetTenantVariablesTool(server: McpServer) { server.tool( "get_tenant_variables", `Get tenant variables by type This tool retrieves different types of tenant variables. Use variableType parameter to specify which type: - "all": Get all tenant variables - "common": Get common variables only - "project": Get project-specific variables only`, { spaceName: z.string().describe("The space name"), tenantId: z.string().describe("The ID of the tenant to retrieve variables for"), variableType: z.enum(["all", "common", "project"]).describe("Type of variables to retrieve"), includeMissingVariables: z.boolean().optional().describe("Include missing variables in the response (for common/project types)") }, { title: "Get tenant variables from Octopus Deploy", readOnlyHint: true, }, async ({ spaceName, tenantId, variableType, includeMissingVariables = false }) => { const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const tenantRepository = new TenantRepository(client, spaceName); let variables; switch (variableType) { case "all": { const tenant = await tenantRepository.get(tenantId); variables = await tenantRepository.getVariables(tenant); break; } case "common": variables = await tenantRepository.getCommonVariablesById(tenantId, includeMissingVariables); break; case "project": variables = await tenantRepository.getProjectVariablesById(tenantId, includeMissingVariables); break; } return { content: [ { type: "text", text: JSON.stringify({ tenantId, variableType, includeMissingVariables, variables }), }, ], }; } ); }
- src/tools/getTenantVariables.ts:64-68 (registration)Calls registerToolDefinition to add the tool to TOOL_REGISTRY with metadata (toolName, config: toolset 'tenants', readOnly true), linking to the register function.registerToolDefinition({ toolName: "get_tenant_variables", config: { toolset: "tenants", readOnly: true }, registerFn: registerGetTenantVariablesTool, });