Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

Get tenant variables from Octopus Deploy

get_tenant_variables
Read-onlyIdempotent

Retrieve tenant variables filtered by type: all, common, or project-specific. Requires space name, tenant ID, and variable type.

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
spaceNameYesThe space name
tenantIdYesThe ID of the tenant to retrieve variables for
variableTypeYesType of variables to retrieve
includeMissingVariablesNoInclude missing variables in the response (for common/project types)

Implementation Reference

  • The main handler function for the 'get_tenant_variables' tool. It registers the tool with the MCP server, defines the input schema (spaceName, tenantId, variableType, includeMissingVariables), and executes the logic to retrieve tenant variables via TenantRepository based on the variableType ('all', 'common', or 'project').
    export function registerGetTenantVariablesTool(server: McpServer) {
      server.registerTool(
        "get_tenant_variables",
        {
          title: "Get tenant variables from Octopus Deploy",
          description: `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`,
          inputSchema: {
            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)")
          },
          annotations: READ_ONLY_TOOL_ANNOTATIONS,
        },
        async ({ spaceName, tenantId, variableType, includeMissingVariables = false }) => {
          validateEntityId(tenantId, 'tenant', ENTITY_PREFIXES.tenant);
    
          if (!variableType) {
            throw new Error(
              "Variable type is required. Valid values are: 'all', 'common', or 'project'. " +
              "'all' returns all variables, 'common' returns shared variables, 'project' returns project-specific variables."
            );
          }
    
          try {
            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;
              default:
                throw new Error(
                  `Invalid variable type '${variableType}'. Valid values are: 'all', 'common', or 'project'.`
                );
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify({
                    tenantId,
                    variableType,
                    includeMissingVariables,
                    variables
                  }),
                },
              ],
            };
          } catch (error) {
            handleOctopusApiError(error, {
              entityType: 'tenant',
              entityId: tenantId,
              spaceName
            });
          }
        }
      );
    }
  • Input schema definition using Zod for the get_tenant_variables tool. Parameters: spaceName (string), tenantId (string), variableType (enum: all/common/project), includeMissingVariables (optional boolean).
    inputSchema: {
      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)")
    },
    annotations: READ_ONLY_TOOL_ANNOTATIONS,
  • Self-registration of the tool in the global TOOL_REGISTRY map, categorizing it under the 'tenants' toolset as a read-only tool.
    registerToolDefinition({
      toolName: "get_tenant_variables",
      config: { toolset: "tenants", readOnly: true },
      registerFn: registerGetTenantVariablesTool,
    });
  • Import statement in the tools index file that triggers the self-registration of the get_tenant_variables tool when the module is loaded.
    import "./getTenantVariables.js";
  • Entity ID prefix constants used by validateEntityId, which is called in the handler to validate the tenantId starts with 'Tenants-'.
    export const ENTITY_PREFIXES = {
      task: "ServerTasks-",
      project: "Projects-",
      environment: "Environments-",
      tenant: "Tenants-",
      release: "Releases-",
      runbook: "Runbooks-",
      machine: "Machines-",
      certificate: "Certificates-",
      account: "Accounts-",
      deployment: "Deployments-",
      deploymentProcess: "DeploymentProcesses-",
      interruption: "Interruptions-",
      event: "Events-",
    } as const;
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, indicating a safe read. The description adds no additional behavioral traits beyond the schema's parameter details. It does not disclose what happens on missing tenants or other side effects.

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 two sentences and a bullet list. It front-loads the purpose and efficiently conveys the variable types. No unnecessary words.

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?

While the tool has no output schema, the description covers the core functionality and parameter choices well. It could mention the return format (list of variables) but is mostly complete for a read-only retrieval tool with strong annotations.

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 coverage is 100%, so baseline is 3. The description clarifies the variableType enum values but merely repeats schema information. It adds no new semantic meaning for other parameters like spaceName or tenantId.

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 tool retrieves tenant variables by type. It specifies the verb 'get' and the resource 'tenant variables', and the distinction from siblings like 'get_variables' and 'get_missing_tenant_variables' is evident.

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 explains when to use the tool (to retrieve specific types of tenant variables) and provides explicit guidance on the variableType parameter. However, it does not mention alternative tools for non-tenant scoped variables, but the context is clear.

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