Files
outline-mcp/src/tools/collection.ts
Timo Behrendt e2081a19b5
All checks were successful
CD / test (push) Successful in 21s
CD / Check changes (push) Successful in 31s
CD / Build and push (amd64) (push) Successful in 47s
CD / Build and push (arm64) (push) Successful in 3m6s
CD / Create manifest (push) Successful in 55s
initial-commit (#1)
Reviewed-on: #1
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2025-07-16 07:21:12 +02:00

29 lines
940 B
TypeScript

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { handleSuccess, handleError } from "./utils";
import type { ToolsFactory } from "./toolsFactory";
import type { CollectionsApi } from "../gen/api/outline";
import type { Logger } from "pino";
export const registerCollectionTools: ToolsFactory<CollectionsApi> = (server: McpServer, client: CollectionsApi, logger: Logger) => {
server.registerTool(
"collections_list",
{
title: "List Collections",
description: "List all collections in the Outline workspace",
inputSchema: {},
},
async () => {
try {
const response = await client.collectionsList();
return handleSuccess(response, logger.child({ tool: "collections_list" }));
} catch (err) {
const error = handleError(err, logger.child({ tool: "collections_list" }));
logger.error(error);
return error;
}
}
);
};