Skip to main content
Glama

find_related

Discover documents with similar content to a specific Outline wiki document using semantic analysis. Identify related information to enhance research and content organization.

Instructions

Find documents semantically related to a specific document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentIdYes
limitNo

Implementation Reference

  • The main handler function for the find_related tool. Fetches the target document content, performs semantic search via brain.search using title and first 500 chars of text, filters out the source document itself, and returns a list of related documents with title, URL, and excerpt.
    async find_related(args: { documentId: string; limit?: number }) { if (!brain.isEnabled()) { return { error: ERROR_MESSAGES.SMART_FEATURES_DISABLED }; } // Fetch document const { data } = await apiCall(() => apiClient.post<OutlineDocument>('/documents.info', { id: args.documentId }) ); if (!data.text) { return { error: ERROR_MESSAGES.NO_CONTENT_TO_ANALYZE }; } // Search for similar documents const results = await brain.search(data.title + ' ' + data.text.substring(0, 500), args.limit || 5); // Filter out the source document const related = results.filter((r) => !r.id.startsWith(args.documentId)); return { documentId: data.id, title: data.title, related: related.map((r) => ({ title: r.title, url: r.url, excerpt: r.text.substring(0, 200) + '...', })), }; },
  • Zod input schema for find_related tool, requiring documentId (string) and optional limit (number, default 5, 1-100).
    export const findRelatedSchema = z.object({ documentId, limit: limit.default(5).optional(), });
  • Registers the find_related tool in the allTools array for MCP, providing name, description, and schema reference used to generate JSON schema.
    createTool( 'find_related', 'Find documents semantically related to a specific document.', 'find_related' ),
  • TypeScript type definition for find_related input, inferred from the Zod schema.
    export type FindRelatedInput = z.infer<typeof findRelatedSchema>;
  • Maps the tool name 'find_related' to its Zod schema in the central toolSchemas record.
    find_related: findRelatedSchema,

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/huiseo/outline-smart-mcp'

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