import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { createOutlineClient, handleSuccess, handleError } from "./utils"; // Register document tools export const registerDocumentTools = (server: McpServer) => { server.registerTool( "documents_list", { title: "List Documents", description: "List all documents in the Outline workspace", inputSchema: {}, }, async () => { try { const client = createOutlineClient(); const response = await client.documents.documentsList(); return handleSuccess(response); } catch (error) { return handleError(error); } } ); server.registerTool( "documents_info", { title: "Get Document Info", description: "Retrieve a specific document by its ID or share ID", inputSchema: { id: z.string().optional().describe("Document UUID or URL ID"), shareId: z.string().optional().describe("Document share ID"), }, }, async (args) => { try { const client = createOutlineClient(); const response = await client.documents.documentsInfo({ documentsInfoRequest: { id: args?.id, shareId: args?.shareId, }, }); return handleSuccess(response); } catch (error) { return handleError(error); } } ); };