@venizia/ignis-docs 0.0.1-3 → 0.0.1-5
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 +408 -2
- package/mcp-server/dist/common/config.d.ts +58 -21
- package/mcp-server/dist/common/config.d.ts.map +1 -1
- package/mcp-server/dist/common/config.js +69 -14
- package/mcp-server/dist/common/config.js.map +1 -1
- package/mcp-server/dist/common/index.d.ts +2 -2
- package/mcp-server/dist/common/paths.js +11 -11
- package/mcp-server/dist/helpers/docs.helper.d.ts +5 -5
- package/mcp-server/dist/helpers/docs.helper.d.ts.map +1 -1
- package/mcp-server/dist/helpers/docs.helper.js +38 -34
- package/mcp-server/dist/helpers/docs.helper.js.map +1 -1
- package/mcp-server/dist/helpers/github.helper.d.ts +37 -0
- package/mcp-server/dist/helpers/github.helper.d.ts.map +1 -0
- package/mcp-server/dist/helpers/github.helper.js +100 -0
- package/mcp-server/dist/helpers/github.helper.js.map +1 -0
- package/mcp-server/dist/helpers/index.d.ts +3 -2
- package/mcp-server/dist/helpers/index.d.ts.map +1 -1
- package/mcp-server/dist/helpers/index.js +1 -0
- package/mcp-server/dist/helpers/index.js.map +1 -1
- package/mcp-server/dist/index.js +64 -36
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/tools/base.tool.d.ts +8 -12
- package/mcp-server/dist/tools/base.tool.d.ts.map +1 -1
- package/mcp-server/dist/tools/base.tool.js +3 -5
- package/mcp-server/dist/tools/base.tool.js.map +1 -1
- package/mcp-server/dist/tools/{get-doc-content.tool.d.ts → docs/get-document-content.tool.d.ts} +5 -5
- package/mcp-server/dist/tools/docs/get-document-content.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{get-doc-content.tool.js → docs/get-document-content.tool.js} +14 -13
- package/mcp-server/dist/tools/docs/get-document-content.tool.js.map +1 -0
- package/mcp-server/dist/tools/{get-doc-metadata.tool.d.ts → docs/get-document-metadata.tool.d.ts} +5 -5
- package/mcp-server/dist/tools/docs/get-document-metadata.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{get-doc-metadata.tool.js → docs/get-document-metadata.tool.js} +18 -17
- package/mcp-server/dist/tools/docs/get-document-metadata.tool.js.map +1 -0
- package/mcp-server/dist/tools/docs/get-package-overview.tool.d.ts +50 -0
- package/mcp-server/dist/tools/docs/get-package-overview.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/docs/get-package-overview.tool.js +221 -0
- package/mcp-server/dist/tools/docs/get-package-overview.tool.js.map +1 -0
- package/mcp-server/dist/tools/docs/index.d.ts +7 -0
- package/mcp-server/dist/tools/docs/index.d.ts.map +1 -0
- package/mcp-server/dist/tools/docs/index.js +23 -0
- package/mcp-server/dist/tools/docs/index.js.map +1 -0
- package/mcp-server/dist/tools/{list-categories.tool.d.ts → docs/list-categories.tool.d.ts} +3 -3
- package/mcp-server/dist/tools/docs/list-categories.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{list-categories.tool.js → docs/list-categories.tool.js} +10 -9
- package/mcp-server/dist/tools/docs/list-categories.tool.js.map +1 -0
- package/mcp-server/dist/tools/{list-docs.tool.d.ts → docs/list-documents.tool.d.ts} +5 -5
- package/mcp-server/dist/tools/docs/list-documents.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{list-docs.tool.js → docs/list-documents.tool.js} +15 -14
- package/mcp-server/dist/tools/docs/list-documents.tool.js.map +1 -0
- package/mcp-server/dist/tools/{search-docs.tool.d.ts → docs/search-documents.tool.d.ts} +5 -5
- package/mcp-server/dist/tools/docs/search-documents.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{search-docs.tool.js → docs/search-documents.tool.js} +24 -23
- package/mcp-server/dist/tools/docs/search-documents.tool.js.map +1 -0
- package/mcp-server/dist/tools/github/index.d.ts +5 -0
- package/mcp-server/dist/tools/github/index.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/index.js +21 -0
- package/mcp-server/dist/tools/github/index.js.map +1 -0
- package/mcp-server/dist/tools/github/list-project-files.tool.d.ts +28 -0
- package/mcp-server/dist/tools/github/list-project-files.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/list-project-files.tool.js +98 -0
- package/mcp-server/dist/tools/github/list-project-files.tool.js.map +1 -0
- package/mcp-server/dist/tools/github/search-code.tool.d.ts +42 -0
- package/mcp-server/dist/tools/github/search-code.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/search-code.tool.js +194 -0
- package/mcp-server/dist/tools/github/search-code.tool.js.map +1 -0
- package/mcp-server/dist/tools/github/verify-dependencies.tool.d.ts +55 -0
- package/mcp-server/dist/tools/github/verify-dependencies.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/verify-dependencies.tool.js +167 -0
- package/mcp-server/dist/tools/github/verify-dependencies.tool.js.map +1 -0
- package/mcp-server/dist/tools/github/view-source-file.tool.d.ts +26 -0
- package/mcp-server/dist/tools/github/view-source-file.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/view-source-file.tool.js +91 -0
- package/mcp-server/dist/tools/github/view-source-file.tool.js.map +1 -0
- package/mcp-server/dist/tools/index.d.ts +3 -7
- package/mcp-server/dist/tools/index.d.ts.map +1 -1
- package/mcp-server/dist/tools/index.js +17 -13
- package/mcp-server/dist/tools/index.js.map +1 -1
- package/package.json +27 -8
- package/wiki/get-started/best-practices/api-usage-examples.md +42 -0
- package/wiki/get-started/best-practices/architectural-patterns.md +42 -1
- package/wiki/get-started/best-practices/code-style-standards.md +41 -0
- package/wiki/get-started/best-practices/contribution-workflow.md +40 -6
- package/wiki/get-started/best-practices/data-modeling.md +126 -0
- package/wiki/get-started/core-concepts/dependency-injection.md +13 -1
- package/wiki/get-started/mcp-docs-server.md +130 -32
- package/wiki/get-started/philosophy.md +198 -25
- package/wiki/references/base/application.md +5 -5
- package/wiki/references/base/controllers.md +3 -1
- package/wiki/references/base/dependency-injection.md +6 -5
- package/wiki/references/helpers/inversion.md +21 -11
- package/wiki/references/src-details/core.md +15 -1
- package/wiki/references/src-details/docs.md +19 -9
- package/wiki/references/src-details/mcp-server.md +185 -234
- package/mcp-server/dist/tools/get-doc-content.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/get-doc-content.tool.js.map +0 -1
- package/mcp-server/dist/tools/get-doc-metadata.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/get-doc-metadata.tool.js.map +0 -1
- package/mcp-server/dist/tools/list-categories.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/list-categories.tool.js.map +0 -1
- package/mcp-server/dist/tools/list-docs.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/list-docs.tool.js.map +0 -1
- package/mcp-server/dist/tools/search-docs.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/search-docs.tool.js.map +0 -1
|
@@ -15,7 +15,7 @@ export declare class DocsHelper {
|
|
|
15
15
|
/**
|
|
16
16
|
* Loads and caches documentation from the wiki.
|
|
17
17
|
*/
|
|
18
|
-
static
|
|
18
|
+
static load(): Promise<IDoc[]>;
|
|
19
19
|
/**
|
|
20
20
|
* Clears the documentation cache.
|
|
21
21
|
*/
|
|
@@ -27,7 +27,7 @@ export declare class DocsHelper {
|
|
|
27
27
|
/**
|
|
28
28
|
* Searches the loaded documentation.
|
|
29
29
|
*/
|
|
30
|
-
static
|
|
30
|
+
static searchDocuments(opts: ISearchOptions): Promise<{
|
|
31
31
|
id: string;
|
|
32
32
|
title: string;
|
|
33
33
|
category: string;
|
|
@@ -37,13 +37,13 @@ export declare class DocsHelper {
|
|
|
37
37
|
/**
|
|
38
38
|
* Gets the full content of a specific document.
|
|
39
39
|
*/
|
|
40
|
-
static
|
|
40
|
+
static getDocumentContent(opts: {
|
|
41
41
|
id: string;
|
|
42
42
|
}): Promise<string | null>;
|
|
43
43
|
/**
|
|
44
44
|
* Lists all available documentation files.
|
|
45
45
|
*/
|
|
46
|
-
static
|
|
46
|
+
static listDocumentFiles(opts: {
|
|
47
47
|
category?: string;
|
|
48
48
|
}): Promise<{
|
|
49
49
|
id: string;
|
|
@@ -57,7 +57,7 @@ export declare class DocsHelper {
|
|
|
57
57
|
/**
|
|
58
58
|
* Gets metadata about a specific document.
|
|
59
59
|
*/
|
|
60
|
-
static
|
|
60
|
+
static getDocumentMetadata(opts: {
|
|
61
61
|
id: string;
|
|
62
62
|
}): Promise<{
|
|
63
63
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.helper.d.ts","sourceRoot":"","sources":["../../helpers/docs.helper.ts"],"names":[],"mappings":"AAQA,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"docs.helper.d.ts","sourceRoot":"","sources":["../../helpers/docs.helper.ts"],"names":[],"mappings":"AAQA,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAc;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAA2B;IAE/C;;OAEG;WACU,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAiDpC;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,IAAI;IAMzB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAY9B;;OAEG;WACU,eAAe,CAAC,IAAI,EAAE,cAAc;;;;;;;IAqBjD;;OAEG;WACU,kBAAkB,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAY7E;;OAEG;WACU,iBAAiB,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;IAgB1D;;OAEG;WACU,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAShD;;OAEG;WACU,mBAAmB,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;CAiCtD"}
|
|
@@ -11,47 +11,50 @@ const promises_1 = __importDefault(require("node:fs/promises"));
|
|
|
11
11
|
const node_path_1 = __importDefault(require("node:path"));
|
|
12
12
|
const common_1 = require("../common");
|
|
13
13
|
const logger_helper_1 = require("./logger.helper");
|
|
14
|
+
// --------------------------------------------------------------------------------------------------
|
|
14
15
|
class DocsHelper {
|
|
15
16
|
static { this._docs = []; }
|
|
16
17
|
static { this._fuse = null; }
|
|
17
18
|
/**
|
|
18
19
|
* Loads and caches documentation from the wiki.
|
|
19
20
|
*/
|
|
20
|
-
static async
|
|
21
|
+
static async load() {
|
|
21
22
|
if (this._docs.length > 0) {
|
|
22
23
|
return this._docs;
|
|
23
24
|
}
|
|
24
25
|
try {
|
|
25
|
-
const files = await (0, fast_glob_1.default)(
|
|
26
|
+
const files = await (0, fast_glob_1.default)('**/*.md', {
|
|
26
27
|
cwd: common_1.Paths.WIKI,
|
|
27
28
|
absolute: true,
|
|
28
|
-
ignore: [
|
|
29
|
+
ignore: ['node_modules'],
|
|
29
30
|
});
|
|
30
31
|
if (files.length === 0) {
|
|
31
32
|
logger_helper_1.Logger.warn(`No documentation files found in ${common_1.Paths.WIKI}`);
|
|
32
33
|
return [];
|
|
33
34
|
}
|
|
34
|
-
this._docs = await Promise.all(files.map(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
this._docs = await Promise.all(files.map(file => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
promises_1.default.readFile(file, 'utf-8')
|
|
38
|
+
.then(rawContent => {
|
|
39
|
+
const { data, content } = (0, gray_matter_1.default)(rawContent);
|
|
40
|
+
resolve({
|
|
41
|
+
id: node_path_1.default.relative(common_1.Paths.WIKI, file),
|
|
42
|
+
title: data.title || node_path_1.default.basename(file, '.md'),
|
|
43
|
+
content,
|
|
44
|
+
category: data.category || 'Uncategorized',
|
|
45
|
+
filePath: file,
|
|
46
|
+
});
|
|
47
|
+
})
|
|
48
|
+
.catch(reject);
|
|
49
|
+
});
|
|
44
50
|
}));
|
|
45
|
-
this._fuse = new fuse_js_1.default(this._docs, {
|
|
46
|
-
...common_1.MCP_CONFIG.fuse,
|
|
47
|
-
keys: common_1.MCP_CONFIG.fuse.keys,
|
|
48
|
-
});
|
|
51
|
+
this._fuse = new fuse_js_1.default(this._docs, { ...common_1.MCPConfigs.fuse, keys: common_1.MCPConfigs.fuse.keys });
|
|
49
52
|
logger_helper_1.Logger.info(`Loaded ${this._docs.length} documentation files`);
|
|
50
53
|
return this._docs;
|
|
51
54
|
}
|
|
52
55
|
catch (error) {
|
|
53
|
-
logger_helper_1.Logger.error(
|
|
54
|
-
throw new Error(`Documentation loading failed: ${error instanceof Error ? error.message :
|
|
56
|
+
logger_helper_1.Logger.error('Failed to load documentation:', error);
|
|
57
|
+
throw new Error(`Documentation loading failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
@@ -60,45 +63,46 @@ class DocsHelper {
|
|
|
60
63
|
static clearCache() {
|
|
61
64
|
this._docs = [];
|
|
62
65
|
this._fuse = null;
|
|
63
|
-
logger_helper_1.Logger.debug(
|
|
66
|
+
logger_helper_1.Logger.debug('Documentation cache cleared');
|
|
64
67
|
}
|
|
65
68
|
/**
|
|
66
69
|
* Generates a smart snippet from content.
|
|
67
70
|
*/
|
|
68
|
-
static generateSnippet(
|
|
71
|
+
static generateSnippet(opts) {
|
|
72
|
+
const { content, maxLength = common_1.MCPConfigs.search.snippetLength } = opts;
|
|
69
73
|
if (content.length <= maxLength) {
|
|
70
74
|
return content;
|
|
71
75
|
}
|
|
72
76
|
const trimmed = content.substring(0, maxLength);
|
|
73
|
-
const lastSpace = trimmed.lastIndexOf(
|
|
74
|
-
return (lastSpace > 0 ? trimmed.substring(0, lastSpace) : trimmed) +
|
|
77
|
+
const lastSpace = trimmed.lastIndexOf(' ');
|
|
78
|
+
return (lastSpace > 0 ? trimmed.substring(0, lastSpace) : trimmed) + '...';
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
77
81
|
* Searches the loaded documentation.
|
|
78
82
|
*/
|
|
79
|
-
static async
|
|
83
|
+
static async searchDocuments(opts) {
|
|
80
84
|
if (!this._fuse) {
|
|
81
|
-
await this.
|
|
85
|
+
await this.load();
|
|
82
86
|
}
|
|
83
87
|
if (!this._fuse) {
|
|
84
88
|
return [];
|
|
85
89
|
}
|
|
86
|
-
const limit = opts.limit ?? common_1.
|
|
90
|
+
const limit = opts.limit ?? common_1.MCPConfigs.search.defaultLimit;
|
|
87
91
|
const results = this._fuse.search(opts.query).slice(0, limit);
|
|
88
92
|
return results.map(result => ({
|
|
89
93
|
id: result.item.id,
|
|
90
94
|
title: result.item.title,
|
|
91
95
|
category: result.item.category,
|
|
92
|
-
snippet: this.generateSnippet(result.item.content),
|
|
96
|
+
snippet: this.generateSnippet({ content: result.item.content }),
|
|
93
97
|
score: result.score,
|
|
94
98
|
}));
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
101
|
* Gets the full content of a specific document.
|
|
98
102
|
*/
|
|
99
|
-
static async
|
|
103
|
+
static async getDocumentContent(opts) {
|
|
100
104
|
if (this._docs.length === 0) {
|
|
101
|
-
await this.
|
|
105
|
+
await this.load();
|
|
102
106
|
}
|
|
103
107
|
const doc = this._docs.find(d => d.id === opts.id);
|
|
104
108
|
if (doc) {
|
|
@@ -109,9 +113,9 @@ class DocsHelper {
|
|
|
109
113
|
/**
|
|
110
114
|
* Lists all available documentation files.
|
|
111
115
|
*/
|
|
112
|
-
static async
|
|
116
|
+
static async listDocumentFiles(opts) {
|
|
113
117
|
if (this._docs.length === 0) {
|
|
114
|
-
await this.
|
|
118
|
+
await this.load();
|
|
115
119
|
}
|
|
116
120
|
const filteredDocs = opts.category
|
|
117
121
|
? this._docs.filter(d => d.category === opts.category)
|
|
@@ -127,7 +131,7 @@ class DocsHelper {
|
|
|
127
131
|
*/
|
|
128
132
|
static async listCategories() {
|
|
129
133
|
if (this._docs.length === 0) {
|
|
130
|
-
await this.
|
|
134
|
+
await this.load();
|
|
131
135
|
}
|
|
132
136
|
const categories = new Set(this._docs.map(d => d.category));
|
|
133
137
|
return Array.from(categories).sort();
|
|
@@ -135,9 +139,9 @@ class DocsHelper {
|
|
|
135
139
|
/**
|
|
136
140
|
* Gets metadata about a specific document.
|
|
137
141
|
*/
|
|
138
|
-
static async
|
|
142
|
+
static async getDocumentMetadata(opts) {
|
|
139
143
|
if (this._docs.length === 0) {
|
|
140
|
-
await this.
|
|
144
|
+
await this.load();
|
|
141
145
|
}
|
|
142
146
|
const doc = this._docs.find(d => d.id === opts.id);
|
|
143
147
|
if (!doc) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.helper.js","sourceRoot":"","sources":["../../helpers/docs.helper.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA2B;AAC3B,sDAA2B;AAC3B,8DAAiC;AACjC,gEAAkC;AAClC,0DAA6B;AAC7B,sCAA8C;AAC9C,mDAAyC;AAezC,MAAa,UAAU;aACN,UAAK,GAAW,EAAE,CAAC;aACnB,UAAK,GAAsB,IAAI,CAAC;IAE/C;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,
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O;gBACL,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM;gBAC1D,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC;;AAzLH,gCA0LC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface IGithubError {
|
|
2
|
+
error: string;
|
|
3
|
+
status: number;
|
|
4
|
+
}
|
|
5
|
+
export interface IGithubFile {
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
type: 'file' | 'dir';
|
|
9
|
+
size: number;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IGithubContent {
|
|
13
|
+
content: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A helper class for interacting with the VENIZIA-AI/ignis GitHub repository.
|
|
17
|
+
*/
|
|
18
|
+
export declare class GithubHelper {
|
|
19
|
+
private static getApiUrl;
|
|
20
|
+
/**
|
|
21
|
+
* Fetches the contents of a directory from the GitHub repository.
|
|
22
|
+
* @param opts.path - The path to the directory from the repository root.
|
|
23
|
+
* @returns A promise that resolves to the directory content or an error object.
|
|
24
|
+
*/
|
|
25
|
+
static getDirectoryContents(opts?: {
|
|
26
|
+
path?: string;
|
|
27
|
+
}): Promise<IGithubFile[] | IGithubError>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetches the content of a specific file from the GitHub repository.
|
|
30
|
+
* @param opts.filePath - The path to the file from the repository root.
|
|
31
|
+
* @returns A promise that resolves to the file content or an error object.
|
|
32
|
+
*/
|
|
33
|
+
static getFileContent(opts: {
|
|
34
|
+
filePath: string;
|
|
35
|
+
}): Promise<IGithubContent | IGithubError>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=github.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.helper.d.ts","sourceRoot":"","sources":["../../helpers/github.helper.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,SAAS;IAKxB;;;;OAIG;WACU,oBAAoB,CAC/B,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAC3B,OAAO,CAAC,WAAW,EAAE,GAAG,YAAY,CAAC;IA8CxC;;;;OAIG;WACU,cAAc,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,GAAG,YAAY,CAAC;CA8BhG"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GithubHelper = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const logger_helper_1 = require("./logger.helper");
|
|
6
|
+
// --------------------------------------------------------------------------------------------------
|
|
7
|
+
// Helper function to create a standardized error response
|
|
8
|
+
const getError = (opts) => ({
|
|
9
|
+
error: opts.message,
|
|
10
|
+
status: opts.status || 500,
|
|
11
|
+
});
|
|
12
|
+
// --------------------------------------------------------------------------------------------------
|
|
13
|
+
/**
|
|
14
|
+
* A helper class for interacting with the VENIZIA-AI/ignis GitHub repository.
|
|
15
|
+
*/
|
|
16
|
+
class GithubHelper {
|
|
17
|
+
static getApiUrl(opts) {
|
|
18
|
+
const { apiBase, repoOwner, repoName } = common_1.MCPConfigs.github;
|
|
19
|
+
return [apiBase, common_1.MCPConfigs.github.repoPath, repoOwner, repoName, opts.path].join('/');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Fetches the contents of a directory from the GitHub repository.
|
|
23
|
+
* @param opts.path - The path to the directory from the repository root.
|
|
24
|
+
* @returns A promise that resolves to the directory content or an error object.
|
|
25
|
+
*/
|
|
26
|
+
static async getDirectoryContents(opts = {}) {
|
|
27
|
+
const dirPath = opts.path ?? '';
|
|
28
|
+
const { branch, userAgent } = common_1.MCPConfigs.github;
|
|
29
|
+
const url = this.getApiUrl({ path: `contents/${dirPath}?ref=${branch}` });
|
|
30
|
+
logger_helper_1.Logger.debug(`Fetching directory from GitHub: ${url}`);
|
|
31
|
+
try {
|
|
32
|
+
const response = await fetch(url, {
|
|
33
|
+
headers: {
|
|
34
|
+
'User-Agent': userAgent,
|
|
35
|
+
Accept: 'application/vnd.github.v3+json',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
logger_helper_1.Logger.error(`GitHub API error for path "${dirPath}": ${response.statusText}`);
|
|
40
|
+
return getError({ message: response.statusText, status: response.status });
|
|
41
|
+
}
|
|
42
|
+
const data = (await response.json());
|
|
43
|
+
if (!Array.isArray(data)) {
|
|
44
|
+
if (data.message) {
|
|
45
|
+
logger_helper_1.Logger.error(`GitHub API error for path "${dirPath}": ${data.message}`);
|
|
46
|
+
return getError({ message: data.message, status: 404 });
|
|
47
|
+
}
|
|
48
|
+
return getError({ message: 'Invalid response from GitHub API', status: 500 });
|
|
49
|
+
}
|
|
50
|
+
return data.map(item => ({
|
|
51
|
+
name: item.name,
|
|
52
|
+
path: item.path,
|
|
53
|
+
type: item.type, // 'file' or 'dir'
|
|
54
|
+
size: item.size,
|
|
55
|
+
url: item.html_url,
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
logger_helper_1.Logger.error(`Failed to fetch directory "${dirPath}" from GitHub:`, error);
|
|
60
|
+
return getError({
|
|
61
|
+
message: `Failed to fetch directory content. ${error instanceof Error ? error.message : ''}`,
|
|
62
|
+
status: 500,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Fetches the content of a specific file from the GitHub repository.
|
|
68
|
+
* @param opts.filePath - The path to the file from the repository root.
|
|
69
|
+
* @returns A promise that resolves to the file content or an error object.
|
|
70
|
+
*/
|
|
71
|
+
static async getFileContent(opts) {
|
|
72
|
+
const { rawContentBase, repoOwner, repoName, branch } = common_1.MCPConfigs.github;
|
|
73
|
+
// We use the raw content URL for files to avoid API rate limits and base64 decoding.
|
|
74
|
+
const url = [rawContentBase, repoOwner, repoName, branch, opts.filePath].join('/');
|
|
75
|
+
logger_helper_1.Logger.debug(`Fetching file content from GitHub: ${url}`);
|
|
76
|
+
try {
|
|
77
|
+
const response = await fetch(url);
|
|
78
|
+
const content = await response.text();
|
|
79
|
+
// Check if the fetch was successful. GitHub returns a "404: Not Found" string for missing files
|
|
80
|
+
// when using raw.githubusercontent.com, OR returns 404 status.
|
|
81
|
+
if (response.status === 404 || (typeof content === 'string' && content.startsWith('404'))) {
|
|
82
|
+
logger_helper_1.Logger.warn(`File not found on GitHub: ${opts.filePath}`);
|
|
83
|
+
return getError({ message: 'File not found', status: 404 });
|
|
84
|
+
}
|
|
85
|
+
if (!response.ok) {
|
|
86
|
+
return getError({ message: response.statusText, status: response.status });
|
|
87
|
+
}
|
|
88
|
+
return { content };
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
logger_helper_1.Logger.error(`Failed to fetch file "${opts.filePath}" from GitHub:`, error);
|
|
92
|
+
return getError({
|
|
93
|
+
message: `Failed to fetch file content. ${error instanceof Error ? error.message : ''}`,
|
|
94
|
+
status: 500,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.GithubHelper = GithubHelper;
|
|
100
|
+
//# sourceMappingURL=github.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.helper.js","sourceRoot":"","sources":["../../helpers/github.helper.ts"],"names":[],"mappings":";;;AAAA,sCAAuC;AACvC,mDAAyC;AAwBzC,qGAAqG;AACrG,0DAA0D;AAC1D,MAAM,QAAQ,GAAG,CAAC,IAA0C,EAAgB,EAAE,CAAC,CAAC;IAC9E,KAAK,EAAE,IAAI,CAAC,OAAO;IACnB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,GAAG;CAC3B,CAAC,CAAC;AAEH,qGAAqG;AACrG;;GAEG;AACH,MAAa,YAAY;IACf,MAAM,CAAC,SAAS,CAAC,IAAsB;QAC7C,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,mBAAU,CAAC,MAAM,CAAC;QAC3D,OAAO,CAAC,OAAO,EAAE,mBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAC/B,OAA0B,EAAE;QAE5B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAChC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAU,CAAC,MAAM,CAAC;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,OAAO,QAAQ,MAAM,EAAE,EAAE,CAAC,CAAC;QAC1E,sBAAM,CAAC,KAAK,CAAC,mCAAmC,GAAG,EAAE,CAAC,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C,EAAE,EAAE,CAAC;gBACjB,OAAO,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7E,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,sBAAM,CAAC,KAAK,CAAC,yBAAyB,IAAI,CAAC,QAAQ,gBAAgB,EAAE,KAAK,CAAC,CAAC;YAC5E,OAAO,QAAQ,CAAC;gBACd,OAAO,EAAE,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACvF,MAAM,EAAE,GAAG;aACZ,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA9FD,oCA8FC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./docs.helper"), exports);
|
|
18
18
|
__exportStar(require("./logger.helper"), exports);
|
|
19
|
+
__exportStar(require("./github.helper"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC;AAChC,kDAAgC"}
|
package/mcp-server/dist/index.js
CHANGED
|
@@ -2,59 +2,87 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const mcp_1 = require("@mastra/mcp");
|
|
5
|
+
const common_1 = require("./common");
|
|
5
6
|
const helpers_1 = require("./helpers");
|
|
6
7
|
const tools_1 = require("./tools");
|
|
7
8
|
// ----------------------------------------------------------------------------
|
|
8
9
|
// MCP SERVER CONFIGURATION
|
|
9
10
|
// ----------------------------------------------------------------------------
|
|
11
|
+
const mcpTools = {
|
|
12
|
+
// Documentation Tools
|
|
13
|
+
searchDocs: new tools_1.SearchDocsTool().getTool(),
|
|
14
|
+
getDocContent: new tools_1.GetDocContentTool().getTool(),
|
|
15
|
+
listDocs: new tools_1.ListDocsTool().getTool(),
|
|
16
|
+
listCategories: new tools_1.ListCategoriesTool().getTool(),
|
|
17
|
+
getDocMetadata: new tools_1.GetDocMetadataTool().getTool(),
|
|
18
|
+
getPackageOverview: new tools_1.GetPackageOverviewTool().getTool(),
|
|
19
|
+
// Code & Project Tools
|
|
20
|
+
searchCode: new tools_1.SearchCodeTool().getTool(),
|
|
21
|
+
listProjectFiles: new tools_1.ListProjectFilesTool().getTool(),
|
|
22
|
+
viewSourceFile: new tools_1.ViewSourceFileTool().getTool(),
|
|
23
|
+
verifyDependencies: new tools_1.VerifyDependenciesTool().getTool(),
|
|
24
|
+
};
|
|
25
|
+
const mcpReosources = {
|
|
26
|
+
listResources: async () => {
|
|
27
|
+
const docs = await helpers_1.DocsHelper.load();
|
|
28
|
+
return docs.map(doc => {
|
|
29
|
+
const wordCount = doc.content.split(/\s+/).filter(Boolean).length;
|
|
30
|
+
return {
|
|
31
|
+
uri: `ignis://docs/${doc.id}`,
|
|
32
|
+
name: doc.title,
|
|
33
|
+
description: `${doc.category} - ${wordCount} words`,
|
|
34
|
+
mimeType: 'text/markdown',
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
getResourceContent: async ({ uri }) => {
|
|
39
|
+
const id = uri.replace('ignis://docs/', '');
|
|
40
|
+
const content = await helpers_1.DocsHelper.getDocumentContent({ id });
|
|
41
|
+
if (content === null) {
|
|
42
|
+
return { text: `Resource not found: ${id}` };
|
|
43
|
+
}
|
|
44
|
+
return { text: content };
|
|
45
|
+
},
|
|
46
|
+
};
|
|
10
47
|
const mcpServer = new mcp_1.MCPServer({
|
|
11
|
-
name:
|
|
12
|
-
version:
|
|
48
|
+
name: common_1.MCPConfigs.server.name,
|
|
49
|
+
version: common_1.MCPConfigs.server.version,
|
|
13
50
|
// Register tools using singleton instances
|
|
14
|
-
tools:
|
|
15
|
-
search: new tools_1.SearchDocsTool().getTool(),
|
|
16
|
-
getDocContent: new tools_1.GetDocContentTool().getTool(),
|
|
17
|
-
listDocs: new tools_1.ListDocsTool().getTool(),
|
|
18
|
-
listCategories: new tools_1.ListCategoriesTool().getTool(),
|
|
19
|
-
getDocMetadata: new tools_1.GetDocMetadataTool().getTool(),
|
|
20
|
-
},
|
|
51
|
+
tools: mcpTools,
|
|
21
52
|
// Resource handlers for direct document access
|
|
22
|
-
resources:
|
|
23
|
-
listResources: async () => {
|
|
24
|
-
const docs = await helpers_1.DocsHelper.loadDocumentation();
|
|
25
|
-
return docs.map(doc => {
|
|
26
|
-
const wordCount = doc.content.split(/\s+/).filter(Boolean).length;
|
|
27
|
-
return {
|
|
28
|
-
uri: `ignis://docs/${doc.id}`,
|
|
29
|
-
name: doc.title,
|
|
30
|
-
description: `${doc.category} - ${wordCount} words`,
|
|
31
|
-
mimeType: "text/markdown",
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
getResourceContent: async ({ uri }) => {
|
|
36
|
-
const id = uri.replace("ignis://docs/", "");
|
|
37
|
-
const content = await helpers_1.DocsHelper.getDocContent({ id });
|
|
38
|
-
if (content === null) {
|
|
39
|
-
return { text: `Resource not found: ${id}` };
|
|
40
|
-
}
|
|
41
|
-
return { text: content };
|
|
42
|
-
},
|
|
43
|
-
},
|
|
53
|
+
resources: mcpReosources,
|
|
44
54
|
});
|
|
45
55
|
// ----------------------------------------------------------------------------
|
|
56
|
+
// CLI ARGUMENT PARSING
|
|
57
|
+
// ----------------------------------------------------------------------------
|
|
58
|
+
/**
|
|
59
|
+
* Parse CLI arguments for branch configuration.
|
|
60
|
+
* Usage: node index.js [branch]
|
|
61
|
+
* Example: node index.js develop
|
|
62
|
+
* Default: main
|
|
63
|
+
*/
|
|
64
|
+
const parseArgs = () => {
|
|
65
|
+
const args = process.argv.slice(2);
|
|
66
|
+
const branch = args[0] || 'main';
|
|
67
|
+
return { branch };
|
|
68
|
+
};
|
|
69
|
+
// ----------------------------------------------------------------------------
|
|
46
70
|
// SERVER INITIALIZATION
|
|
47
71
|
// ----------------------------------------------------------------------------
|
|
48
72
|
const main = async () => {
|
|
49
|
-
|
|
73
|
+
// Parse CLI arguments and configure branch
|
|
74
|
+
const { branch } = parseArgs();
|
|
75
|
+
common_1.MCPConfigs.setBranch({ branch });
|
|
76
|
+
helpers_1.Logger.info('[main] Initializing Ignis MCP Documentation Server...');
|
|
77
|
+
helpers_1.Logger.info(`[main] GitHub branch: ${common_1.MCPConfigs.github.branch}`);
|
|
50
78
|
try {
|
|
51
|
-
await helpers_1.DocsHelper.
|
|
52
|
-
helpers_1.Logger.info(
|
|
79
|
+
await helpers_1.DocsHelper.load();
|
|
80
|
+
helpers_1.Logger.info('[main] Documentation loaded successfully.');
|
|
53
81
|
await mcpServer.startStdio();
|
|
54
|
-
helpers_1.Logger.info(
|
|
82
|
+
helpers_1.Logger.info('[main] Server started in Stdio mode.');
|
|
55
83
|
}
|
|
56
84
|
catch (error) {
|
|
57
|
-
helpers_1.Logger.error(
|
|
85
|
+
helpers_1.Logger.error('Fatal error:', error);
|
|
58
86
|
process.exit(1);
|
|
59
87
|
}
|
|
60
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AACA,qCAAwC;AACxC,uCAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AACA,qCAAwC;AACxC,qCAAsC;AACtC,uCAA+C;AAC/C,mCAWiB;AAEjB,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,MAAM,QAAQ,GAAG;IACf,sBAAsB;IACtB,UAAU,EAAE,IAAI,sBAAc,EAAE,CAAC,OAAO,EAAE;IAC1C,aAAa,EAAE,IAAI,yBAAiB,EAAE,CAAC,OAAO,EAAE;IAChD,QAAQ,EAAE,IAAI,oBAAY,EAAE,CAAC,OAAO,EAAE;IACtC,cAAc,EAAE,IAAI,0BAAkB,EAAE,CAAC,OAAO,EAAE;IAClD,cAAc,EAAE,IAAI,0BAAkB,EAAE,CAAC,OAAO,EAAE;IAClD,kBAAkB,EAAE,IAAI,8BAAsB,EAAE,CAAC,OAAO,EAAE;IAE1D,uBAAuB;IACvB,UAAU,EAAE,IAAI,sBAAc,EAAE,CAAC,OAAO,EAAE;IAC1C,gBAAgB,EAAE,IAAI,4BAAoB,EAAE,CAAC,OAAO,EAAE;IACtD,cAAc,EAAE,IAAI,0BAAkB,EAAE,CAAC,OAAO,EAAE;IAClD,kBAAkB,EAAE,IAAI,8BAAsB,EAAE,CAAC,OAAO,EAAE;CAC3D,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,aAAa,EAAE,KAAK,IAAI,EAAE;QACxB,MAAM,IAAI,GAAG,MAAM,oBAAU,CAAC,IAAI,EAAE,CAAC;QAErC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACpB,MAAM,SAAS,GAAG,GAAG,CAA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C,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAEF,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,mBAAU,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEjC,gBAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IACrE,gBAAM,CAAC,IAAI,CAAC,yBAAyB,mBAAU,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAEjE,IAAI,CAAC;QACH,MAAM,oBAAU,CAAC,IAAI,EAAE,CAAC;QACxB,gBAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAEzD,MAAM,SAAS,CAAC,UAAU,EAAE,CAAC;QAC7B,gBAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAM,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { createTool } from
|
|
2
|
-
import type { z } from
|
|
1
|
+
import { createTool } from '@mastra/core/tools';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
3
|
/**
|
|
4
4
|
* The tool type returned by createTool.
|
|
5
5
|
*/
|
|
6
6
|
export type TMastraTool = ReturnType<typeof createTool>;
|
|
7
|
-
/**
|
|
8
|
-
* Re-export createTool for use in subclasses.
|
|
9
|
-
*/
|
|
10
|
-
export { createTool };
|
|
11
7
|
/**
|
|
12
8
|
* Abstract base class for all MCP documentation tools.
|
|
13
9
|
*
|
|
@@ -27,11 +23,11 @@ export { createTool };
|
|
|
27
23
|
* readonly inputSchema = InputSchema;
|
|
28
24
|
* readonly outputSchema = OutputSchema;
|
|
29
25
|
*
|
|
30
|
-
* async execute(
|
|
26
|
+
* async execute(opts: z.infer<typeof InputSchema>) {
|
|
31
27
|
* return { result: 'done' };
|
|
32
28
|
* }
|
|
33
29
|
*
|
|
34
|
-
*
|
|
30
|
+
* getTool() {
|
|
35
31
|
* return createTool({
|
|
36
32
|
* id: this.id,
|
|
37
33
|
* description: this.description,
|
|
@@ -43,7 +39,7 @@ export { createTool };
|
|
|
43
39
|
* }
|
|
44
40
|
* ```
|
|
45
41
|
*/
|
|
46
|
-
export declare abstract class BaseTool<TInputSchema extends z.ZodType
|
|
42
|
+
export declare abstract class BaseTool<TInputSchema extends z.ZodType, TOutputSchema extends z.ZodType> {
|
|
47
43
|
/**
|
|
48
44
|
* Unique identifier for the tool.
|
|
49
45
|
* Used by MCP clients to invoke the tool.
|
|
@@ -70,10 +66,10 @@ export declare abstract class BaseTool<TInputSchema extends z.ZodType = z.ZodTyp
|
|
|
70
66
|
/**
|
|
71
67
|
* Executes the tool's main logic.
|
|
72
68
|
*
|
|
73
|
-
* @param
|
|
69
|
+
* @param opts - Validated options object matching inputSchema
|
|
74
70
|
* @returns Promise resolving to output matching outputSchema
|
|
75
71
|
*/
|
|
76
|
-
abstract execute(
|
|
72
|
+
abstract execute(opts: z.infer<TInputSchema>): Promise<z.infer<TOutputSchema>>;
|
|
77
73
|
/**
|
|
78
74
|
* Converts this tool instance to a Mastra-compatible tool object.
|
|
79
75
|
* Must be implemented by each subclass to ensure proper type inference.
|
|
@@ -82,7 +78,7 @@ export declare abstract class BaseTool<TInputSchema extends z.ZodType = z.ZodTyp
|
|
|
82
78
|
*
|
|
83
79
|
* @example
|
|
84
80
|
* ```typescript
|
|
85
|
-
*
|
|
81
|
+
* getTool() {
|
|
86
82
|
* return createTool({
|
|
87
83
|
* id: this.id,
|
|
88
84
|
* description: this.description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.tool.d.ts","sourceRoot":"","sources":["../../tools/base.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"base.tool.d.ts","sourceRoot":"","sources":["../../tools/base.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAMxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,8BAAsB,QAAQ,CAAC,YAAY,SAAS,CAAC,CAAC,OAAO,EAAE,aAAa,SAAS,CAAC,CAAC,OAAO;IAC5F;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAEtC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IAE9C;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAE9E;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,OAAO,IAAI,WAAW;CAChC"}
|