Skip to main content
Glama
huiseo
by huiseo

find_related

Discover semantically related documents in Outline wiki to expand research or find connected content.

Instructions

Find documents semantically related to a specific document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentIdYes
limitNo

Implementation Reference

  • The core handler function for the 'find_related' tool. Fetches the target document content, performs semantic search using brain.search on title + first 500 chars of text, filters out the source document by ID prefix, and returns document info with list of related docs including 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: requires 'documentId' string and optional 'limit' number (defaults to 5, min 1 max 100).
    export const findRelatedSchema = z.object({
      documentId,
      limit: limit.default(5).optional(),
    });
  • Schema registered in toolSchemas map at line 248: find_related: findRelatedSchema
    export const findRelatedSchema = z.object({
      documentId,
      limit: limit.default(5).optional(),
    });
  • Tool definition registered in allTools array, specifying name 'find_related', description, and schema reference 'find_related' (which maps to findRelatedSchema).
    createTool(
      'find_related',
      'Find documents semantically related to a specific document.',
      'find_related'
    ),
Behavior2/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 mentions 'semantically related,' hinting at content-based similarity, but lacks details on permissions, rate limits, output format, or whether it's a read-only operation. This is inadequate for a tool with potential behavioral complexities.

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 a single, clear sentence with no wasted words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse.

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

Completeness2/5

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

Given no annotations, 0% schema coverage, and no output schema, the description is incomplete. It doesn't cover behavioral aspects, parameter meanings, or return values, leaving significant gaps for a tool that likely involves complex semantic processing.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It implies 'documentId' identifies the target document and 'limit' controls result count, but doesn't explain semantics like what 'semantically related' means, how results are ordered, or any constraints. This adds minimal value beyond the bare schema.

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 verb 'find' and the resource 'documents semantically related to a specific document,' which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'search_documents' or 'get_document_backlinks,' which might also retrieve related documents, so it falls short of a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'search_documents' and 'get_document_backlinks,' there's no indication of whether this tool is for semantic similarity, backlinks, or other relations, leaving usage ambiguous.

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

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