// Wrike Spaces Tools import { WrikeClient } from '../clients/wrike.js'; export function registerSpacesTools(client: WrikeClient) { return [ { name: 'wrike_list_spaces', description: 'List all accessible spaces', inputSchema: { type: 'object', properties: {}, }, handler: async () => { const spaces = await client.listSpaces(); return { spaces, count: spaces.length }; }, }, { name: 'wrike_get_space', description: 'Get details of a specific space', inputSchema: { type: 'object', properties: { spaceId: { type: 'string', description: 'Space ID', }, }, required: ['spaceId'], }, handler: async (args: any) => { const space = await client.getSpace(args.spaceId); return { space }; }, }, { name: 'wrike_create_space', description: 'Create a new space', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Space title', }, accessType: { type: 'string', description: 'Space access type', enum: ['Personal', 'Private', 'Public'], }, defaultProjectWorkflowId: { type: 'string', description: 'Default project workflow ID', }, defaultTaskWorkflowId: { type: 'string', description: 'Default task workflow ID', }, }, required: ['title'], }, handler: async (args: any) => { const space = await client.createSpace(args); return { space, message: 'Space created successfully' }; }, }, { name: 'wrike_update_space', description: 'Update an existing space', inputSchema: { type: 'object', properties: { spaceId: { type: 'string', description: 'Space ID', }, title: { type: 'string', description: 'New space title', }, accessType: { type: 'string', description: 'New access type', enum: ['Personal', 'Private', 'Public'], }, archived: { type: 'boolean', description: 'Archive status', }, }, required: ['spaceId'], }, handler: async (args: any) => { const { spaceId, ...updateData } = args; const space = await client.updateSpace(spaceId, updateData); return { space, message: 'Space updated successfully' }; }, }, { name: 'wrike_delete_space', description: 'Delete a space', inputSchema: { type: 'object', properties: { spaceId: { type: 'string', description: 'Space ID', }, }, required: ['spaceId'], }, handler: async (args: any) => { await client.deleteSpace(args.spaceId); return { message: 'Space deleted successfully', spaceId: args.spaceId }; }, }, ]; }