Skip to main content
Glama
huiseo
by huiseo

summarize_document

Generate AI-powered summaries of Outline wiki documents to quickly extract key information and understand content.

Instructions

Generate an AI-powered summary of a document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentIdYes
languageNo

Implementation Reference

  • The core handler function that implements the summarize_document tool logic: checks if brain is enabled, fetches the full document content via Outline API, and generates a summary using the brain module.
    async summarize_document(args: { documentId: string; language?: string }) {
      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_SUMMARIZE };
      }
    
      const summary = await brain.summarize(data.text, args.language);
    
      return {
        documentId: data.id,
        title: data.title,
        summary,
      };
    },
  • Zod schema defining the input parameters for the summarize_document tool: documentId (required) and language (optional).
    export const summarizeDocumentSchema = z.object({
      documentId,
      language: z.string().optional(),
    });
  • Registers the tool definition for MCP, including name, description, and conversion of Zod schema to JSON schema.
    createTool(
      'summarize_document',
      'Generate an AI-powered summary of a document.',
      'summarize_document'
    ),
  • Combines all handlers, including smart handlers (which contain summarize_document), into a single ToolHandlers object for use in MCP.
    export function createAllHandlers(ctx: AppContext): ToolHandlers {
      return {
        ...createSearchHandlers(ctx),
        ...createDocumentHandlers(ctx),
        ...createCollectionHandlers(ctx),
        ...createCommentHandlers(ctx),
        ...createBatchHandlers(ctx),
        ...createSmartHandlers(ctx),
      } as ToolHandlers;
    }

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