delete_object
Permanently remove an object and all its content from an Anytype space. Verify the object ID before deletion as this action cannot be undone.
Instructions
Permanently removes an object from a specified Anytype space. This tool deletes the object and all its content. Use this tool with caution as deleted objects cannot be recovered. Always verify the object ID before deletion to avoid removing important content.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_id | Yes | Space ID containing the object | |
| object_id | Yes | Object ID to delete |
Implementation Reference
- src/index.ts:285-302 (handler)The async handler function that executes the delete_object tool by making a DELETE API request to the Anytype endpoint `/spaces/{space_id}/objects/{object_id}` and returning the response or handling errors.async ({ space_id, object_id }) => { try { const response = await this.makeRequest( "delete", `/spaces/${space_id}/objects/${object_id}` ); return { content: [ { type: "text" as const, text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleApiError(error); } }
- src/index.ts:281-284 (schema)Zod input schema validating the required parameters space_id and object_id for the delete_object tool.{ space_id: z.string().describe("Space ID containing the object"), object_id: z.string().describe("Object ID to delete"), },
- src/index.ts:278-303 (registration)The MCP server.tool() call that registers the delete_object tool with its name, description, input schema, and handler function.this.server.tool( "delete_object", "Permanently removes an object from a specified Anytype space. This tool deletes the object and all its content. Use this tool with caution as deleted objects cannot be recovered. Always verify the object ID before deletion to avoid removing important content.", { space_id: z.string().describe("Space ID containing the object"), object_id: z.string().describe("Object ID to delete"), }, async ({ space_id, object_id }) => { try { const response = await this.makeRequest( "delete", `/spaces/${space_id}/objects/${object_id}` ); return { content: [ { type: "text" as const, text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleApiError(error); } } );