edit-workspace
Modify workspace details such as name, Terraform version, VCS provider, repository URL, and description in the Terrakube MCP Server for streamlined infrastructure management.
Instructions
Updates an existing workspace's details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | New workspace description | |
| name | No | New workspace name | |
| organizationId | Yes | Organization ID | |
| terraformVersion | No | New Terraform version | |
| vcsProvider | No | New VCS provider | |
| vcsRepo | No | New VCS repository URL | |
| workspaceId | Yes | Workspace ID |
Implementation Reference
- src/tools/workspaces.ts:121-153 (handler)The async handler function for the 'edit-workspace' tool that performs a PATCH request to the API to update the workspace details.async ({ organizationId, workspaceId, name, description, terraformVersion, vcsProvider, vcsRepo }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}`, { method: "PATCH", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: JSON.stringify({ data: { type: "workspace", id: workspaceId, attributes: { name, description, terraformVersion, vcsProvider, vcsRepo } } }) }); if (response.status === 204) { return { content: [{ type: "text", text: "Workspace updated successfully" }] }; } else { throw new Error(`Failed to update workspace: ${response.statusText}`); } }
- src/tools/workspaces.ts:112-120 (schema)Zod input schema defining parameters for the 'edit-workspace' tool, including organizationId, workspaceId, and optional attributes to update.{ organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID"), name: z.string().optional().describe("New workspace name"), description: z.string().optional().describe("New workspace description"), terraformVersion: z.string().optional().describe("New Terraform version"), vcsProvider: z.string().optional().describe("New VCS provider"), vcsRepo: z.string().optional().describe("New VCS repository URL") },
- src/tools/workspaces.ts:109-154 (registration)The server.tool() call that registers the 'edit-workspace' tool with its name, description, input schema, and handler function.server.tool( "edit-workspace", "Updates an existing workspace's details", { organizationId: z.string().describe("Organization ID"), workspaceId: z.string().describe("Workspace ID"), name: z.string().optional().describe("New workspace name"), description: z.string().optional().describe("New workspace description"), terraformVersion: z.string().optional().describe("New Terraform version"), vcsProvider: z.string().optional().describe("New VCS provider"), vcsRepo: z.string().optional().describe("New VCS repository URL") }, async ({ organizationId, workspaceId, name, description, terraformVersion, vcsProvider, vcsRepo }) => { const response = await fetch(`${CONFIG.apiUrl}/organization/${organizationId}/workspace/${workspaceId}`, { method: "PATCH", headers: { Authorization: `Bearer ${CONFIG.patToken}`, "Content-Type": "application/vnd.api+json" }, body: JSON.stringify({ data: { type: "workspace", id: workspaceId, attributes: { name, description, terraformVersion, vcsProvider, vcsRepo } } }) }); if (response.status === 204) { return { content: [{ type: "text", text: "Workspace updated successfully" }] }; } else { throw new Error(`Failed to update workspace: ${response.statusText}`); } } );