Skip to main content
Glama
Qwinty
by Qwinty

get_objects

Search and retrieve objects from an Anytype space with filtering and pagination. Find specific items by name or browse collections, optionally including full text content.

Instructions

Searches for and retrieves objects within a specified Anytype space. This tool allows you to list all objects or filter them using a search query. Results are paginated for better performance with large spaces. Use this tool to discover objects within a space, find specific objects by name, or browse through collections of objects. The optional include_text parameter allows retrieving the full formatted text content of objects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
space_idYesSpace ID to get objects from
offsetNoPagination offset
limitNoNumber of results per page (1-1000)
full_responseNoSet to true to get full unfiltered response
include_textNoSet to true to include full formatted text content from blocks

Implementation Reference

  • The async handler function that executes the get_objects tool logic: validates params, makes API GET request to /spaces/{space_id}/objects, optionally filters response data, and returns JSON-formatted content.
    async ({ space_id, offset, limit, full_response, include_text }) => {
      try {
        // Validate limit
        const validLimit = Math.max(1, Math.min(1000, limit));
    
        // Use the GET /objects endpoint
        const response = await this.makeRequest(
          "get",
          `/spaces/${space_id}/objects`,
          null, // No request body for GET
          { offset, limit: validLimit } // Pass offset and limit as query params
        );
    
        // Decide how to process the response data based on parameters
        let responseData;
        if (full_response) {
          // Return unfiltered data if full_response is true
          responseData = response.data;
        } else {
          // Filter the response data to remove unnecessary information
          responseData = this.filterObjectsData(response.data, include_text);
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(responseData, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.handleApiError(error);
      }
    }
  • Zod input schema defining parameters for the get_objects tool: space_id (required), offset, limit, full_response, include_text.
      space_id: z.string().describe("Space ID to get objects from"),
      offset: z.number().optional().default(0).describe("Pagination offset"),
      limit: z
        .number()
        .optional()
        .default(100)
        .describe("Number of results per page (1-1000)"),
      full_response: z
        .boolean()
        .optional()
        .default(false)
        .describe("Set to true to get full unfiltered response"),
      include_text: z
        .boolean()
        .optional()
        .default(false)
        .describe(
          "Set to true to include full formatted text content from blocks"
        ),
    },
  • src/index.ts:53-112 (registration)
    MCP server tool registration call for 'get_objects', including name, description, input schema, and inline handler function.
    this.server.tool(
      "get_objects",
      "Searches for and retrieves objects within a specified Anytype space. This tool allows you to list all objects or filter them using a search query. Results are paginated for better performance with large spaces. Use this tool to discover objects within a space, find specific objects by name, or browse through collections of objects. The optional include_text parameter allows retrieving the full formatted text content of objects.",
      {
        space_id: z.string().describe("Space ID to get objects from"),
        offset: z.number().optional().default(0).describe("Pagination offset"),
        limit: z
          .number()
          .optional()
          .default(100)
          .describe("Number of results per page (1-1000)"),
        full_response: z
          .boolean()
          .optional()
          .default(false)
          .describe("Set to true to get full unfiltered response"),
        include_text: z
          .boolean()
          .optional()
          .default(false)
          .describe(
            "Set to true to include full formatted text content from blocks"
          ),
      },
      async ({ space_id, offset, limit, full_response, include_text }) => {
        try {
          // Validate limit
          const validLimit = Math.max(1, Math.min(1000, limit));
    
          // Use the GET /objects endpoint
          const response = await this.makeRequest(
            "get",
            `/spaces/${space_id}/objects`,
            null, // No request body for GET
            { offset, limit: validLimit } // Pass offset and limit as query params
          );
    
          // Decide how to process the response data based on parameters
          let responseData;
          if (full_response) {
            // Return unfiltered data if full_response is true
            responseData = response.data;
          } else {
            // Filter the response data to remove unnecessary information
            responseData = this.filterObjectsData(response.data, include_text);
          }
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(responseData, null, 2),
              },
            ],
          };
        } catch (error) {
          return this.handleApiError(error);
        }
      }
    );
  • Helper method filterObjectsData used by get_objects to simplify and optionally include text in the API response data.
    private filterObjectsData(data: any, includeText: boolean = false): any {
      if (!data || !data.data || !Array.isArray(data.data)) {
        return data;
      }
    
      const filteredObjects = data.data.map((obj: any) => {
        // Create a simplified object with only essential information
        const simplified: any = {
          id: obj.id,
          type: obj.type,
          name: obj.name,
          icon: obj.icon,
          layout: obj.layout,
          space_id: obj.space_id,
          root_id: obj.root_id,
        };
    
        // Include snippet only if not requested full text
        if (!includeText) {
          simplified.snippet = obj.snippet;
        }
    
        // Process blocks data
        if (obj.blocks && Array.isArray(obj.blocks)) {
          simplified.blocks_count = obj.blocks.length;
    
          // Extract full text content if requested
          if (includeText) {
            const fullText = this.extractFullText(obj.blocks);
            if (fullText) {
              simplified.full_text = fullText;
            }
          }
        }
    
        // Include simplified details (dates and creator)
        if (obj.details && Array.isArray(obj.details)) {
          const dates: any = {};
          let created_by: any = null;
    
          obj.details.forEach((detail: any) => {
            if (detail.id === "created_date" && detail.details?.created_date) {
              dates.created_date = detail.details.created_date;
            }
            if (
              detail.id === "last_modified_date" &&
              detail.details?.last_modified_date
            ) {
              dates.last_modified_date = detail.details.last_modified_date;
            }
            if (
              detail.id === "last_opened_date" &&
              detail.details?.last_opened_date
            ) {
              dates.last_opened_date = detail.details.last_opened_date;
            }
            if (detail.id === "tags" && detail.details?.tags) {
              simplified.tags = detail.details.tags;
            }
            // Добавление информации о создателе
            if (detail.id === "created_by" && detail.details?.details) {
              created_by = {
                name: detail.details.details.name,
                identity: detail.details.details.identity,
                role: detail.details.details.role,
              };
            }
          });
    
          if (Object.keys(dates).length > 0) {
            simplified.dates = dates;
          }
    
          if (created_by) {
            simplified.created_by = created_by;
          }
        }
    
        return simplified;
      });
    
      // Return the filtered data with the same structure
      return {
        data: filteredObjects,
        pagination: data.pagination,
      };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It does reveal pagination behavior ('Results are paginated for better performance with large spaces') and mentions the include_text parameter's effect on content retrieval. However, it doesn't disclose important behavioral aspects like whether this is a read-only operation (implied but not stated), performance characteristics, error conditions, or authentication requirements.

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

Conciseness4/5

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

The description is appropriately sized at 4 sentences and front-loaded with the core purpose. However, the third sentence ('Use this tool to...') is somewhat redundant with the first two sentences, and the final sentence about include_text could be integrated more efficiently. Most sentences earn their place but could be tighter.

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

Completeness3/5

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

For a search/retrieval tool with 5 parameters, 100% schema coverage, but no annotations and no output schema, the description is adequate but has clear gaps. It covers the basic purpose and some behavioral aspects (pagination, include_text) but lacks information about return values, error handling, performance considerations, and explicit differentiation from similar search tools. The absence of an output schema increases the need for return value description.

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 5 parameters thoroughly. The description adds minimal value beyond the schema - it only mentions the include_text parameter's purpose ('allows retrieving the full formatted text content of objects'), which is already covered in the schema description. No additional syntax, format details, or parameter relationships are provided.

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

Purpose4/5

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

The description clearly states the tool's purpose as searching for and retrieving objects within a specified Anytype space, with specific verbs ('searches for', 'retrieves', 'list', 'filter', 'discover', 'find', 'browse'). It distinguishes from some siblings like create_object or delete_object but doesn't explicitly differentiate from similar search tools like search_space or global_search.

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

Usage Guidelines3/5

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

The description provides implied usage guidance ('Use this tool to discover objects within a space, find specific objects by name, or browse through collections of objects') but doesn't explicitly state when to use this tool versus alternatives like search_space or global_search. It mentions pagination for large spaces but lacks explicit when-not-to-use guidance or clear alternatives.

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