Skip to main content
Glama
terrakube-io

Terrakube MCP Server

by terrakube-io

create-variable

Add a new variable to a specified workspace in Terrakube MCP Server. Define key, value, category, and sensitivity to manage infrastructure configurations effectively.

Instructions

Creates a new variable in the specified workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoVariable category (e.g., terraform, environment)
descriptionNoVariable description
keyYesVariable key
organizationIdYesOrganization ID
sensitiveNoWhether the variable is sensitive
valueYesVariable value
workspaceIdYesWorkspace ID

Implementation Reference

  • The async handler function that executes the 'create-variable' tool logic by sending a POST request to create a new variable in the Terrakube workspace.
    async ({ organizationId, workspaceId, key, value, description, category, sensitive }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}/variable`, { method: "POST", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: JSON.stringify({ data: { type: "variable", attributes: { key, value, description, category, sensitive } } }) }); if (!response.ok) { throw new Error(`Failed to create variable: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
  • Zod schema defining the input parameters for the 'create-variable' tool.
    { organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID"), key: z.string().describe("Variable key"), value: z.string().describe("Variable value"), description: z.string().optional().describe("Variable description"), category: z.string().optional().describe("Variable category (e.g., terraform, environment)"), sensitive: z.boolean().optional().describe("Whether the variable is sensitive") },
  • The server.tool() call that registers the 'create-variable' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool( "create-variable", "Creates a new variable in the specified workspace", { organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID"), key: z.string().describe("Variable key"), value: z.string().describe("Variable value"), description: z.string().optional().describe("Variable description"), category: z.string().optional().describe("Variable category (e.g., terraform, environment)"), sensitive: z.boolean().optional().describe("Whether the variable is sensitive") }, async ({ organizationId, workspaceId, key, value, description, category, sensitive }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}/variable`, { method: "POST", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: JSON.stringify({ data: { type: "variable", attributes: { key, value, description, category, sensitive } } }) }); if (!response.ok) { throw new Error(`Failed to create variable: ${response.statusText}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );
  • src/index.ts:25-25 (registration)
    Call to registerVariableTools which includes the 'create-variable' tool registration on 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