Skip to main content
Glama
huiseo

Outline Wiki MCP Server

by huiseo

sync_knowledge

Sync Outline wiki documents to a vector store to enable AI-powered search and retrieval for answering questions.

Instructions

Sync documents to vector store for AI-powered search. Run this before using ask_wiki.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionIdNo

Implementation Reference

  • The core handler function for the 'sync_knowledge' tool. It fetches documents from Outline (optionally filtered by collection), retrieves full content, and syncs them to the vector store (brain) for RAG.
    /**
     * Sync all documents to vector store for RAG
     *
     * Note: documents.list may return truncated or missing text,
     * so we fetch each document's full content via documents.info
     */
    async sync_knowledge(args: { collectionId?: string }) {
      if (!brain.isEnabled()) {
        return { error: ERROR_MESSAGES.SMART_FEATURES_DISABLED };
      }
    
      // Step 1: Fetch document list from Outline
      const payload: Record<string, unknown> = { limit: 100 };
      if (args.collectionId) {
        payload.collectionId = args.collectionId;
      }
    
      const { data: docList } = await apiCall(() =>
        apiClient.post<OutlineDocument[]>('/documents.list', payload)
      );
    
      if (!docList || docList.length === 0) {
        return { message: ERROR_MESSAGES.NO_DOCUMENTS_FOUND, synced: 0 };
      }
    
      // Step 2: Fetch full content for each document (list API may truncate text)
      const wikiDocs: WikiDocument[] = [];
      let fetchErrors = 0;
    
      for (const doc of docList) {
        try {
          const { data: fullDoc } = await apiCall(() =>
            apiClient.post<OutlineDocument>('/documents.info', { id: doc.id })
          );
    
          if (fullDoc && fullDoc.text) {
            wikiDocs.push({
              id: fullDoc.id,
              title: fullDoc.title,
              text: fullDoc.text,
              url: `${baseUrl}${fullDoc.url}`,
              collectionId: fullDoc.collectionId,
            });
          }
        } catch {
          fetchErrors++;
        }
      }
    
      if (wikiDocs.length === 0) {
        return {
          message: ERROR_MESSAGES.NO_DOCUMENTS_WITH_CONTENT,
          synced: 0,
          errors: fetchErrors,
        };
      }
    
      // Step 3: Sync to brain (vectorize)
      const result = await brain.syncDocuments(wikiDocs);
    
      return {
        message: `Successfully synced ${result.documents} documents (${result.chunks} chunks).`,
        documents: result.documents,
        chunks: result.chunks,
        skipped: docList.length - wikiDocs.length,
        errors: fetchErrors,
      };
    },
  • Zod schema defining the input for sync_knowledge: optional collectionId (UUID).
    export const syncKnowledgeSchema = z.object({
      collectionId: collectionId.optional(),
    });
  • MCP tool definition/registration for 'sync_knowledge', mapping to the Zod schema and providing description.
    createTool(
      'sync_knowledge',
      'Sync documents to vector store for AI-powered search. Run this before using ask_wiki.',
      'sync_knowledge'
    ),
  • Spreads the smart handlers (including sync_knowledge) into the main ToolHandlers object during handler creation.
    ...createSmartHandlers(ctx),
  • Entry in toolSchemas map that associates 'sync_knowledge' tool name with its Zod schema.
    sync_knowledge: syncKnowledgeSchema,
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the action 'sync' but doesn't describe what this entails operationally—whether it's a full or incremental sync, how long it takes, if it requires specific permissions, or what happens on failure. The mention of 'vector store' hints at AI infrastructure but lacks practical implementation details.

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 extremely concise with two sentences that directly state the tool's purpose and usage timing. Every word serves a clear function, and it's front-loaded with the core action. There's no wasted verbiage or redundancy.

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 the tool's complexity (syncing documents to a vector store for AI search), no annotations, no output schema, and poor parameter documentation, the description is insufficient. It doesn't explain what 'sync' entails operationally, what the vector store is, how to verify success, or error handling. The guidance to run before 'ask_wiki' is helpful but doesn't cover broader contextual needs.

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?

The input schema has 1 parameter with 0% description coverage, and the tool description provides no information about the 'collectionId' parameter. It doesn't explain what a collection is, how to obtain its ID, or whether syncing applies to all collections if omitted. The description fails to compensate for the schema's lack of parameter documentation.

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 'sync' and resource 'documents to vector store', specifying the purpose for 'AI-powered search'. It distinguishes from sibling 'ask_wiki' by indicating this is a prerequisite step, though it doesn't explicitly differentiate from other document/collection management tools like 'batch_create_documents' or 'update_collection'.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: 'before using ask_wiki'. This gives explicit timing guidance, but it doesn't mention when NOT to use it or alternatives for similar functionality, such as whether it's needed after document updates or if other tools handle incremental syncing.

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-smart-mcp'

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