anytype_create_property
Add custom properties to objects in Anytype by defining key, name, type, and format to organize and structure data within your workspace.
Instructions
Crea una nueva propiedad
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_id | Yes | ID del espacio | |
| key | No | Clave única de la propiedad | |
| name | Yes | Nombre de la propiedad | |
| type | Yes | Tipo de propiedad | |
| description | No | Descripción | |
| format | No | Formato específico | |
| source_object | No | ID del objeto fuente | |
| read_only_value | No | Solo lectura |
Implementation Reference
- src/handlers/properties.ts:55-102 (handler)The handler function that implements the tool logic: validates inputs (space_id, name, type), constructs the request body, and makes a POST request to the Anytype API to create the property.export async function handleCreateProperty(args: any) { const { space_id, name, type, format, description, source_object, read_only_value = false, key, ...propertyData } = args; if (!space_id) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'Missing required parameter', message: 'Field "space_id" is required for creating a property', provided_parameters: Object.keys(args) }, null, 2) }] }; } // Validate required fields based on official API docs if (!name || !type) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'Missing required fields', message: 'Both "name" and "type" are required for creating a property', required_fields: ['name', 'type'], provided_fields: Object.keys(args) }, null, 2) }] }; } const requestBody = { name, type, format: format || type, // Format defaults to type if not provided description, source_object, read_only_value, key, // Optional unique key ...propertyData }; const response = await makeRequest(`/v1/spaces/${space_id}/properties`, { method: 'POST', body: JSON.stringify(requestBody), }); return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] }; }
- src/tools/properties.ts:32-49 (schema)Defines the input schema and metadata for the 'anytype_create_property' tool, specifying parameters, descriptions, and required fields.{ name: 'anytype_create_property', description: 'Crea una nueva propiedad', inputSchema: { type: 'object', properties: { space_id: { type: 'string', description: 'ID del espacio' }, key: { type: 'string', description: 'Clave única de la propiedad' }, name: { type: 'string', description: 'Nombre de la propiedad' }, type: { type: 'string', description: 'Tipo de propiedad' }, description: { type: 'string', description: 'Descripción' }, format: { type: 'string', description: 'Formato específico' }, source_object: { type: 'string', description: 'ID del objeto fuente' }, read_only_value: { type: 'boolean', description: 'Solo lectura' }, }, required: ['space_id', 'name', 'type'], }, },
- src/index.ts:140-141 (registration)Registers the tool in the main request handler switch statement, dispatching calls to the handleCreateProperty function.case 'anytype_create_property': return await handleCreateProperty(args);
- src/index.ts:88-88 (registration)Includes the propertyTools array (containing the tool definition) in the combined list of all available tools for the MCP server....propertyTools,