add_objects_to_list
Add objects to a specific list in an Anytype space by providing space ID, list ID, and object IDs.
Instructions
Adds one or more objects to a specific list in a space.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_id | Yes | Space ID containing the list | |
| list_id | Yes | List ID to add objects to | |
| object_ids | Yes | Array of object IDs to add |
Implementation Reference
- src/index.ts:584-611 (registration)Registration of the 'add_objects_to_list' MCP tool, including description, Zod input schema, and inline handler function that performs a POST request to the Anytype API to add objects to a list.
this.server.tool( "add_objects_to_list", "Adds one or more objects to a specific list in a space.", { space_id: z.string().describe("Space ID containing the list"), list_id: z.string().describe("List ID to add objects to"), object_ids: z.array(z.string()).describe("Array of object IDs to add"), }, async ({ space_id, list_id, object_ids }) => { try { const response = await this.makeRequest( "post", `/spaces/${space_id}/lists/${list_id}/objects`, object_ids ); return { content: [ { type: "text" as const, text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleApiError(error); } } ); - src/index.ts:592-610 (handler)Handler function that executes the tool logic: sends POST request with object_ids to /spaces/{space_id}/lists/{list_id}/objects endpoint and returns the API response.
async ({ space_id, list_id, object_ids }) => { try { const response = await this.makeRequest( "post", `/spaces/${space_id}/lists/${list_id}/objects`, object_ids ); return { content: [ { type: "text" as const, text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleApiError(error); } } - src/index.ts:587-591 (schema)Zod schema for tool inputs: space_id (string), list_id (string), object_ids (array of strings).
{ space_id: z.string().describe("Space ID containing the list"), list_id: z.string().describe("List ID to add objects to"), object_ids: z.array(z.string()).describe("Array of object IDs to add"), },