anytype_create_space
Create a new workspace in Anytype to organize content and collaborate with team members using customizable names, descriptions, and icons.
Instructions
Crea un nuevo espacio
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Nombre del espacio | |
| description | No | Descripción del espacio | |
| icon | No | Icono |
Implementation Reference
- src/handlers/spaces.ts:36-83 (handler)The core handler function that implements the tool logic: validates required 'name' field, constructs API request body, performs POST to /v1/spaces, handles response with enhanced success message.export async function handleCreateSpace(args: any) { const { name, description, icon, ...spaceData } = args; // Validate required fields if (!name) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'Missing required field', message: 'Field "name" is required for creating a space', required_fields: ['name'], provided_fields: Object.keys(args) }, null, 2) }] }; } // Build request body according to API specification const requestBody = { name, description: description || '', // Optional but recommended icon: icon || null, // Optional icon ...spaceData }; const response = await makeRequest('/v1/spaces', { method: 'POST', body: JSON.stringify(requestBody), }); // Enhance response with verification if (response && response.space) { const enhancedResponse = { success: true, message: `Space "${name}" created successfully`, space: response.space, space_id: response.space.id, next_steps: [ 'Use the space_id to create objects, types, and properties in this space', 'Switch to this space using anytype_get_space if needed' ] }; return { content: [{ type: 'text', text: JSON.stringify(enhancedResponse, null, 2) }] }; } return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] }; }
- src/tools/spaces.ts:24-36 (schema)Tool definition including name, description, and input schema for validation (requires 'name', optional 'description' and 'icon').{ name: 'anytype_create_space', description: 'Crea un nuevo espacio', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Nombre del espacio' }, description: { type: 'string', description: 'Descripción del espacio' }, icon: iconSchema, }, required: ['name'], }, },
- src/index.ts:112-113 (registration)Registers the tool name in the main request handler switch statement, dispatching calls to the handleCreateSpace function.case 'anytype_create_space': return await handleCreateSpace(args);
- src/index.ts:96-100 (registration)Registers the list of all tools (including anytype_create_space from spaceTools) for the ListToolsRequestHandler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools, }; });