Skip to main content
Glama
terrakube-io

Terrakube MCP Server

by terrakube-io

list-variables

Retrieve all variables in a specified workspace within Terrakube MCP Server, using organization and workspace IDs for accurate identification.

Instructions

Lists all variables in the specified workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationIdYesOrganization ID
workspaceIdYesWorkspace ID

Implementation Reference

  • The handler function that fetches the list of variables from the Terrakube API for the given organization and workspace, then returns the JSON data as formatted text content.
    async ({ organizationId, workspaceId }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}/variable`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to list variables: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );
  • Zod input schema defining the required parameters: organizationId and workspaceId.
    organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID") },
  • Registration of the 'list-variables' tool with the MCP server, including name, description, input schema, and handler function.
    server.tool( "list-variables", "Lists all variables in the specified workspace", { organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID") }, async ({ organizationId, workspaceId }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}/variable`, { headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" } }); if (!response.ok) { throw new Error(`Failed to list variables: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );
  • src/index.ts:25-25 (registration)
    Invocation of registerVariableTools which registers the 'list-variables' tool (among others) to the main MCP server instance.
    registerVariableTools(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