Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

get_tenant_variables

Retrieve tenant variables from Octopus Deploy by type - all variables, common variables, 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
NameRequiredDescriptionDefault
includeMissingVariablesNoInclude missing variables in the response (for common/project types)
spaceNameYesThe space name
tenantIdYesThe ID of the tenant to retrieve variables for
variableTypeYesType of variables to retrieve

Implementation Reference

  • The handler function that implements the core logic of the 'get_tenant_variables' tool. It connects to the Octopus Deploy client, fetches tenant variables based on the specified type ('all', 'common', or 'project'), and returns them as JSON.
    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 schema defining the input parameters for the tool: 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)") },
  • The primary registration function for the 'get_tenant_variables' tool using server.tool(), including name, description, schema, hints, 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 }), }, ], }; } ); }
  • Registers the tool metadata to the TOOL_REGISTRY, specifying toolset 'tenants' and readOnly true, linking to the register function.
    registerToolDefinition({ toolName: "get_tenant_variables", config: { toolset: "tenants", readOnly: true }, registerFn: registerGetTenantVariablesTool, });

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