update_workspace
Update workspace properties including name, slug, description, default flag, or metadata by ID. Only changed fields apply immediately; verify slug dependencies before update.
Instructions
Update a workspace's name, slug, description, default flag, or metadata by id, unlike update_workspace_member which changes role assignments within a workspace. Only provided fields change and updates take effect immediately; changing the slug can break URLs, API key references, and other external links, so confirm no dependencies first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace_id | Yes | The workspace ID to update | |
| name | No | New name for the workspace | |
| slug | No | New slug for the workspace | |
| description | No | New description | |
| is_default | No | Set as default workspace (1 = yes, 0 = no) | |
| metadata | No | New metadata key-value pairs |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the tool call succeeded and returned structured data | |
| data | No | Structured success payload when ok is true | |
| error | No | Structured error payload when ok is false |
Implementation Reference
- src/tools/workspaces.tools.ts:50-63 (schema)Zod schema for the update_workspace tool, defining input params: workspace_id (required), name, slug, description, is_default, metadata (all optional).
updateWorkspace: { workspace_id: z.string().describe("The workspace ID to update"), name: z.string().optional().describe("New name for the workspace"), slug: z.string().optional().describe("New slug for the workspace"), description: z.string().optional().describe("New description"), is_default: z.coerce .number() .optional() .describe("Set as default workspace (1 = yes, 0 = no)"), metadata: z .record(z.string(), z.string()) .optional() .describe("New metadata key-value pairs"), }, - src/tools/workspaces.tools.ts:265-297 (registration)Registration of the 'update_workspace' tool via server.tool() with description and schema binding.
// Phase 1: Update workspace tool server.tool( "update_workspace", "Update a workspace's name, slug, description, default flag, or metadata by id, unlike update_workspace_member which changes role assignments within a workspace. Only provided fields change and updates take effect immediately; changing the slug can break URLs, API key references, and other external links, so confirm no dependencies first.", WORKSPACES_TOOL_SCHEMAS.updateWorkspace, async (params) => { const { workspace_id, is_default, metadata, ...rest } = params; // Build defaults object with only defined fields const defaults: Record<string, unknown> = {}; if (is_default !== undefined) defaults.is_default = is_default; if (metadata !== undefined) defaults.metadata = metadata; const workspace = await service.workspaces.updateWorkspace(workspace_id, { ...rest, ...(Object.keys(defaults).length > 0 ? { defaults } : {}), }); return { content: [ { type: "text", text: JSON.stringify( { message: "Successfully updated workspace", workspace: formatWorkspaceSummary(workspace), }, null, 2, ), }, ], }; }, ); - Service-level handler for updateWorkspace that makes a PUT request to /admin/workspaces/:id with the update data.
async updateWorkspace( workspaceId: string, data: UpdateWorkspaceRequest, ): Promise<Workspace> { return this.put<Workspace>( `/admin/workspaces/${this.encodePathSegment(workspaceId)}`, data, ); } - TypeScript interface defining the request body shape for updateWorkspace: all optional fields (name, slug, description, defaults).
export interface UpdateWorkspaceRequest { name?: string; slug?: string; description?: string; defaults?: { is_default?: number; metadata?: Record<string, string>; }; }