assay-mcp-server 1.0.0
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/LICENSE +22 -0
- package/README.md +421 -0
- package/dist/firebase.d.ts +53 -0
- package/dist/firebase.d.ts.map +1 -0
- package/dist/firebase.js +123 -0
- package/dist/firebase.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +380 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/askQuestion.d.ts +9 -0
- package/dist/tools/askQuestion.d.ts.map +1 -0
- package/dist/tools/askQuestion.js +27 -0
- package/dist/tools/askQuestion.js.map +1 -0
- package/dist/tools/browseAllDocuments.d.ts +17 -0
- package/dist/tools/browseAllDocuments.d.ts.map +1 -0
- package/dist/tools/browseAllDocuments.js +44 -0
- package/dist/tools/browseAllDocuments.js.map +1 -0
- package/dist/tools/browseThemes.d.ts +19 -0
- package/dist/tools/browseThemes.d.ts.map +1 -0
- package/dist/tools/browseThemes.js +20 -0
- package/dist/tools/browseThemes.js.map +1 -0
- package/dist/tools/compareDocuments.d.ts +9 -0
- package/dist/tools/compareDocuments.d.ts.map +1 -0
- package/dist/tools/compareDocuments.js +52 -0
- package/dist/tools/compareDocuments.js.map +1 -0
- package/dist/tools/getDocumentSummary.d.ts +12 -0
- package/dist/tools/getDocumentSummary.d.ts.map +1 -0
- package/dist/tools/getDocumentSummary.js +29 -0
- package/dist/tools/getDocumentSummary.js.map +1 -0
- package/dist/tools/getLibraryInsight.d.ts +7 -0
- package/dist/tools/getLibraryInsight.d.ts.map +1 -0
- package/dist/tools/getLibraryInsight.js +14 -0
- package/dist/tools/getLibraryInsight.js.map +1 -0
- package/dist/tools/getSimilarDocuments.d.ts +25 -0
- package/dist/tools/getSimilarDocuments.d.ts.map +1 -0
- package/dist/tools/getSimilarDocuments.js +28 -0
- package/dist/tools/getSimilarDocuments.js.map +1 -0
- package/dist/tools/produceFaq.d.ts +50 -0
- package/dist/tools/produceFaq.d.ts.map +1 -0
- package/dist/tools/produceFaq.js +52 -0
- package/dist/tools/produceFaq.js.map +1 -0
- package/dist/tools/scoringUtils.d.ts +23 -0
- package/dist/tools/scoringUtils.d.ts.map +1 -0
- package/dist/tools/scoringUtils.js +61 -0
- package/dist/tools/scoringUtils.js.map +1 -0
- package/dist/tools/searchByAuthor.d.ts +15 -0
- package/dist/tools/searchByAuthor.d.ts.map +1 -0
- package/dist/tools/searchByAuthor.js +27 -0
- package/dist/tools/searchByAuthor.js.map +1 -0
- package/dist/tools/searchByKeywords.d.ts +16 -0
- package/dist/tools/searchByKeywords.d.ts.map +1 -0
- package/dist/tools/searchByKeywords.js +27 -0
- package/dist/tools/searchByKeywords.js.map +1 -0
- package/dist/tools/searchByTheme.d.ts +27 -0
- package/dist/tools/searchByTheme.d.ts.map +1 -0
- package/dist/tools/searchByTheme.js +27 -0
- package/dist/tools/searchByTheme.js.map +1 -0
- package/dist/tools/searchByTitle.d.ts +15 -0
- package/dist/tools/searchByTitle.d.ts.map +1 -0
- package/dist/tools/searchByTitle.js +27 -0
- package/dist/tools/searchByTitle.js.map +1 -0
- package/dist/tools/searchDocuments.d.ts +14 -0
- package/dist/tools/searchDocuments.d.ts.map +1 -0
- package/dist/tools/searchDocuments.js +28 -0
- package/dist/tools/searchDocuments.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDocumentSummary.d.ts","sourceRoot":"","sources":["../../src/tools/getDocumentSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,sBAAsB,EAAE,IAmBpC,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,WAAW,GAAE,eAAe,GAAG,QAAQ,GAAG,KAAuB,GAChE,OAAO,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAMD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const getDocumentSummaryTool = {
|
|
3
|
+
name: 'get_document_summary',
|
|
4
|
+
description: 'Get a specific summary (comprehensive, casual, or FAQ) for a document. Returns the summary text along with document metadata.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
documentId: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'The document ID to get the summary for',
|
|
11
|
+
},
|
|
12
|
+
summaryType: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
enum: ['comprehensive', 'casual', 'faq'],
|
|
15
|
+
description: 'Which summary type to retrieve (default: comprehensive)',
|
|
16
|
+
default: 'comprehensive',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['documentId'],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export async function getDocumentSummary(userId, documentId, token, summaryType = 'comprehensive') {
|
|
23
|
+
// Call Cloud Function instead of Firestore directly
|
|
24
|
+
return await callCloudFunction('mcpGetDocumentSummary', {
|
|
25
|
+
documentId,
|
|
26
|
+
summaryType,
|
|
27
|
+
}, token);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=getDocumentSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDocumentSummary.js","sourceRoot":"","sources":["../../src/tools/getDocumentSummary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC1C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,+HAA+H;IAC5I,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wCAAwC;aACtD;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,eAAe,EAAE,QAAQ,EAAE,KAAK,CAAC;gBACxC,WAAW,EAAE,yDAAyD;gBACtE,OAAO,EAAE,eAAe;aACzB;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,UAAkB,EAClB,KAAa,EACb,cAAkD,eAAe;IAUjE,oDAAoD;IACpD,OAAO,MAAM,iBAAiB,CAAC,uBAAuB,EAAE;QACtD,UAAU;QACV,WAAW;KACZ,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const getLibraryInsightTool: Tool;
|
|
3
|
+
export declare function getLibraryInsight(userId: string, token: string): Promise<{
|
|
4
|
+
insight: string;
|
|
5
|
+
generatedAt: string | null;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=getLibraryInsight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLibraryInsight.d.ts","sourceRoot":"","sources":["../../src/tools/getLibraryInsight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,qBAAqB,EAAE,IAOnC,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC,CAGD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const getLibraryInsightTool = {
|
|
3
|
+
name: 'get_library_insight',
|
|
4
|
+
description: 'Get the AI-generated personalized insight about your research profile. This insight analyzes your document collection and provides observations about your research focus and theme intersections.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {},
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export async function getLibraryInsight(userId, token) {
|
|
11
|
+
// Call Cloud Function instead of Firestore directly
|
|
12
|
+
return await callCloudFunction('mcpGetLibraryInsight', {}, token);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=getLibraryInsight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLibraryInsight.js","sourceRoot":"","sources":["../../src/tools/getLibraryInsight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,qBAAqB,GAAS;IACzC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,oMAAoM;IACjN,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE;KACf;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAc,EACd,KAAa;IAKb,oDAAoD;IACpD,OAAO,MAAM,iBAAiB,CAAC,sBAAsB,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const getSimilarDocumentsTool: Tool;
|
|
3
|
+
export declare function getSimilarDocuments(userId: string, documentId: string, token: string, limit?: number): Promise<{
|
|
4
|
+
sourceDocument: {
|
|
5
|
+
documentId: string;
|
|
6
|
+
title: string;
|
|
7
|
+
themes: {
|
|
8
|
+
l1Themes: string[];
|
|
9
|
+
l0Themes: string[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
similarDocuments: Array<{
|
|
13
|
+
documentId: string;
|
|
14
|
+
title: string;
|
|
15
|
+
authors: string[];
|
|
16
|
+
similarityScore: number;
|
|
17
|
+
overlappingThemes: {
|
|
18
|
+
l1Themes: string[];
|
|
19
|
+
l0Themes: string[];
|
|
20
|
+
};
|
|
21
|
+
createdAt: string;
|
|
22
|
+
visibility: 'public' | 'private';
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=getSimilarDocuments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSimilarDocuments.d.ts","sourceRoot":"","sources":["../../src/tools/getSimilarDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,uBAAuB,EAAE,IAkBrC,CAAC;AAEF,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC;IACT,cAAc,EAAE;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE;YAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;KACpD,CAAC;IACF,gBAAgB,EAAE,KAAK,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,iBAAiB,EAAE;YAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;QAC9D,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;KAClC,CAAC,CAAC;CACJ,CAAC,CAMD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const getSimilarDocumentsTool = {
|
|
3
|
+
name: 'get_similar_documents',
|
|
4
|
+
description: 'Find documents similar to a given document using theme overlap (Jaccard similarity). Returns similar documents with similarity scores and explanation of why they matched.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
documentId: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'The document ID to find similar documents for',
|
|
11
|
+
},
|
|
12
|
+
limit: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Maximum number of similar documents to return (default: 10)',
|
|
15
|
+
default: 10,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ['documentId'],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export async function getSimilarDocuments(userId, documentId, token, limit = 10) {
|
|
22
|
+
// Call Cloud Function instead of Firestore directly
|
|
23
|
+
return await callCloudFunction('mcpGetSimilarDocuments', {
|
|
24
|
+
documentId,
|
|
25
|
+
limit,
|
|
26
|
+
}, token);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=getSimilarDocuments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSimilarDocuments.js","sourceRoot":"","sources":["../../src/tools/getSimilarDocuments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAAS;IAC3C,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,4KAA4K;IACzL,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+CAA+C;aAC7D;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6DAA6D;gBAC1E,OAAO,EAAE,EAAE;aACZ;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAc,EACd,UAAkB,EAClB,KAAa,EACb,QAAgB,EAAE;IAiBlB,oDAAoD;IACpD,OAAO,MAAM,iBAAiB,CAAC,wBAAwB,EAAE;QACvD,UAAU;QACV,KAAK;KACN,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const produceFaqTool: Tool;
|
|
3
|
+
export declare function produceFaq(userId: string, token: string, themes?: string[], keywords?: string[], authors?: string[]): Promise<{
|
|
4
|
+
synthesized?: boolean;
|
|
5
|
+
content?: string;
|
|
6
|
+
rawData?: {
|
|
7
|
+
summary: {
|
|
8
|
+
total_documents: number;
|
|
9
|
+
total_faqs: number;
|
|
10
|
+
key_themes: {
|
|
11
|
+
[theme: string]: number;
|
|
12
|
+
};
|
|
13
|
+
top_documents_by_faq_count: Array<{
|
|
14
|
+
title: string;
|
|
15
|
+
faq_count: number;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
featured_document: {
|
|
19
|
+
title: string;
|
|
20
|
+
authors: string[];
|
|
21
|
+
why_featured: string;
|
|
22
|
+
sample_faqs: Array<{
|
|
23
|
+
question: string;
|
|
24
|
+
answer: string;
|
|
25
|
+
}>;
|
|
26
|
+
unique_findings: string[];
|
|
27
|
+
} | null;
|
|
28
|
+
documents: Array<{
|
|
29
|
+
documentId: string;
|
|
30
|
+
title: string;
|
|
31
|
+
authors: string[];
|
|
32
|
+
themes: Array<{
|
|
33
|
+
id: string;
|
|
34
|
+
label: string;
|
|
35
|
+
level: 'L0' | 'L1';
|
|
36
|
+
parent_id?: string;
|
|
37
|
+
}>;
|
|
38
|
+
faqs: Array<{
|
|
39
|
+
question: string;
|
|
40
|
+
answer: string;
|
|
41
|
+
}>;
|
|
42
|
+
unique_findings: string[];
|
|
43
|
+
faq_count: number;
|
|
44
|
+
}>;
|
|
45
|
+
count: number;
|
|
46
|
+
totalMatches: number;
|
|
47
|
+
};
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}>;
|
|
50
|
+
//# sourceMappingURL=produceFaq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"produceFaq.d.ts","sourceRoot":"","sources":["../../src/tools/produceFaq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,cAAc,EAAE,IA0C5B,CAAC;AAEF,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EAAE,EACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,EACnB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC;IACT,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QACR,OAAO,EAAE;YACP,eAAe,EAAE,MAAM,CAAC;YACxB,UAAU,EAAE,MAAM,CAAC;YACnB,UAAU,EAAE;gBAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;aAAE,CAAC;YACxC,0BAA0B,EAAE,KAAK,CAAC;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;SACzE,CAAC;QACF,iBAAiB,EAAE;YACjB,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,EAAE,MAAM,EAAE,CAAC;YAClB,YAAY,EAAE,MAAM,CAAC;YACrB,WAAW,EAAE,KAAK,CAAC;gBAAE,QAAQ,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;YACzD,eAAe,EAAE,MAAM,EAAE,CAAC;SAC3B,GAAG,IAAI,CAAC;QACT,SAAS,EAAE,KAAK,CAAC;YACf,UAAU,EAAE,MAAM,CAAC;YACnB,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,EAAE,MAAM,EAAE,CAAC;YAClB,MAAM,EAAE,KAAK,CAAC;gBAAE,EAAE,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;gBAAC,SAAS,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;YACrF,IAAI,EAAE,KAAK,CAAC;gBAAE,QAAQ,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;YAClD,eAAe,EAAE,MAAM,EAAE,CAAC;YAC1B,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC,CAAC;QACH,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC,CAMD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const produceFaqTool = {
|
|
3
|
+
name: 'produce_faq',
|
|
4
|
+
description: `Generate FAQs from up to 25 documents selected by themes, keywords, or authors. Returns lightweight data (FAQs only, no comprehensive summaries) with a data summary, featured document, and unique findings per document.
|
|
5
|
+
|
|
6
|
+
CRITICAL INSTRUCTION: The returned data contains ACTUAL content from the user's document collection.
|
|
7
|
+
|
|
8
|
+
BEFORE synthesizing your FAQ response, you MUST:
|
|
9
|
+
1. Display the data summary showing total documents and FAQ counts
|
|
10
|
+
2. Review the featured document's sample FAQs (provided inline)
|
|
11
|
+
3. Extract and show 3 diverse sample Q&A pairs from different documents
|
|
12
|
+
4. State which themes you identified from the ACTUAL questions
|
|
13
|
+
|
|
14
|
+
FORBIDDEN:
|
|
15
|
+
- Synthesizing from your training knowledge instead of the returned data
|
|
16
|
+
- Proceeding to synthesis without showing samples
|
|
17
|
+
- If you do this, you are FAILING the user's request
|
|
18
|
+
|
|
19
|
+
After verification, synthesize a comprehensive FAQ that:
|
|
20
|
+
- Draws from ALL returned FAQs, not just samples shown
|
|
21
|
+
- Attributes specific findings to source documents
|
|
22
|
+
- Uses actual statistics/numbers from the data
|
|
23
|
+
- Incorporates unique findings highlighted in the data`,
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
themes: {
|
|
28
|
+
type: 'array',
|
|
29
|
+
items: { type: 'string' },
|
|
30
|
+
description: 'Array of theme IDs to match (e.g., ["CYBERSECURITY", "ARTIFICIAL_INTELLIGENCE.AI_ARCHITECTURES"]). Use browse_themes to discover valid theme IDs.',
|
|
31
|
+
},
|
|
32
|
+
keywords: {
|
|
33
|
+
type: 'array',
|
|
34
|
+
items: { type: 'string' },
|
|
35
|
+
description: 'Array of keywords to match',
|
|
36
|
+
},
|
|
37
|
+
authors: {
|
|
38
|
+
type: 'array',
|
|
39
|
+
items: { type: 'string' },
|
|
40
|
+
description: 'Array of author names to match',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export async function produceFaq(userId, token, themes, keywords, authors) {
|
|
46
|
+
return await callCloudFunction('mcpProduceFaq', {
|
|
47
|
+
themes,
|
|
48
|
+
keywords,
|
|
49
|
+
authors,
|
|
50
|
+
}, token);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=produceFaq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"produceFaq.js","sourceRoot":"","sources":["../../src/tools/produceFaq.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;uDAmBwC;IACrD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,mJAAmJ;aACjK;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,4BAA4B;aAC1C;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,gCAAgC;aAC9C;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,KAAa,EACb,MAAiB,EACjB,QAAmB,EACnB,OAAkB;IAiClB,OAAO,MAAM,iBAAiB,CAAC,eAAe,EAAE;QAC9C,MAAM;QACN,QAAQ;QACR,OAAO;KACR,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility functions for document scoring and relevance calculation
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Calculate Jaccard similarity for themes (weighted: L1=0.8, L0=0.2)
|
|
6
|
+
*/
|
|
7
|
+
export declare function calculateThemeJaccard(queryThemesL1: string[], queryThemesL0: string[], docThemesL1: string[], docThemesL0: string[]): number;
|
|
8
|
+
/**
|
|
9
|
+
* Calculate Jaccard similarity for keywords or authors
|
|
10
|
+
*/
|
|
11
|
+
export declare function calculateSetJaccard(set1: string[], set2: string[]): number;
|
|
12
|
+
/**
|
|
13
|
+
* Calculate overall relevance score combining themes, keywords, and authors
|
|
14
|
+
*/
|
|
15
|
+
export declare function calculateRelevanceScore(themeScore: number, keywordScore: number, authorScore: number, hasThemes: boolean, hasKeywords: boolean, hasAuthors: boolean): number;
|
|
16
|
+
/**
|
|
17
|
+
* Get similarity level label based on score
|
|
18
|
+
* HIGH: >= 0.35 (35%)
|
|
19
|
+
* MODERATE: >= 0.20 (20%)
|
|
20
|
+
* LOW: < 0.20 (< 20%)
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSimilarityLevel(score: number): 'High' | 'Moderate' | 'Low';
|
|
23
|
+
//# sourceMappingURL=scoringUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoringUtils.d.ts","sourceRoot":"","sources":["../../src/tools/scoringUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EAAE,EACvB,aAAa,EAAE,MAAM,EAAE,EACvB,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,EAAE,MAAM,EAAE,GACpB,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAO1E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,OAAO,EACpB,UAAU,EAAE,OAAO,GAClB,MAAM,CAoBR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAI7E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility functions for document scoring and relevance calculation
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Calculate Jaccard similarity for themes (weighted: L1=0.8, L0=0.2)
|
|
6
|
+
*/
|
|
7
|
+
export function calculateThemeJaccard(queryThemesL1, queryThemesL0, docThemesL1, docThemesL0) {
|
|
8
|
+
const l1Intersection = new Set(queryThemesL1.filter(t => docThemesL1.includes(t)));
|
|
9
|
+
const l1Union = new Set([...queryThemesL1, ...docThemesL1]);
|
|
10
|
+
const l1Jaccard = l1Union.size > 0 ? l1Intersection.size / l1Union.size : 0;
|
|
11
|
+
const l0Intersection = new Set(queryThemesL0.filter(t => docThemesL0.includes(t)));
|
|
12
|
+
const l0Union = new Set([...queryThemesL0, ...docThemesL0]);
|
|
13
|
+
const l0Jaccard = l0Union.size > 0 ? l0Intersection.size / l0Union.size : 0;
|
|
14
|
+
return 0.8 * l1Jaccard + 0.2 * l0Jaccard;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Calculate Jaccard similarity for keywords or authors
|
|
18
|
+
*/
|
|
19
|
+
export function calculateSetJaccard(set1, set2) {
|
|
20
|
+
if (set1.length === 0 && set2.length === 0)
|
|
21
|
+
return 0;
|
|
22
|
+
const intersection = new Set(set1.filter(item => set2.includes(item)));
|
|
23
|
+
const union = new Set([...set1, ...set2]);
|
|
24
|
+
return union.size > 0 ? intersection.size / union.size : 0;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Calculate overall relevance score combining themes, keywords, and authors
|
|
28
|
+
*/
|
|
29
|
+
export function calculateRelevanceScore(themeScore, keywordScore, authorScore, hasThemes, hasKeywords, hasAuthors) {
|
|
30
|
+
// Weight: themes = 0.6, keywords = 0.25, authors = 0.15
|
|
31
|
+
// Only include scores for criteria that were provided
|
|
32
|
+
let totalWeight = 0;
|
|
33
|
+
let weightedSum = 0;
|
|
34
|
+
if (hasThemes) {
|
|
35
|
+
weightedSum += 0.6 * themeScore;
|
|
36
|
+
totalWeight += 0.6;
|
|
37
|
+
}
|
|
38
|
+
if (hasKeywords) {
|
|
39
|
+
weightedSum += 0.25 * keywordScore;
|
|
40
|
+
totalWeight += 0.25;
|
|
41
|
+
}
|
|
42
|
+
if (hasAuthors) {
|
|
43
|
+
weightedSum += 0.15 * authorScore;
|
|
44
|
+
totalWeight += 0.15;
|
|
45
|
+
}
|
|
46
|
+
return totalWeight > 0 ? weightedSum / totalWeight : 0;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get similarity level label based on score
|
|
50
|
+
* HIGH: >= 0.35 (35%)
|
|
51
|
+
* MODERATE: >= 0.20 (20%)
|
|
52
|
+
* LOW: < 0.20 (< 20%)
|
|
53
|
+
*/
|
|
54
|
+
export function getSimilarityLevel(score) {
|
|
55
|
+
if (score >= 0.35)
|
|
56
|
+
return 'High';
|
|
57
|
+
if (score >= 0.20)
|
|
58
|
+
return 'Moderate';
|
|
59
|
+
return 'Low';
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=scoringUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoringUtils.js","sourceRoot":"","sources":["../../src/tools/scoringUtils.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const searchByAuthorTool: Tool;
|
|
3
|
+
export declare function searchByAuthor(userId: string, authorName: string, token: string, limit?: number): Promise<{
|
|
4
|
+
documents: Array<{
|
|
5
|
+
documentId: string;
|
|
6
|
+
title: string;
|
|
7
|
+
authors: string[];
|
|
8
|
+
createdAt: string;
|
|
9
|
+
themes: string[];
|
|
10
|
+
visibility: 'public' | 'private';
|
|
11
|
+
}>;
|
|
12
|
+
count: number;
|
|
13
|
+
totalMatches: number;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=searchByAuthor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchByAuthor.d.ts","sourceRoot":"","sources":["../../src/tools/searchByAuthor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,kBAAkB,EAAE,IAkBhC,CAAC;AAEF,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC;IACT,SAAS,EAAE,KAAK,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;KAClC,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAKD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const searchByAuthorTool = {
|
|
3
|
+
name: 'search_by_author',
|
|
4
|
+
description: 'Search your Assay library (both private and public collections) by author name. Returns matching documents with their themes and metadata.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
authorName: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Author name to search for (e.g., "Brian Singer", "Anthropic", "OpenAI")',
|
|
11
|
+
},
|
|
12
|
+
limit: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Maximum number of results to return (default: 20)',
|
|
15
|
+
default: 20,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ['authorName'],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export async function searchByAuthor(userId, authorName, token, limit = 20) {
|
|
22
|
+
return await callCloudFunction('mcpSearchByAuthor', {
|
|
23
|
+
authorName,
|
|
24
|
+
limit,
|
|
25
|
+
}, token);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=searchByAuthor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchByAuthor.js","sourceRoot":"","sources":["../../src/tools/searchByAuthor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,4IAA4I;IACzJ,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yEAAyE;aACvF;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;gBAChE,OAAO,EAAE,EAAE;aACZ;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,UAAkB,EAClB,KAAa,EACb,QAAgB,EAAE;IAalB,OAAO,MAAM,iBAAiB,CAAC,mBAAmB,EAAE;QAClD,UAAU;QACV,KAAK;KACN,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const searchByKeywordsTool: Tool;
|
|
3
|
+
export declare function searchByKeywords(userId: string, keywords: string, token: string, limit?: number): Promise<{
|
|
4
|
+
documents: Array<{
|
|
5
|
+
documentId: string;
|
|
6
|
+
title: string;
|
|
7
|
+
authors: string[];
|
|
8
|
+
createdAt: string;
|
|
9
|
+
themes: string[];
|
|
10
|
+
visibility: 'public' | 'private';
|
|
11
|
+
score: number;
|
|
12
|
+
}>;
|
|
13
|
+
count: number;
|
|
14
|
+
totalMatches: number;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=searchByKeywords.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchByKeywords.d.ts","sourceRoot":"","sources":["../../src/tools/searchByKeywords.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,oBAAoB,EAAE,IAkBlC,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC;IACT,SAAS,EAAE,KAAK,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;QACjC,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAKD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const searchByKeywordsTool = {
|
|
3
|
+
name: 'search_by_keywords',
|
|
4
|
+
description: 'Search your Assay library (both private and public collections) by keywords. Searches in document keywords, key concepts, and key phrases extracted from documents.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
keywords: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Keywords to search for (can be comma-separated or space-separated, e.g., "machine learning, neural networks" or "zero trust architecture")',
|
|
11
|
+
},
|
|
12
|
+
limit: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Maximum number of results to return (default: 20)',
|
|
15
|
+
default: 20,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ['keywords'],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export async function searchByKeywords(userId, keywords, token, limit = 20) {
|
|
22
|
+
return await callCloudFunction('mcpSearchByKeywords', {
|
|
23
|
+
keywords,
|
|
24
|
+
limit,
|
|
25
|
+
}, token);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=searchByKeywords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchByKeywords.js","sourceRoot":"","sources":["../../src/tools/searchByKeywords.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAS;IACxC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,qKAAqK;IAClL,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4IAA4I;aAC1J;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;gBAChE,OAAO,EAAE,EAAE;aACZ;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,CAAC;KACvB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,QAAgB,EAChB,KAAa,EACb,QAAgB,EAAE;IAclB,OAAO,MAAM,iBAAiB,CAAC,qBAAqB,EAAE;QACpD,QAAQ;QACR,KAAK;KACN,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const searchByThemeTool: Tool;
|
|
3
|
+
export declare function searchByTheme(userId: string, themeQuery: string, token: string, limit?: number): Promise<{
|
|
4
|
+
documents: Array<{
|
|
5
|
+
documentId: string;
|
|
6
|
+
title: string;
|
|
7
|
+
authors: string[];
|
|
8
|
+
createdAt: string;
|
|
9
|
+
themes: Array<{
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
level: 'L0' | 'L1';
|
|
13
|
+
parent_id?: string;
|
|
14
|
+
}>;
|
|
15
|
+
themes_l0: string[];
|
|
16
|
+
themes_l1: string[];
|
|
17
|
+
visibility: 'public' | 'private';
|
|
18
|
+
}>;
|
|
19
|
+
count: number;
|
|
20
|
+
totalMatches: number;
|
|
21
|
+
matchedThemeIds: string[];
|
|
22
|
+
matchedThemes: Array<{
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=searchByTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchByTheme.d.ts","sourceRoot":"","sources":["../../src/tools/searchByTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,iBAAiB,EAAE,IAkB/B,CAAC;AAEF,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC;IACT,SAAS,EAAE,KAAK,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACrF,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;KAClC,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD,CAAC,CAKD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const searchByThemeTool = {
|
|
3
|
+
name: 'search_by_theme',
|
|
4
|
+
description: 'Search your Assay library (both private and public collections) by theme. Accepts theme ID (e.g., "CYBER_SECURITY.THREAT_MODELING"), theme label (e.g., "Threat Modeling and Risk Analysis"), or natural language (e.g., "threat modeling"). Returns matching documents with full theme metadata including IDs and labels. Use browse_themes first to discover available themes.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
themeQuery: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Theme query - can be full theme ID (e.g., "CYBER_SECURITY.THREAT_MODELING"), theme label (e.g., "Threat Modeling and Risk Analysis"), or natural language (e.g., "threat modeling"). The tool uses fuzzy matching to find relevant themes.',
|
|
11
|
+
},
|
|
12
|
+
limit: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Maximum number of results to return (default: 20)',
|
|
15
|
+
default: 20,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ['themeQuery'],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export async function searchByTheme(userId, themeQuery, token, limit = 20) {
|
|
22
|
+
return await callCloudFunction('mcpSearchByTheme', {
|
|
23
|
+
themeQuery,
|
|
24
|
+
limit,
|
|
25
|
+
}, token);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=searchByTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchByTheme.js","sourceRoot":"","sources":["../../src/tools/searchByTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,kXAAkX;IAC/X,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4OAA4O;aAC1P;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;gBAChE,OAAO,EAAE,EAAE;aACZ;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAc,EACd,UAAkB,EAClB,KAAa,EACb,QAAgB,EAAE;IAiBlB,OAAO,MAAM,iBAAiB,CAAC,kBAAkB,EAAE;QACjD,UAAU;QACV,KAAK;KACN,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const searchByTitleTool: Tool;
|
|
3
|
+
export declare function searchByTitle(userId: string, titleQuery: string, token: string, limit?: number): Promise<{
|
|
4
|
+
documents: Array<{
|
|
5
|
+
documentId: string;
|
|
6
|
+
title: string;
|
|
7
|
+
authors: string[];
|
|
8
|
+
createdAt: string;
|
|
9
|
+
themes: string[];
|
|
10
|
+
visibility: 'public' | 'private';
|
|
11
|
+
}>;
|
|
12
|
+
count: number;
|
|
13
|
+
totalMatches: number;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=searchByTitle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchByTitle.d.ts","sourceRoot":"","sources":["../../src/tools/searchByTitle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,iBAAiB,EAAE,IAkB/B,CAAC;AAEF,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC;IACT,SAAS,EAAE,KAAK,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;KAClC,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAKD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const searchByTitleTool = {
|
|
3
|
+
name: 'search_by_title',
|
|
4
|
+
description: 'Search your Assay library (both private and public collections) by document title. Returns matching documents with their themes and metadata.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
titleQuery: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Title keywords to search for (e.g., "LLM safety", "red teaming", "zero trust")',
|
|
11
|
+
},
|
|
12
|
+
limit: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Maximum number of results to return (default: 20)',
|
|
15
|
+
default: 20,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ['titleQuery'],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export async function searchByTitle(userId, titleQuery, token, limit = 20) {
|
|
22
|
+
return await callCloudFunction('mcpSearchByTitle', {
|
|
23
|
+
titleQuery,
|
|
24
|
+
limit,
|
|
25
|
+
}, token);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=searchByTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchByTitle.js","sourceRoot":"","sources":["../../src/tools/searchByTitle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,+IAA+I;IAC5J,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gFAAgF;aAC9F;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;gBAChE,OAAO,EAAE,EAAE;aACZ;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAc,EACd,UAAkB,EAClB,KAAa,EACb,QAAgB,EAAE;IAalB,OAAO,MAAM,iBAAiB,CAAC,kBAAkB,EAAE;QACjD,UAAU;QACV,KAAK;KACN,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const searchDocumentsTool: Tool;
|
|
3
|
+
export declare function searchDocuments(userId: string, query: string, token: string, limit?: number): Promise<{
|
|
4
|
+
documents: Array<{
|
|
5
|
+
documentId: string;
|
|
6
|
+
title: string;
|
|
7
|
+
authors: string[];
|
|
8
|
+
createdAt: string;
|
|
9
|
+
themes: string[];
|
|
10
|
+
visibility: 'public' | 'private';
|
|
11
|
+
}>;
|
|
12
|
+
count: number;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=searchDocuments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchDocuments.d.ts","sourceRoot":"","sources":["../../src/tools/searchDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,mBAAmB,EAAE,IAkBjC,CAAC;AAEF,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC;IACT,SAAS,EAAE,KAAK,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;KAClC,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAMD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { callCloudFunction } from '../firebase.js';
|
|
2
|
+
export const searchDocumentsTool = {
|
|
3
|
+
name: 'search_documents',
|
|
4
|
+
description: 'Search your Assay library (both private and public collections) by theme name, author, or document title. Returns matching documents with full theme metadata including IDs (e.g., "CYBER_SECURITY.THREAT_MODELING") and labels (e.g., "Threat Modeling and Risk Analysis"). Theme queries use fuzzy matching - you can search by ID, label, or natural language.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
query: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Search query - can be a theme name (e.g., "AI Safety", "Zero Trust"), author name, or document title keywords',
|
|
11
|
+
},
|
|
12
|
+
limit: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Maximum number of results to return (default: 20)',
|
|
15
|
+
default: 20,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ['query'],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export async function searchDocuments(userId, query, token, limit = 20) {
|
|
22
|
+
// Call Cloud Function instead of Firestore directly
|
|
23
|
+
return await callCloudFunction('mcpSearchDocuments', {
|
|
24
|
+
query,
|
|
25
|
+
limit,
|
|
26
|
+
}, token);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=searchDocuments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchDocuments.js","sourceRoot":"","sources":["../../src/tools/searchDocuments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,mBAAmB,GAAS;IACvC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mWAAmW;IAChX,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+GAA+G;aAC7H;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;gBAChE,OAAO,EAAE,EAAE;aACZ;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAc,EACd,KAAa,EACb,KAAa,EACb,QAAgB,EAAE;IAYlB,oDAAoD;IACpD,OAAO,MAAM,iBAAiB,CAAC,oBAAoB,EAAE;QACnD,KAAK;QACL,KAAK;KACN,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
|