Skip to main content
Glama
terrakube-io

Terrakube MCP Server

by terrakube-io

edit-variable

Modify details of an existing variable in Terrakube MCP Server, including key, value, category, and sensitivity, to ensure accurate infrastructure configuration.

Instructions

Updates an existing variable's details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoNew variable category
descriptionNoNew variable description
keyNoNew variable key
organizationIdYesOrganization ID
sensitiveNoNew sensitive flag
valueNoNew variable value
variableIdYesVariable ID
workspaceIdYesWorkspace ID

Implementation Reference

  • Handler function that performs a PATCH request to the Terraform Cloud API to update the variable's attributes (key, value, description, category, sensitive). Returns success message on 204 or throws error.
    async ({ organizationId, workspaceId, variableId, key, value, description, category, sensitive }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}/variable/${variableId}`, { method: "PATCH", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: JSON.stringify({ data: { type: "variable", id: variableId, attributes: { key, value, description, category, sensitive } } }) }); if (response.status === 204) { return { content: [{ type: "text", text: "Variable updated successfully" }] }; } else { throw new Error(`Failed to update variable: ${response.statusText}`); } }
  • Zod input schema for the edit-variable tool, requiring organizationId, workspaceId, variableId, and allowing optional updates to key, value, description, category, sensitive.
    { organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID"), variableId: z.string().describe("Variable ID"), key: z.string().optional().describe("New variable key"), value: z.string().optional().describe("New variable value"), description: z.string().optional().describe("New variable description"), category: z.string().optional().describe("New variable category"), sensitive: z.boolean().optional().describe("New sensitive flag") },
  • Registration of the 'edit-variable' tool on the MCP server within the registerVariableTools function, specifying name, description, input schema, and handler implementation.
    server.tool( "edit-variable", "Updates an existing variable's details", { organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID"), variableId: z.string().describe("Variable ID"), key: z.string().optional().describe("New variable key"), value: z.string().optional().describe("New variable value"), description: z.string().optional().describe("New variable description"), category: z.string().optional().describe("New variable category"), sensitive: z.boolean().optional().describe("New sensitive flag") }, async ({ organizationId, workspaceId, variableId, key, value, description, category, sensitive }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}/variable/${variableId}`, { method: "PATCH", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: JSON.stringify({ data: { type: "variable", id: variableId, attributes: { key, value, description, category, sensitive } } }) }); if (response.status === 204) { return { content: [{ type: "text", text: "Variable updated successfully" }] }; } else { throw new Error(`Failed to update variable: ${response.statusText}`); } } );

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