Skip to main content
Glama
Qwinty
by Qwinty

get_object_content

Retrieve detailed content and metadata for a specific object in an Anytype space, including properties, relations, and optional formatted text content.

Instructions

Retrieves detailed content and metadata for a specific object in an Anytype space. This tool provides comprehensive information about an object including its properties, relations, and content. Use this tool when you need to examine a specific object's details after discovering its ID through the get_objects tool. The optional include_text parameter allows retrieving the full formatted text content of the object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
space_idYesSpace ID containing the object
object_idYesObject ID to retrieve
include_textNoSet to true to include full formatted text content from blocks

Implementation Reference

  • The async handler function for the get_object_content tool. It makes a GET request to the Anytype API to fetch the object details, handles nested response format, optionally extracts full text from blocks using extractFullText, and returns the formatted JSON response or error.
    async ({ space_id, object_id, include_text }) => {
      try {
        const response = await this.makeRequest(
          "get",
          `/spaces/${space_id}/objects/${object_id}`
        );
    
        // Handle new response format with nested 'object' property
        const responseData = response.data.object || response.data;
    
        // Если запрошен полный текст и есть блоки с содержимым
        if (
          include_text &&
          responseData &&
          responseData.blocks &&
          Array.isArray(responseData.blocks)
        ) {
          const fullText = this.extractFullText(responseData.blocks);
          if (fullText) {
            responseData.full_text = fullText;
          }
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(responseData, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleApiError(error);
      }
    }
  • Zod schema defining input parameters: space_id (required string), object_id (required string), include_text (optional boolean, default false).
    {
      space_id: z.string().describe("Space ID containing the object"),
      object_id: z.string().describe("Object ID to retrieve"),
      include_text: z
        .boolean()
        .optional()
        .default(false)
        .describe(
          "Set to true to include full formatted text content from blocks"
        ),
    },
  • src/index.ts:115-164 (registration)
    Registration of the get_object_content tool using this.server.tool(), including name, description, input schema, and handler function.
    this.server.tool(
      "get_object_content",
      "Retrieves detailed content and metadata for a specific object in an Anytype space. This tool provides comprehensive information about an object including its properties, relations, and content. Use this tool when you need to examine a specific object's details after discovering its ID through the get_objects tool. The optional include_text parameter allows retrieving the full formatted text content of the object.",
      {
        space_id: z.string().describe("Space ID containing the object"),
        object_id: z.string().describe("Object ID to retrieve"),
        include_text: z
          .boolean()
          .optional()
          .default(false)
          .describe(
            "Set to true to include full formatted text content from blocks"
          ),
      },
      async ({ space_id, object_id, include_text }) => {
        try {
          const response = await this.makeRequest(
            "get",
            `/spaces/${space_id}/objects/${object_id}`
          );
    
          // Handle new response format with nested 'object' property
          const responseData = response.data.object || response.data;
    
          // Если запрошен полный текст и есть блоки с содержимым
          if (
            include_text &&
            responseData &&
            responseData.blocks &&
            Array.isArray(responseData.blocks)
          ) {
            const fullText = this.extractFullText(responseData.blocks);
            if (fullText) {
              responseData.full_text = fullText;
            }
          }
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(responseData, null, 2),
              },
            ],
          };
        } catch (error) {
          return this.handleApiError(error);
        }
      }
    );
  • Helper function extractFullText used by the handler to extract and format full text content from object blocks into Markdown-like text when include_text is true.
    private extractFullText(blocks: any[]): string {
      if (!blocks || !Array.isArray(blocks)) {
        return "";
      }
    
      // Сопоставление стилей Anytype с текстовыми эквивалентами
      const styleMap: Record<string, { prefix: string; suffix: string }> = {
        Header1: { prefix: "# ", suffix: "\n\n" },
        Header2: { prefix: "## ", suffix: "\n\n" },
        Header3: { prefix: "### ", suffix: "\n\n" },
        Header4: { prefix: "#### ", suffix: "\n\n" },
        Paragraph: { prefix: "", suffix: "\n\n" },
        Marked: { prefix: "* ", suffix: "\n" }, // Маркированный список
        Checkbox: { prefix: "- [ ] ", suffix: "\n" }, // Чекбокс по умолчанию не отмечен
        Quote: { prefix: "> ", suffix: "\n\n" },
        Code: { prefix: "```\n", suffix: "\n```\n\n" }, // Блок кода
      };
    
      // Формирование отформатированного текста из блоков
      const textParts: string[] = [];
    
      blocks.forEach((block) => {
        if (block.text && typeof block.text.text === "string") {
          const style = block.text.style || "Paragraph";
          const isChecked = block.text.checked === true;
    
          // Получение форматирования для данного стиля
          let formatting = styleMap[style] || { prefix: "", suffix: "\n" };
    
          // Особая обработка для чекбоксов
          if (style === "Checkbox") {
            formatting = {
              prefix: isChecked ? "- [x] " : "- [ ] ",
              suffix: "\n",
            };
          }
    
          // Добавление форматированного текста
          textParts.push(
            `${formatting.prefix}${block.text.text}${formatting.suffix}`
          );
        }
      });
    
      return textParts.join("");
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes the tool as a retrieval operation (implied read-only) and mentions comprehensive information, but lacks details on permissions, rate limits, error conditions, or response format. It adds some context about the include_text parameter's effect, but overall behavioral disclosure is moderate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, followed by usage guidance and parameter clarification in two efficient sentences. Every sentence adds value without repetition or fluff, making it appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description does well by covering purpose, usage, and some parameter context. However, it lacks details on the return structure (e.g., what 'comprehensive information' includes) and error handling, which would be helpful for a retrieval tool with no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters. The description adds minimal value by clarifying that include_text retrieves 'full formatted text content from blocks,' which slightly expands on the schema's description. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieves') and resource ('detailed content and metadata for a specific object in an Anytype space'), specifying it provides comprehensive information including properties, relations, and content. It distinguishes from siblings like get_objects (which discovers IDs) and get_list_view_objects (which focuses on list views).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool: 'Use this tool when you need to examine a specific object's details after discovering its ID through the get_objects tool.' It provides a clear alternative (get_objects for discovery) and a prerequisite (needing an object ID first).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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