Skip to main content
Glama

create_object

Create new objects like pages, notes, and tasks in your Anytype space with customizable names, types, descriptions, icons, and content using templates for structured creation.

Instructions

Creates a new object within a specified Anytype space. This tool allows you to add various types of content (pages, notes, tasks, etc.) to your spaces. You can specify the object's name, type, description, icon, and content. Optionally, you can use a template to create pre-structured objects. Use this tool when you need to add new content to an existing space.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
space_idYesSpace ID to create the object in
nameYesObject name
type_keyYesType key of object to create (e.g. 'ot-page')
descriptionNoObject's short description
iconNoObject icon details (structure based on API docs)
bodyNoObject body/content (Markdown supported)
template_idNoTemplate ID to use
sourceNoSource URL (for bookmarks)

Implementation Reference

  • The core handler function for the create_object tool. Constructs the object payload conditionally and sends a POST request to the Anytype API endpoint `/spaces/{space_id}/objects`. Returns the API response or handles errors.
    space_id, name, type_key, description, icon, body, template_id, source, }) => { try { const createObj: any = { name, type_key, }; if (description) createObj.description = description; if (icon) createObj.icon = icon; if (body) createObj.body = body; if (template_id) createObj.template_id = template_id; if (source) createObj.source = source; const response = await this.makeRequest( "post", `/spaces/${space_id}/objects`, createObj ); return { content: [ { type: "text" as const, text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleApiError(error); } }
  • Zod input schema for the create_object tool, validating required fields like space_id, name, type_key and optional fields for description, icon, body, template, and source.
    { space_id: z.string().describe("Space ID to create the object in"), name: z.string().describe("Object name"), type_key: z .string() .describe("Type key of object to create (e.g. 'ot-page')"), description: z .string() .optional() .describe("Object's short description"), icon: z .object({ format: z .enum(["emoji", "file", "icon"]) .describe("Icon format (required if icon is provided)"), emoji: z .string() .optional() .describe("Emoji character (if format is 'emoji')"), file: z .string() .url() .optional() .describe("URL to the icon file (if format is 'file')"), name: z .string() .optional() .describe("Name of the built-in icon (if format is 'icon')"), color: z .string() .optional() .describe("Color of the icon (optional)"), }) .optional() .describe("Object icon details (structure based on API docs)"), body: z .string() .optional() .describe("Object body/content (Markdown supported)"), template_id: z.string().optional().describe("Template ID to use"), source: z.string().optional().describe("Source URL (for bookmarks)"), }, async ({
  • src/index.ts:191-275 (registration)
    Registration of the create_object tool on the MCP server using this.server.tool(), including name, description, schema, and handler.
    this.server.tool( "create_object", "Creates a new object within a specified Anytype space. This tool allows you to add various types of content (pages, notes, tasks, etc.) to your spaces. You can specify the object's name, type, description, icon, and content. Optionally, you can use a template to create pre-structured objects. Use this tool when you need to add new content to an existing space.", { space_id: z.string().describe("Space ID to create the object in"), name: z.string().describe("Object name"), type_key: z .string() .describe("Type key of object to create (e.g. 'ot-page')"), description: z .string() .optional() .describe("Object's short description"), icon: z .object({ format: z .enum(["emoji", "file", "icon"]) .describe("Icon format (required if icon is provided)"), emoji: z .string() .optional() .describe("Emoji character (if format is 'emoji')"), file: z .string() .url() .optional() .describe("URL to the icon file (if format is 'file')"), name: z .string() .optional() .describe("Name of the built-in icon (if format is 'icon')"), color: z .string() .optional() .describe("Color of the icon (optional)"), }) .optional() .describe("Object icon details (structure based on API docs)"), body: z .string() .optional() .describe("Object body/content (Markdown supported)"), template_id: z.string().optional().describe("Template ID to use"), source: z.string().optional().describe("Source URL (for bookmarks)"), }, async ({ space_id, name, type_key, description, icon, body, template_id, source, }) => { try { const createObj: any = { name, type_key, }; if (description) createObj.description = description; if (icon) createObj.icon = icon; if (body) createObj.body = body; if (template_id) createObj.template_id = template_id; if (source) createObj.source = source; const response = await this.makeRequest( "post", `/spaces/${space_id}/objects`, createObj ); return { content: [ { type: "text" as const, text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleApiError(error); } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Qwinty/anytype-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server