This commit is contained in:
@@ -8,10 +8,19 @@ import tsPlugin from "typescript-eslint";
|
||||
|
||||
/** @type {import('eslint').Linter.Config[]} */
|
||||
export default [
|
||||
{
|
||||
ignores: [
|
||||
"node_modules/**",
|
||||
"dist/**",
|
||||
"build/**",
|
||||
"coverage/**",
|
||||
"*.min.js",
|
||||
"src/gen/**", // Exclude generated API files
|
||||
],
|
||||
},
|
||||
securityPlugin.configs.recommended,
|
||||
{
|
||||
files: ["**/*.ts"],
|
||||
ignores: ["src/gen/**"],
|
||||
files: ["src/**/*.ts"],
|
||||
},
|
||||
{
|
||||
languageOptions: { globals: globals.node },
|
||||
@@ -60,16 +69,7 @@ export default [
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
groups: [
|
||||
"builtin",
|
||||
"external",
|
||||
"internal",
|
||||
"parent",
|
||||
"sibling",
|
||||
"index",
|
||||
"object",
|
||||
"type",
|
||||
],
|
||||
groups: ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"],
|
||||
"newlines-between": "always",
|
||||
alphabetize: {
|
||||
order: "asc",
|
||||
|
||||
@@ -7,11 +7,7 @@ import { registerDocumentTools } from "./tools/document";
|
||||
|
||||
import type { Logger } from "pino";
|
||||
|
||||
const createOutlineClient = (
|
||||
baseUrl: string,
|
||||
apiKey: string,
|
||||
logger: Logger
|
||||
) => {
|
||||
const createOutlineClient = (baseUrl: string, apiKey: string, logger: Logger) => {
|
||||
const config = new Configuration({
|
||||
basePath: baseUrl,
|
||||
accessToken: () => Promise.resolve(apiKey),
|
||||
|
||||
@@ -6,11 +6,7 @@ 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
|
||||
) => {
|
||||
export const registerCollectionTools: ToolsFactory<CollectionsApi> = (server: McpServer, client: CollectionsApi, logger: Logger) => {
|
||||
server.registerTool(
|
||||
"collections_list",
|
||||
{
|
||||
@@ -21,15 +17,9 @@ export const registerCollectionTools: ToolsFactory<CollectionsApi> = (
|
||||
async () => {
|
||||
try {
|
||||
const response = await client.collectionsList();
|
||||
return handleSuccess(
|
||||
response,
|
||||
logger.child({ tool: "collections_list" })
|
||||
);
|
||||
return handleSuccess(response, logger.child({ tool: "collections_list" }));
|
||||
} catch (err) {
|
||||
const error = handleError(
|
||||
err,
|
||||
logger.child({ tool: "collections_list" })
|
||||
);
|
||||
const error = handleError(err, logger.child({ tool: "collections_list" }));
|
||||
logger.error(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1,45 +1,22 @@
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { z } from "zod";
|
||||
import type { Logger } from "pino";
|
||||
|
||||
import {
|
||||
backlinkDocumentId,
|
||||
collectionId,
|
||||
direction,
|
||||
limit,
|
||||
offset,
|
||||
parentDocumentId,
|
||||
sort,
|
||||
userId,
|
||||
} from "./common";
|
||||
import { backlinkDocumentId, collectionId, direction, limit, offset, parentDocumentId, sort, userId } from "./common";
|
||||
import { handleSuccess, handleError } from "./utils";
|
||||
|
||||
import type { ToolsFactory } from "./toolsFactory";
|
||||
import type { DocumentsApi } from "../gen/api/outline";
|
||||
import type { Logger } from "pino";
|
||||
|
||||
export const registerDocumentTools: ToolsFactory<DocumentsApi> = (
|
||||
server: McpServer,
|
||||
client: DocumentsApi,
|
||||
logger: Logger
|
||||
): void => {
|
||||
export const registerDocumentTools: ToolsFactory<DocumentsApi> = (server: McpServer, client: DocumentsApi, logger: Logger): void => {
|
||||
server.registerTool(
|
||||
"documents_info",
|
||||
{
|
||||
title: "Get Document Info",
|
||||
description:
|
||||
"Retrieve a document by its UUID, urlId, or shareId. At least one of these parameters must be provided.",
|
||||
description: "Retrieve a document by its UUID, urlId, or shareId. At least one of these parameters must be provided.",
|
||||
inputSchema: {
|
||||
id: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Unique identifier for the document. Either the UUID or the urlId is acceptable."
|
||||
),
|
||||
shareId: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Unique identifier for a document share, a shareId may be used in place of a document UUID"
|
||||
),
|
||||
id: z.string().optional().describe("Unique identifier for the document. Either the UUID or the urlId is acceptable."),
|
||||
shareId: z.string().optional().describe("Unique identifier for a document share, a shareId may be used in place of a document UUID"),
|
||||
},
|
||||
},
|
||||
async (args) => {
|
||||
@@ -50,10 +27,7 @@ export const registerDocumentTools: ToolsFactory<DocumentsApi> = (
|
||||
shareId: args?.shareId,
|
||||
},
|
||||
});
|
||||
return handleSuccess(
|
||||
response,
|
||||
logger.child({ tool: "documents_info" })
|
||||
);
|
||||
return handleSuccess(response, logger.child({ tool: "documents_info" }));
|
||||
} catch (error) {
|
||||
return handleError(error, logger.child({ tool: "documents_info" }));
|
||||
}
|
||||
@@ -76,8 +50,7 @@ export const registerDocumentTools: ToolsFactory<DocumentsApi> = (
|
||||
"documents_list",
|
||||
{
|
||||
title: "List Documents",
|
||||
description:
|
||||
"This method will list all published documents and draft documents belonging to the current user.",
|
||||
description: "This method will list all published documents and draft documents belonging to the current user.",
|
||||
inputSchema: documentsListSchema.shape,
|
||||
},
|
||||
async (args) => {
|
||||
@@ -86,10 +59,7 @@ export const registerDocumentTools: ToolsFactory<DocumentsApi> = (
|
||||
const response = await client.documentsList({
|
||||
documentsListRequest: validatedArgs,
|
||||
});
|
||||
return handleSuccess(
|
||||
response,
|
||||
logger.child({ tool: "documents_list" })
|
||||
);
|
||||
return handleSuccess(response, logger.child({ tool: "documents_list" }));
|
||||
} catch (error) {
|
||||
return handleError(error, logger.child({ tool: "documents_list" }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user