Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

get_variables

Read-only

Retrieve project variables and shared library variable sets for Octopus Deploy projects to manage configuration data across deployments.

Instructions

This tool gets all project and library variable set variables for a given project. Projects can contain variables (specific to a project), library variable sets (shared collections of variables associated with many projects), and tenant variables (variables related to a tenants connected to the project) If you want to retrieve tenant variables for a tenant connected to the project, use the get_tenant_variables tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYesThe space name
projectIdYesThe ID of the project to retrieve the variables for
gitRefNoThe gitRef to retrieve the variables from, if the project is a config-as-code project

Implementation Reference

  • The inline handler function for the "get_variables" MCP tool. It initializes the Octopus Deploy client, resolves the space ID, retrieves all variables using getAllVariables helper, and formats the response as MCP text content with JSON.
    async ({ spaceName, projectId, gitRef }) => {
    
        const configuration = getClientConfigurationFromEnvironment();
        const client = await Client.create(configuration);
        const spaceId = await resolveSpaceId(client, spaceName);
    
        const variables = await getAllVariables({
            projectId: projectId,
            spaceName: spaceName,
            spaceId: spaceId,
            gitRef: gitRef
        }, client)
    
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify({
                        variables
                    }),
                },
            ],
        };
    }
  • Registers the "get_variables" tool on the MCP server, providing the tool name, description, Zod input schema, output metadata, and the handler function.
    export function registerGetVariablesTool(server: McpServer) {
        server.tool(
            "get_variables",
            `This tool gets all project and library variable set variables for a given project. 
            Projects can contain variables (specific to a project), library variable sets (shared collections of variables associated with many projects), 
            and tenant variables (variables related to a tenants connected to the project)
            If you want to retrieve tenant variables for a tenant connected to the project, use the get_tenant_variables tool.
            `,
            {
                spaceName: z.string().describe("The space name"),
                projectId: z.string().describe("The ID of the project to retrieve the variables for"),
                gitRef: z.string().describe("The gitRef to retrieve the variables from, if the project is a config-as-code project").optional(),
            },
            {
                title: "Get variables for a Project from Octopus Deploy",
                readOnlyHint: true,
            },
            async ({ spaceName, projectId, gitRef }) => {
    
                const configuration = getClientConfigurationFromEnvironment();
                const client = await Client.create(configuration);
                const spaceId = await resolveSpaceId(client, spaceName);
    
                const variables = await getAllVariables({
                    projectId: projectId,
                    spaceName: spaceName,
                    spaceId: spaceId,
                    gitRef: gitRef
                }, client)
    
                return {
                    content: [
                        {
                            type: "text",
                            text: JSON.stringify({
                                variables
                            }),
                        },
                    ],
                };
            }
        );
    }
  • Zod schema defining the input parameters for the get_variables tool: required spaceName and projectId, optional gitRef.
    {
        spaceName: z.string().describe("The space name"),
        projectId: z.string().describe("The ID of the project to retrieve the variables for"),
        gitRef: z.string().describe("The gitRef to retrieve the variables from, if the project is a config-as-code project").optional(),
    },
  • Helper function that orchestrates fetching the project's variable set and associated library variable sets using Octopus Deploy repositories and API calls.
    export async function getAllVariables(
        params: GetAllVariablesParams,
        apiClient: Client
    ): Promise<AllVariablesForProject> {
    
        const { spaceId, spaceName, gitRef, projectId } = params;
    
        const projectRepository = new ProjectRepository(apiClient, spaceName);
        const project = await projectRepository.get(projectId);
        const projectVariableSet = await loadProjectVariableSet(project, gitRef, apiClient, spaceId);
        const libraryVariableSets = await loadLibraryVariableSetVariables(project.IncludedLibraryVariableSetIds, apiClient, spaceId);
    
        return {
            projectVariableSet,
            libraryVariableSets
        };
    }
  • Self-registration of the get_variables tool into the global TOOL_REGISTRY, enabling conditional registration via src/tools/index.ts.
    registerToolDefinition({
        toolName: "get_variables",
        config: { toolset: "projects", readOnly: true },
        registerFn: registerGetVariablesTool,
    });
Behavior4/5

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

The description adds valuable context beyond the annotations: it explains the different types of variables (project-specific, library variable sets, tenant variables) and clarifies the scope of what's retrieved. While annotations already declare readOnlyHint=true, the description enhances understanding of what 'variables' means in this context without contradicting annotations.

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 efficiently structured in three sentences that each serve a distinct purpose: stating the tool's function, explaining variable types, and providing usage guidance. There's no wasted text, and the most important information (what the tool does) comes first.

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?

For a read-only tool with good annotations and full schema coverage, the description provides excellent context about variable types and tool boundaries. The only minor gap is the lack of output information (no output schema exists), but the description compensates well by clearly defining what 'variables' means in this system.

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?

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline expectation but doesn't provide extra value regarding parameter usage or semantics.

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 ('gets all project and library variable set variables') and resource ('for a given project'). It distinguishes from sibling tools by explicitly mentioning what it retrieves versus what get_tenant_variables retrieves, providing clear differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool versus alternatives: it specifies that this tool retrieves project and library variables, and explicitly directs users to use get_tenant_variables for tenant variables. This creates clear boundaries between sibling tools.

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