add prototype

This commit is contained in:
2025-07-15 18:02:04 +02:00
parent 1b7889ba4c
commit 34d17a18af
5 changed files with 150 additions and 0 deletions

50
src/tools/document.ts Normal file
View File

@@ -0,0 +1,50 @@
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);
}
}
);
};