edit-module
Modify module details like name, description, provider, and registry URL in the Terrakube MCP Server to ensure accurate infrastructure management.
Instructions
Updates an existing module's details
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | New module description | |
| moduleId | Yes | Module ID | |
| name | No | New module name | |
| organizationId | Yes | Organization ID | |
| provider | No | New provider name | |
| registry | No | New registry URL |
Implementation Reference
- src/tools/modules.ts:122-153 (handler)Handler function for the 'edit-module' tool. Performs a PATCH request to the API to update the specified module's attributes (name, description, registry, provider) in the given organization.
async ({ organizationId, moduleId, name, description, registry, provider }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/module/${moduleId}`, { method: "PATCH", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: JSON.stringify({ data: { type: "module", id: moduleId, attributes: { name, description, registry, provider } } }) }); if (response.status === 204) { return { content: [{ type: "text", text: "Module updated successfully" }] }; } else { throw new Error(`Failed to update module: ${response.statusText}`); } } - src/tools/modules.ts:114-121 (schema)Zod input schema for the 'edit-module' tool, defining required organizationId and moduleId, and optional updatable fields.
{ organizationId: z.string().describe("Organization ID"), moduleId: z.string().describe("Module ID"), name: z.string().optional().describe("New module name"), description: z.string().optional().describe("New module description"), registry: z.string().optional().describe("New registry URL"), provider: z.string().optional().describe("New provider name") }, - src/tools/modules.ts:111-154 (registration)Direct registration of the 'edit-module' tool using server.tool(), including name, description, input schema, and handler function.
server.tool( "edit-module", "Updates an existing module's details", { organizationId: z.string().describe("Organization ID"), moduleId: z.string().describe("Module ID"), name: z.string().optional().describe("New module name"), description: z.string().optional().describe("New module description"), registry: z.string().optional().describe("New registry URL"), provider: z.string().optional().describe("New provider name") }, async ({ organizationId, moduleId, name, description, registry, provider }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/module/${moduleId}`, { method: "PATCH", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: JSON.stringify({ data: { type: "module", id: moduleId, attributes: { name, description, registry, provider } } }) }); if (response.status === 204) { return { content: [{ type: "text", text: "Module updated successfully" }] }; } else { throw new Error(`Failed to update module: ${response.statusText}`); } } );