@modyo/mcp 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +204 -77
- package/build/shared/McpServerBase.d.ts.map +1 -1
- package/build/shared/McpServerBase.js +3 -25
- package/build/shared/McpServerBase.js.map +1 -1
- package/build/shared/ToolBase.d.ts +0 -13
- package/build/shared/ToolBase.d.ts.map +1 -1
- package/build/shared/ToolBase.js +0 -12
- package/build/shared/ToolBase.js.map +1 -1
- package/build/shared/index.d.ts +0 -1
- package/build/shared/index.d.ts.map +1 -1
- package/build/shared/index.js +0 -2
- package/build/shared/index.js.map +1 -1
- package/build/tools/channels/navigation/ManageItem.d.ts +1 -1
- package/build/tools/content/types/List.d.ts +1 -1
- package/build/tools/core/team/Manage.d.ts +1 -1
- package/build/tools/core/teamMembers/Manage.d.ts +1 -1
- package/build/tools/customers/forms/FormsManage.d.ts +1 -1
- package/build/tools/customers/originations/Manage.d.ts +1 -1
- package/build/tools/customers/segments/SegmentsManage.d.ts +1 -1
- package/build/tools/customers/settings/DataSetsManage.d.ts +1 -1
- package/build/tools/customers/submissions/Manage.d.ts +1 -1
- package/package.json +1 -1
- package/build/resources/channels/global/PlatformsClass.d.ts +0 -25
- package/build/resources/channels/global/PlatformsClass.d.ts.map +0 -1
- package/build/resources/channels/global/PlatformsClass.js +0 -34
- package/build/resources/channels/global/PlatformsClass.js.map +0 -1
- package/build/resources/channels/global/registerGlobalResources.d.ts +0 -2
- package/build/resources/channels/global/registerGlobalResources.d.ts.map +0 -1
- package/build/resources/channels/global/registerGlobalResources.js +0 -5
- package/build/resources/channels/global/registerGlobalResources.js.map +0 -1
- package/build/resources/channels/tools/ChannelsDocsToolsResource.d.ts +0 -46
- package/build/resources/channels/tools/ChannelsDocsToolsResource.d.ts.map +0 -1
- package/build/resources/channels/tools/ChannelsDocsToolsResource.js +0 -160
- package/build/resources/channels/tools/ChannelsDocsToolsResource.js.map +0 -1
- package/build/resources/content/global/PlatformsClass.d.ts +0 -25
- package/build/resources/content/global/PlatformsClass.d.ts.map +0 -1
- package/build/resources/content/global/PlatformsClass.js +0 -34
- package/build/resources/content/global/PlatformsClass.js.map +0 -1
- package/build/resources/content/global/registerGlobalResources.d.ts +0 -2
- package/build/resources/content/global/registerGlobalResources.d.ts.map +0 -1
- package/build/resources/content/global/registerGlobalResources.js +0 -5
- package/build/resources/content/global/registerGlobalResources.js.map +0 -1
- package/build/resources/content/tools/ContentDocsToolsResource.d.ts +0 -46
- package/build/resources/content/tools/ContentDocsToolsResource.d.ts.map +0 -1
- package/build/resources/content/tools/ContentDocsToolsResource.js +0 -160
- package/build/resources/content/tools/ContentDocsToolsResource.js.map +0 -1
- package/build/resources/content/tools/registerContentToolsResources.d.ts +0 -2
- package/build/resources/content/tools/registerContentToolsResources.d.ts.map +0 -1
- package/build/resources/content/tools/registerContentToolsResources.js +0 -5
- package/build/resources/content/tools/registerContentToolsResources.js.map +0 -1
- package/build/resources/core/tools/CoreDocsToolsResource.d.ts +0 -49
- package/build/resources/core/tools/CoreDocsToolsResource.d.ts.map +0 -1
- package/build/resources/core/tools/CoreDocsToolsResource.js +0 -165
- package/build/resources/core/tools/CoreDocsToolsResource.js.map +0 -1
- package/build/resources/core/tools/registerCoreToolsResources.d.ts +0 -2
- package/build/resources/core/tools/registerCoreToolsResources.d.ts.map +0 -1
- package/build/resources/core/tools/registerCoreToolsResources.js +0 -5
- package/build/resources/core/tools/registerCoreToolsResources.js.map +0 -1
- package/build/resources/customers/global/PlatformsClass.d.ts +0 -25
- package/build/resources/customers/global/PlatformsClass.d.ts.map +0 -1
- package/build/resources/customers/global/PlatformsClass.js +0 -34
- package/build/resources/customers/global/PlatformsClass.js.map +0 -1
- package/build/resources/customers/global/registerGlobalResources.d.ts +0 -2
- package/build/resources/customers/global/registerGlobalResources.d.ts.map +0 -1
- package/build/resources/customers/global/registerGlobalResources.js +0 -5
- package/build/resources/customers/global/registerGlobalResources.js.map +0 -1
- package/build/resources/customers/tools/CustomersDocsToolsResource.d.ts +0 -46
- package/build/resources/customers/tools/CustomersDocsToolsResource.d.ts.map +0 -1
- package/build/resources/customers/tools/CustomersDocsToolsResource.js +0 -160
- package/build/resources/customers/tools/CustomersDocsToolsResource.js.map +0 -1
- package/build/resources/customers/tools/registerCustomersToolsResources.d.ts +0 -2
- package/build/resources/customers/tools/registerCustomersToolsResources.d.ts.map +0 -1
- package/build/resources/customers/tools/registerCustomersToolsResources.js +0 -5
- package/build/resources/customers/tools/registerCustomersToolsResources.js.map +0 -1
- package/build/shared/helpers/deprecation.d.ts +0 -76
- package/build/shared/helpers/deprecation.d.ts.map +0 -1
- package/build/shared/helpers/deprecation.js +0 -97
- package/build/shared/helpers/deprecation.js.map +0 -1
- package/build/shared/test-utils/index.d.ts +0 -2
- package/build/shared/test-utils/index.d.ts.map +0 -1
- package/build/shared/test-utils/index.js +0 -2
- package/build/shared/test-utils/index.js.map +0 -1
- package/build/shared/test-utils/toolTestUtils.d.ts +0 -191
- package/build/shared/test-utils/toolTestUtils.d.ts.map +0 -1
- package/build/shared/test-utils/toolTestUtils.js +0 -304
- package/build/shared/test-utils/toolTestUtils.js.map +0 -1
- package/build/tools/channels/widgets/WidgetsTools.d.ts +0 -2
- package/build/tools/channels/widgets/WidgetsTools.d.ts.map +0 -1
- package/build/tools/channels/widgets/WidgetsTools.js +0 -4
- package/build/tools/channels/widgets/WidgetsTools.js.map +0 -1
- /package/build/tools/customers/submissions/{submissionsTools.d.ts → SubmissionsTools.d.ts} +0 -0
- /package/build/tools/customers/submissions/{submissionsTools.d.ts.map → SubmissionsTools.d.ts.map} +0 -0
- /package/build/tools/customers/submissions/{submissionsTools.js → SubmissionsTools.js} +0 -0
- /package/build/tools/customers/submissions/{submissionsTools.js.map → SubmissionsTools.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { ResourceBase } from "../../../shared/index.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
/**
|
|
5
|
-
* Static resource that shows the configured platform
|
|
6
|
-
*
|
|
7
|
-
* Returns information about the single configured platform.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* URI: platforms://uri
|
|
11
|
-
* Returns: Platform name and URL
|
|
12
|
-
*/
|
|
13
|
-
export declare class PlatformsResource extends ResourceBase<void> {
|
|
14
|
-
protected config: {
|
|
15
|
-
name: string;
|
|
16
|
-
uriTemplate: string;
|
|
17
|
-
description: string;
|
|
18
|
-
mimeType: string;
|
|
19
|
-
isPublic: boolean;
|
|
20
|
-
};
|
|
21
|
-
protected getParamsSchema(): z.ZodVoid;
|
|
22
|
-
read(uri: URL): Promise<ReadResourceResult>;
|
|
23
|
-
}
|
|
24
|
-
export declare const Platforms: Resource;
|
|
25
|
-
//# sourceMappingURL=PlatformsClass.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformsClass.d.ts","sourceRoot":"","sources":["../../../../src/resources/channels/global/PlatformsClass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAA0B,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,IAAI,CAAC;IACvD,SAAS,CAAC,MAAM;;;;;;MAMd;IAEF,SAAS,CAAC,eAAe;IAInB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmBlD;AAGD,eAAO,MAAM,SAAS,EAAE,QAAkC,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ResourceBase, singlePlatformProvider } from "../../../shared/index.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
/**
|
|
4
|
-
* Static resource that shows the configured platform
|
|
5
|
-
*
|
|
6
|
-
* Returns information about the single configured platform.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* URI: platforms://uri
|
|
10
|
-
* Returns: Platform name and URL
|
|
11
|
-
*/
|
|
12
|
-
export class PlatformsResource extends ResourceBase {
|
|
13
|
-
config = {
|
|
14
|
-
name: "platforms",
|
|
15
|
-
uriTemplate: "platforms://uri",
|
|
16
|
-
description: "Shows the configured platform",
|
|
17
|
-
mimeType: "text/plain",
|
|
18
|
-
isPublic: false,
|
|
19
|
-
};
|
|
20
|
-
getParamsSchema() {
|
|
21
|
-
return z.void();
|
|
22
|
-
}
|
|
23
|
-
async read(uri) {
|
|
24
|
-
const platform = singlePlatformProvider.getPlatform();
|
|
25
|
-
if (!platform) {
|
|
26
|
-
return this.successText(uri, "No platform configured. Set MODYO_URL and MODYO_TOKEN.", "text/plain");
|
|
27
|
-
}
|
|
28
|
-
this.debug(`Platform configured: ${platform.name}`);
|
|
29
|
-
return this.successText(uri, `${platform.name}: ${platform.url}`, "text/plain");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// Export instance for registration
|
|
33
|
-
export const Platforms = new PlatformsResource();
|
|
34
|
-
//# sourceMappingURL=PlatformsClass.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformsClass.js","sourceRoot":"","sources":["../../../../src/resources/channels/global/PlatformsClass.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAkB;IAC7C,MAAM,GAAG;QACjB,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,+BAA+B;QAC5C,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,KAAK;KAChB,CAAC;IAEQ,eAAe;QACvB,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAQ;QACjB,MAAM,QAAQ,GAAG,sBAAsB,CAAC,WAAW,EAAE,CAAC;QAEtD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,EACH,wDAAwD,EACxD,YAAY,CACb,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,wBAAwB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAEpD,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,EACH,GAAG,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE,EACnC,YAAY,CACb,CAAC;IACJ,CAAC;CACF;AAED,mCAAmC;AACnC,MAAM,CAAC,MAAM,SAAS,GAAa,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerGlobalResources.d.ts","sourceRoot":"","sources":["../../../../src/resources/channels/global/registerGlobalResources.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,YAEnC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerGlobalResources.js","sourceRoot":"","sources":["../../../../src/resources/channels/global/registerGlobalResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS;CACV,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { ResourceBase } from "../../../shared/index.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
/**
|
|
5
|
-
* Channels module tool documentation resource
|
|
6
|
-
*
|
|
7
|
-
* Serves tool-specific documentation from docs/tools/
|
|
8
|
-
* Auto-discovers all markdown files.
|
|
9
|
-
*
|
|
10
|
-
* URI format: modyo://mcp-channels/tools/{toolPath}
|
|
11
|
-
*
|
|
12
|
-
* Examples:
|
|
13
|
-
* - modyo://mcp-channels/tools/pages-widget-manage
|
|
14
|
-
* - modyo://mcp-channels/tools/pages-manage
|
|
15
|
-
* - modyo://mcp-channels/tools/pages-content-manage
|
|
16
|
-
*/
|
|
17
|
-
export declare class ChannelsDocsToolsResource extends ResourceBase<{
|
|
18
|
-
toolPath: string;
|
|
19
|
-
}> {
|
|
20
|
-
protected config: {
|
|
21
|
-
name: string;
|
|
22
|
-
uriTemplate: string;
|
|
23
|
-
description: string;
|
|
24
|
-
mimeType: string;
|
|
25
|
-
annotations: {
|
|
26
|
-
readOnlyHint: boolean;
|
|
27
|
-
idempotentHint: boolean;
|
|
28
|
-
destructiveHint: boolean;
|
|
29
|
-
};
|
|
30
|
-
isPublic: boolean;
|
|
31
|
-
catchErrors: boolean;
|
|
32
|
-
};
|
|
33
|
-
protected getParamsSchema(): z.ZodObject<{
|
|
34
|
-
toolPath: z.ZodEnum<{
|
|
35
|
-
[x: string]: string;
|
|
36
|
-
}>;
|
|
37
|
-
}, z.core.$strip> | z.ZodObject<{
|
|
38
|
-
toolPath: z.ZodString;
|
|
39
|
-
}, z.core.$strip>;
|
|
40
|
-
registerResource(server: any, logger: any): Promise<void>;
|
|
41
|
-
read(uri: URL, params: {
|
|
42
|
-
toolPath: string;
|
|
43
|
-
}): Promise<ReadResourceResult>;
|
|
44
|
-
}
|
|
45
|
-
export declare const channelsDocsTools: ChannelsDocsToolsResource;
|
|
46
|
-
//# sourceMappingURL=ChannelsDocsToolsResource.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelsDocsToolsResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/channels/tools/ChannelsDocsToolsResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB;;;;;;;;;;;;GAYG;AACH,qBAAa,yBAA0B,SAAQ,YAAY,CAAC;IAC1D,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;IACA,SAAS,CAAC,MAAM;;;;;;;;;;;;MAad;IAEF,SAAS,CAAC,eAAe;;;;;;;IAuBH,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,IAAI,CAAC;IAuEV,IAAI,CACR,GAAG,EAAE,GAAG,EACR,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,kBAAkB,CAAC;CA0B/B;AAED,eAAO,MAAM,iBAAiB,2BAAkC,CAAC"}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
-
import { DOCS_TOOLS_PATH, ResourceBase } from "../../../shared/index.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
/**
|
|
7
|
-
* Auto-discover channels tool documentation
|
|
8
|
-
* Scans docs/tools/**\/*.md files
|
|
9
|
-
* Returns both flat paths and mapping to actual file paths
|
|
10
|
-
*/
|
|
11
|
-
async function discoverChannelsDocsTools() {
|
|
12
|
-
const docsPath = DOCS_TOOLS_PATH;
|
|
13
|
-
const flatPaths = [];
|
|
14
|
-
const pathMap = new Map();
|
|
15
|
-
async function scanDirectory(dir, prefix = "") {
|
|
16
|
-
try {
|
|
17
|
-
const entries = await fs.readdir(dir, {
|
|
18
|
-
withFileTypes: true,
|
|
19
|
-
});
|
|
20
|
-
for (const entry of entries) {
|
|
21
|
-
const fullPath = path.join(dir, entry.name);
|
|
22
|
-
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
23
|
-
if (entry.isDirectory()) {
|
|
24
|
-
await scanDirectory(fullPath, relativePath);
|
|
25
|
-
}
|
|
26
|
-
else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
27
|
-
// Store actual file path (e.g., "account-templates/manage.md")
|
|
28
|
-
const filePath = relativePath;
|
|
29
|
-
// Create flat path by replacing / with - (e.g., "account-templates-manage")
|
|
30
|
-
const flatPath = relativePath.replace(".md", "").replace(/\//g, "-");
|
|
31
|
-
flatPaths.push(flatPath);
|
|
32
|
-
pathMap.set(flatPath, filePath);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
console.warn(`Could not scan directory ${dir}:`, error);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
await scanDirectory(docsPath);
|
|
41
|
-
return {
|
|
42
|
-
flatPaths: flatPaths.sort(),
|
|
43
|
-
pathMap,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
// Cache discovered docs and path mapping
|
|
47
|
-
let DISCOVERED_DOCS = [];
|
|
48
|
-
let PATH_MAP = new Map();
|
|
49
|
-
/**
|
|
50
|
-
* Channels module tool documentation resource
|
|
51
|
-
*
|
|
52
|
-
* Serves tool-specific documentation from docs/tools/
|
|
53
|
-
* Auto-discovers all markdown files.
|
|
54
|
-
*
|
|
55
|
-
* URI format: modyo://mcp-channels/tools/{toolPath}
|
|
56
|
-
*
|
|
57
|
-
* Examples:
|
|
58
|
-
* - modyo://mcp-channels/tools/pages-widget-manage
|
|
59
|
-
* - modyo://mcp-channels/tools/pages-manage
|
|
60
|
-
* - modyo://mcp-channels/tools/pages-content-manage
|
|
61
|
-
*/
|
|
62
|
-
export class ChannelsDocsToolsResource extends ResourceBase {
|
|
63
|
-
config = {
|
|
64
|
-
name: "modyo-channels-tools-docs",
|
|
65
|
-
uriTemplate: "modyo://mcp-channels/tools/{toolPath}",
|
|
66
|
-
description: "Tool documentation for Modyo Channels module (pages, widgets, templates, navigation)",
|
|
67
|
-
mimeType: "text/markdown",
|
|
68
|
-
annotations: {
|
|
69
|
-
readOnlyHint: true,
|
|
70
|
-
idempotentHint: true,
|
|
71
|
-
destructiveHint: false,
|
|
72
|
-
},
|
|
73
|
-
isPublic: true,
|
|
74
|
-
catchErrors: true,
|
|
75
|
-
};
|
|
76
|
-
getParamsSchema() {
|
|
77
|
-
if (DISCOVERED_DOCS.length > 0) {
|
|
78
|
-
return z.object({
|
|
79
|
-
toolPath: z.enum(DISCOVERED_DOCS, {
|
|
80
|
-
message: `Invalid tool path. Available: ${DISCOVERED_DOCS.join(", ")}`,
|
|
81
|
-
}),
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return z.object({
|
|
85
|
-
toolPath: z
|
|
86
|
-
.string()
|
|
87
|
-
.min(1)
|
|
88
|
-
.describe("Tool documentation path (e.g., 'pages-widget-manage')"),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
async registerResource(server, logger) {
|
|
92
|
-
this.server = server;
|
|
93
|
-
this.logger = logger;
|
|
94
|
-
if (DISCOVERED_DOCS.length === 0) {
|
|
95
|
-
const { flatPaths, pathMap } = await discoverChannelsDocsTools();
|
|
96
|
-
DISCOVERED_DOCS = flatPaths;
|
|
97
|
-
PATH_MAP = pathMap;
|
|
98
|
-
logger(`Discovered ${DISCOVERED_DOCS.length} channels documentation files`, {
|
|
99
|
-
docs: DISCOVERED_DOCS,
|
|
100
|
-
}, "info");
|
|
101
|
-
}
|
|
102
|
-
const schema = this.getParamsSchema();
|
|
103
|
-
const rawInputSchema = this.extractRawSchema(schema);
|
|
104
|
-
const resourceConfig = {
|
|
105
|
-
description: this.config.description,
|
|
106
|
-
mimeType: this.config.mimeType,
|
|
107
|
-
inputSchema: rawInputSchema,
|
|
108
|
-
annotations: this.config.annotations,
|
|
109
|
-
};
|
|
110
|
-
const readCallback = async (uri, params) => {
|
|
111
|
-
try {
|
|
112
|
-
const validatedParams = schema.parse(params);
|
|
113
|
-
return await this.read(uri, validatedParams);
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
if (this.config.catchErrors) {
|
|
117
|
-
return this.errorResponse(uri, error, {
|
|
118
|
-
params,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
logger(`Resource ${this.config.name} failed`, {
|
|
122
|
-
uri: uri.href,
|
|
123
|
-
params,
|
|
124
|
-
error,
|
|
125
|
-
}, "error");
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
server.registerResource(this.config.name, new ResourceTemplate(this.config.uriTemplate, {
|
|
130
|
-
list: undefined,
|
|
131
|
-
complete: {
|
|
132
|
-
toolPath: (value) => {
|
|
133
|
-
return DISCOVERED_DOCS.filter((doc) => doc.startsWith(value)).slice(0, 20);
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
}), resourceConfig, readCallback);
|
|
137
|
-
}
|
|
138
|
-
async read(uri, params) {
|
|
139
|
-
this.debug(`Reading channels tool documentation: ${params.toolPath}`);
|
|
140
|
-
try {
|
|
141
|
-
// Look up actual file path from the mapping
|
|
142
|
-
const relativeFilePath = PATH_MAP.get(params.toolPath);
|
|
143
|
-
if (!relativeFilePath) {
|
|
144
|
-
throw new Error(`Unknown tool path: ${params.toolPath}. Available: ${DISCOVERED_DOCS.join(", ")}`);
|
|
145
|
-
}
|
|
146
|
-
const docFilePath = path.join(DOCS_TOOLS_PATH, relativeFilePath);
|
|
147
|
-
const content = await fs.readFile(docFilePath, "utf-8");
|
|
148
|
-
this.info(`Served ${params.toolPath} tool documentation (${content.length} chars)`);
|
|
149
|
-
return this.successText(uri, content, "text/markdown");
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
this.logError(`Failed to read ${params.toolPath} tool documentation`, {
|
|
153
|
-
error,
|
|
154
|
-
});
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
export const channelsDocsTools = new ChannelsDocsToolsResource();
|
|
160
|
-
//# sourceMappingURL=ChannelsDocsToolsResource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelsDocsToolsResource.js","sourceRoot":"","sources":["../../../../src/resources/channels/tools/ChannelsDocsToolsResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,KAAK,UAAU,yBAAyB;IAItC,MAAM,QAAQ,GAAG,eAAe,CAAC;IAEjC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1C,KAAK,UAAU,aAAa,CAAC,GAAW,EAAE,MAAM,GAAG,EAAE;QACnD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;gBACpC,aAAa,EAAE,IAAI;aACpB,CAAC,CAAC;YAEH,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC5C,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;gBAErE,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;oBACxB,MAAM,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;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YACvD,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CACb,sBAAsB,MAAM,CAAC,QAAQ,gBAAgB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClF,CAAC;YACJ,CAAC;YACD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;YACjE,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAExD,IAAI,CAAC,IAAI,CACP,UAAU,MAAM,CAAC,QAAQ,wBAAwB,OAAO,CAAC,MAAM,SAAS,CACzE,CAAC;YAEF,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,QAAQ,CAAC,kBAAkB,MAAM,CAAC,QAAQ,qBAAqB,EAAE;gBACpE,KAAK;aACN,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,yBAAyB,EAAE,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { ResourceBase } from "../../../shared/index.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
/**
|
|
5
|
-
* Static resource that shows the configured platform
|
|
6
|
-
*
|
|
7
|
-
* Returns information about the single configured platform.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* URI: platforms://uri
|
|
11
|
-
* Returns: Platform name and URL
|
|
12
|
-
*/
|
|
13
|
-
export declare class PlatformsResource extends ResourceBase<void> {
|
|
14
|
-
protected config: {
|
|
15
|
-
name: string;
|
|
16
|
-
uriTemplate: string;
|
|
17
|
-
description: string;
|
|
18
|
-
mimeType: string;
|
|
19
|
-
isPublic: boolean;
|
|
20
|
-
};
|
|
21
|
-
protected getParamsSchema(): z.ZodVoid;
|
|
22
|
-
read(uri: URL): Promise<ReadResourceResult>;
|
|
23
|
-
}
|
|
24
|
-
export declare const Platforms: Resource;
|
|
25
|
-
//# sourceMappingURL=PlatformsClass.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformsClass.d.ts","sourceRoot":"","sources":["../../../../src/resources/content/global/PlatformsClass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAA0B,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,IAAI,CAAC;IACvD,SAAS,CAAC,MAAM;;;;;;MAMd;IAEF,SAAS,CAAC,eAAe;IAInB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmBlD;AAGD,eAAO,MAAM,SAAS,EAAE,QAAkC,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ResourceBase, singlePlatformProvider } from "../../../shared/index.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
/**
|
|
4
|
-
* Static resource that shows the configured platform
|
|
5
|
-
*
|
|
6
|
-
* Returns information about the single configured platform.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* URI: platforms://uri
|
|
10
|
-
* Returns: Platform name and URL
|
|
11
|
-
*/
|
|
12
|
-
export class PlatformsResource extends ResourceBase {
|
|
13
|
-
config = {
|
|
14
|
-
name: "platforms",
|
|
15
|
-
uriTemplate: "platforms://uri",
|
|
16
|
-
description: "Shows the configured platform",
|
|
17
|
-
mimeType: "text/plain",
|
|
18
|
-
isPublic: false,
|
|
19
|
-
};
|
|
20
|
-
getParamsSchema() {
|
|
21
|
-
return z.void();
|
|
22
|
-
}
|
|
23
|
-
async read(uri) {
|
|
24
|
-
const platform = singlePlatformProvider.getPlatform();
|
|
25
|
-
if (!platform) {
|
|
26
|
-
return this.successText(uri, "No platform configured. Set MODYO_URL and MODYO_TOKEN.", "text/plain");
|
|
27
|
-
}
|
|
28
|
-
this.debug(`Platform configured: ${platform.name}`);
|
|
29
|
-
return this.successText(uri, `${platform.name}: ${platform.url}`, "text/plain");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// Export instance for registration
|
|
33
|
-
export const Platforms = new PlatformsResource();
|
|
34
|
-
//# sourceMappingURL=PlatformsClass.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformsClass.js","sourceRoot":"","sources":["../../../../src/resources/content/global/PlatformsClass.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAkB;IAC7C,MAAM,GAAG;QACjB,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,+BAA+B;QAC5C,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,KAAK;KAChB,CAAC;IAEQ,eAAe;QACvB,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAQ;QACjB,MAAM,QAAQ,GAAG,sBAAsB,CAAC,WAAW,EAAE,CAAC;QAEtD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,EACH,wDAAwD,EACxD,YAAY,CACb,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,wBAAwB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAEpD,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,EACH,GAAG,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE,EACnC,YAAY,CACb,CAAC;IACJ,CAAC;CACF;AAED,mCAAmC;AACnC,MAAM,CAAC,MAAM,SAAS,GAAa,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerGlobalResources.d.ts","sourceRoot":"","sources":["../../../../src/resources/content/global/registerGlobalResources.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,YAEnC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerGlobalResources.js","sourceRoot":"","sources":["../../../../src/resources/content/global/registerGlobalResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS;CACV,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { ResourceBase } from "../../../shared/index.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
/**
|
|
5
|
-
* Content module tool documentation resource
|
|
6
|
-
*
|
|
7
|
-
* Serves tool-specific documentation from docs/tools/
|
|
8
|
-
* Auto-discovers all markdown files.
|
|
9
|
-
*
|
|
10
|
-
* URI format: modyo://mcp-content/tools/{toolPath}
|
|
11
|
-
*
|
|
12
|
-
* Examples:
|
|
13
|
-
* - modyo://mcp-content/tools/types-manage
|
|
14
|
-
* - modyo://mcp-content/tools/entries-manage
|
|
15
|
-
* - modyo://mcp-content/tools/spaces-manage
|
|
16
|
-
*/
|
|
17
|
-
export declare class ContentDocsToolsResource extends ResourceBase<{
|
|
18
|
-
toolPath: string;
|
|
19
|
-
}> {
|
|
20
|
-
protected config: {
|
|
21
|
-
name: string;
|
|
22
|
-
uriTemplate: string;
|
|
23
|
-
description: string;
|
|
24
|
-
mimeType: string;
|
|
25
|
-
annotations: {
|
|
26
|
-
readOnlyHint: boolean;
|
|
27
|
-
idempotentHint: boolean;
|
|
28
|
-
destructiveHint: boolean;
|
|
29
|
-
};
|
|
30
|
-
isPublic: boolean;
|
|
31
|
-
catchErrors: boolean;
|
|
32
|
-
};
|
|
33
|
-
protected getParamsSchema(): z.ZodObject<{
|
|
34
|
-
toolPath: z.ZodEnum<{
|
|
35
|
-
[x: string]: string;
|
|
36
|
-
}>;
|
|
37
|
-
}, z.core.$strip> | z.ZodObject<{
|
|
38
|
-
toolPath: z.ZodString;
|
|
39
|
-
}, z.core.$strip>;
|
|
40
|
-
registerResource(server: any, logger: any): Promise<void>;
|
|
41
|
-
read(uri: URL, params: {
|
|
42
|
-
toolPath: string;
|
|
43
|
-
}): Promise<ReadResourceResult>;
|
|
44
|
-
}
|
|
45
|
-
export declare const contentDocsTools: ContentDocsToolsResource;
|
|
46
|
-
//# sourceMappingURL=ContentDocsToolsResource.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContentDocsToolsResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/content/tools/ContentDocsToolsResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB;;;;;;;;;;;;GAYG;AACH,qBAAa,wBAAyB,SAAQ,YAAY,CAAC;IACzD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;IACA,SAAS,CAAC,MAAM;;;;;;;;;;;;MAad;IAEF,SAAS,CAAC,eAAe;;;;;;;IAuBH,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,IAAI,CAAC;IAuEV,IAAI,CACR,GAAG,EAAE,GAAG,EACR,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,kBAAkB,CAAC;CA0B/B;AAED,eAAO,MAAM,gBAAgB,0BAAiC,CAAC"}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
-
import { DOCS_TOOLS_PATH, ResourceBase } from "../../../shared/index.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
/**
|
|
7
|
-
* Auto-discover content tool documentation
|
|
8
|
-
* Scans docs/tools/**\/*.md files
|
|
9
|
-
* Returns both flat paths and mapping to actual file paths
|
|
10
|
-
*/
|
|
11
|
-
async function discoverContentDocsTools() {
|
|
12
|
-
const docsPath = DOCS_TOOLS_PATH;
|
|
13
|
-
const flatPaths = [];
|
|
14
|
-
const pathMap = new Map();
|
|
15
|
-
async function scanDirectory(dir, prefix = "") {
|
|
16
|
-
try {
|
|
17
|
-
const entries = await fs.readdir(dir, {
|
|
18
|
-
withFileTypes: true,
|
|
19
|
-
});
|
|
20
|
-
for (const entry of entries) {
|
|
21
|
-
const fullPath = path.join(dir, entry.name);
|
|
22
|
-
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
23
|
-
if (entry.isDirectory()) {
|
|
24
|
-
await scanDirectory(fullPath, relativePath);
|
|
25
|
-
}
|
|
26
|
-
else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
27
|
-
// Store actual file path (e.g., "types/manage.md")
|
|
28
|
-
const filePath = relativePath;
|
|
29
|
-
// Create flat path by replacing / with - (e.g., "types-manage")
|
|
30
|
-
const flatPath = relativePath.replace(".md", "").replace(/\//g, "-");
|
|
31
|
-
flatPaths.push(flatPath);
|
|
32
|
-
pathMap.set(flatPath, filePath);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
console.warn(`Could not scan directory ${dir}:`, error);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
await scanDirectory(docsPath);
|
|
41
|
-
return {
|
|
42
|
-
flatPaths: flatPaths.sort(),
|
|
43
|
-
pathMap,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
// Cache discovered docs and path mapping
|
|
47
|
-
let DISCOVERED_DOCS = [];
|
|
48
|
-
let PATH_MAP = new Map();
|
|
49
|
-
/**
|
|
50
|
-
* Content module tool documentation resource
|
|
51
|
-
*
|
|
52
|
-
* Serves tool-specific documentation from docs/tools/
|
|
53
|
-
* Auto-discovers all markdown files.
|
|
54
|
-
*
|
|
55
|
-
* URI format: modyo://mcp-content/tools/{toolPath}
|
|
56
|
-
*
|
|
57
|
-
* Examples:
|
|
58
|
-
* - modyo://mcp-content/tools/types-manage
|
|
59
|
-
* - modyo://mcp-content/tools/entries-manage
|
|
60
|
-
* - modyo://mcp-content/tools/spaces-manage
|
|
61
|
-
*/
|
|
62
|
-
export class ContentDocsToolsResource extends ResourceBase {
|
|
63
|
-
config = {
|
|
64
|
-
name: "modyo-content-tools-docs",
|
|
65
|
-
uriTemplate: "modyo://mcp-content/tools/{toolPath}",
|
|
66
|
-
description: "Tool documentation for Modyo Content module (types, entries, spaces, assets, categories)",
|
|
67
|
-
mimeType: "text/markdown",
|
|
68
|
-
annotations: {
|
|
69
|
-
readOnlyHint: true,
|
|
70
|
-
idempotentHint: true,
|
|
71
|
-
destructiveHint: false,
|
|
72
|
-
},
|
|
73
|
-
isPublic: true,
|
|
74
|
-
catchErrors: true,
|
|
75
|
-
};
|
|
76
|
-
getParamsSchema() {
|
|
77
|
-
if (DISCOVERED_DOCS.length > 0) {
|
|
78
|
-
return z.object({
|
|
79
|
-
toolPath: z.enum(DISCOVERED_DOCS, {
|
|
80
|
-
message: `Invalid tool path. Available: ${DISCOVERED_DOCS.join(", ")}`,
|
|
81
|
-
}),
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return z.object({
|
|
85
|
-
toolPath: z
|
|
86
|
-
.string()
|
|
87
|
-
.min(1)
|
|
88
|
-
.describe("Tool documentation path (e.g., 'types-manage')"),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
async registerResource(server, logger) {
|
|
92
|
-
this.server = server;
|
|
93
|
-
this.logger = logger;
|
|
94
|
-
if (DISCOVERED_DOCS.length === 0) {
|
|
95
|
-
const { flatPaths, pathMap } = await discoverContentDocsTools();
|
|
96
|
-
DISCOVERED_DOCS = flatPaths;
|
|
97
|
-
PATH_MAP = pathMap;
|
|
98
|
-
logger(`Discovered ${DISCOVERED_DOCS.length} content documentation files`, {
|
|
99
|
-
docs: DISCOVERED_DOCS,
|
|
100
|
-
}, "info");
|
|
101
|
-
}
|
|
102
|
-
const schema = this.getParamsSchema();
|
|
103
|
-
const rawInputSchema = this.extractRawSchema(schema);
|
|
104
|
-
const resourceConfig = {
|
|
105
|
-
description: this.config.description,
|
|
106
|
-
mimeType: this.config.mimeType,
|
|
107
|
-
inputSchema: rawInputSchema,
|
|
108
|
-
annotations: this.config.annotations,
|
|
109
|
-
};
|
|
110
|
-
const readCallback = async (uri, params) => {
|
|
111
|
-
try {
|
|
112
|
-
const validatedParams = schema.parse(params);
|
|
113
|
-
return await this.read(uri, validatedParams);
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
if (this.config.catchErrors) {
|
|
117
|
-
return this.errorResponse(uri, error, {
|
|
118
|
-
params,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
logger(`Resource ${this.config.name} failed`, {
|
|
122
|
-
uri: uri.href,
|
|
123
|
-
params,
|
|
124
|
-
error,
|
|
125
|
-
}, "error");
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
server.registerResource(this.config.name, new ResourceTemplate(this.config.uriTemplate, {
|
|
130
|
-
list: undefined,
|
|
131
|
-
complete: {
|
|
132
|
-
toolPath: (value) => {
|
|
133
|
-
return DISCOVERED_DOCS.filter((doc) => doc.startsWith(value)).slice(0, 20);
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
}), resourceConfig, readCallback);
|
|
137
|
-
}
|
|
138
|
-
async read(uri, params) {
|
|
139
|
-
this.debug(`Reading content tool documentation: ${params.toolPath}`);
|
|
140
|
-
try {
|
|
141
|
-
// Look up actual file path from the mapping
|
|
142
|
-
const relativeFilePath = PATH_MAP.get(params.toolPath);
|
|
143
|
-
if (!relativeFilePath) {
|
|
144
|
-
throw new Error(`Unknown tool path: ${params.toolPath}. Available: ${DISCOVERED_DOCS.join(", ")}`);
|
|
145
|
-
}
|
|
146
|
-
const docFilePath = path.join(DOCS_TOOLS_PATH, relativeFilePath);
|
|
147
|
-
const content = await fs.readFile(docFilePath, "utf-8");
|
|
148
|
-
this.info(`Served ${params.toolPath} tool documentation (${content.length} chars)`);
|
|
149
|
-
return this.successText(uri, content, "text/markdown");
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
this.logError(`Failed to read ${params.toolPath} tool documentation`, {
|
|
153
|
-
error,
|
|
154
|
-
});
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
export const contentDocsTools = new ContentDocsToolsResource();
|
|
160
|
-
//# sourceMappingURL=ContentDocsToolsResource.js.map
|