Skip to main content
Glama
terrakube-io

Terrakube MCP Server

by terrakube-io

get-variable

Retrieve detailed information about a specific variable in Terrakube by providing the organization, workspace, and variable IDs for efficient infrastructure management.

Instructions

Retrieves detailed information about a specific variable

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationIdYesOrganization ID
variableIdYesVariable ID
workspaceIdYesWorkspace ID

Implementation Reference

  • The handler function for the 'get-variable' tool. It performs a GET request to the API to retrieve details of a specific variable identified by organizationId, workspaceId, and variableId, and returns the JSON data as text content.
    async ({ organizationId, workspaceId, variableId }) => {
      const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}/variable/${variableId}`, {
        headers: {
          Authorization: `Bearer ${CONFIG.patToken}`,
          "Content-Type": "application/vnd.api+json"
        }
      });
    
      if (!response.ok) {
        throw new Error(`Failed to get variable: ${response.statusText}`);
      }
    
      const data = await response.json();
      return {
        content: [{
          type: "text",
          text: JSON.stringify(data, null, 2)
        }]
      };
    }
  • Input schema for the 'get-variable' tool, defining required string parameters: organizationId, workspaceId, and variableId using Zod.
    {
      organizationId: z.string().describe("Organization ID"),
      workspaceId: z.string().describe("Workspace ID"),
      variableId: z.string().describe("Variable ID")
    },
  • Registration of the 'get-variable' tool on the MCP server instance via server.tool(), specifying the tool name, description, input schema, and inline handler function.
    server.tool(
      "get-variable",
      "Retrieves detailed information about a specific variable",
      {
        organizationId: z.string().describe("Organization ID"),
        workspaceId: z.string().describe("Workspace ID"),
        variableId: z.string().describe("Variable ID")
      },
      async ({ organizationId, workspaceId, variableId }) => {
        const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}/variable/${variableId}`, {
          headers: {
            Authorization: `Bearer ${CONFIG.patToken}`,
            "Content-Type": "application/vnd.api+json"
          }
        });
    
        if (!response.ok) {
          throw new Error(`Failed to get variable: ${response.statusText}`);
        }
    
        const data = await response.json();
        return {
          content: [{
            type: "text",
            text: JSON.stringify(data, null, 2)
          }]
        };
      }
    );
Install Server

Other Tools

Related 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/terrakube-io/mcp-server-terrakube'

If you have feedback or need assistance with the MCP directory API, please join our Discord server