Skip to main content
Glama

anytype_search_objects

Search for objects across all spaces or a specific space in the Anytype MCP Server. Filter results by type or limit quantity using customizable query parameters.

Instructions

Busca objetos en todos los espacios o en un espacio específico

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoLímite de resultados (default: 20)
queryNoTexto a buscar
space_idNoID del espacio específico (opcional)
typesNoTipos de objetos a filtrar (ej: ["page", "note"])

Implementation Reference

  • The main handler function `handleSearchObjects` that implements the core logic of the tool. It constructs appropriate Anytype API search endpoints (global /v1/search or space-specific /v1/spaces/{id}/search), builds the request body with query, sort, and optional types filter, and returns the API response formatted as MCP content.
    export async function handleSearchObjects(args: any) { const { space_id, query, types, limit = 20, offset = 0 } = args; let endpoint; let requestBody: any; if (space_id) { // Search within a specific space - using correct API v1 endpoint endpoint = `/v1/spaces/${space_id}/search?offset=${offset}&limit=${limit}`; // For space search, use property_key according to API docs requestBody = { query: query || '', sort: { direction: 'desc', property_key: 'last_modified_date' } }; // Add types filter if provided (no prefix needed for space search) if (types && types.length > 0) { requestBody.types = types; } } else { // Global search across all spaces - using correct API v1 endpoint endpoint = `/v1/search?offset=${offset}&limit=${limit}`; // For global search, use property_key according to API docs requestBody = { query: query || '', sort: { direction: 'desc', property_key: 'last_modified_date' } }; // Add types filter if provided if (types && types.length > 0) { requestBody.types = types; } } const response = await makeRequest(endpoint, { method: 'POST', body: JSON.stringify(requestBody), }); return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] }; }
  • The tool schema definition including name, description, and inputSchema with properties for query (required string), space_id (optional), types (optional array), and limit (optional number with default).
    name: 'anytype_search_objects', description: 'Busca objetos en todos los espacios o en un espacio específico', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Texto a buscar' }, space_id: { type: 'string', description: 'ID del espacio específico (opcional)' }, types: { type: 'array', items: { type: 'string' }, description: 'Tipos de objetos a filtrar' }, limit: { type: 'number', description: 'Límite de resultados', default: 20 }, }, }, },
  • src/index.ts:122-123 (registration)
    The switch case in the main CallToolRequestHandler that registers and dispatches calls to the 'anytype_search_objects' tool by invoking the handleSearchObjects handler function.
    case 'anytype_search_objects': return await handleSearchObjects(args);

Other Tools

Related 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/cryptonahue/mcp-anytype'

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