You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'No relevant documentation found for the query: '+
34
+
query
35
+
}
36
+
]
37
+
};
38
+
}
27
39
28
-
// Score and sort the documentation entries
29
-
constscoredDocs=docLines
30
-
.map(line=>({
31
-
line,
32
-
score: getRelevanceScore(line,query)
33
-
}))
34
-
.sort((a,b)=>b.score-a.score)
35
-
.filter(doc=>doc.score>0)
36
-
.slice(0,3);// Get top 3 most relevant results
40
+
return{
41
+
content: [
42
+
{
43
+
type: 'text',
44
+
text: `This is the most relevant documentation for the query: ${url}`
45
+
}
46
+
]
47
+
};
48
+
}
49
+
);
37
50
38
-
consthasRelevantDocs=scoredDocs.length===0;
51
+
server.tool(
52
+
'sdk-route-finder',
53
+
"Searches through all available SDK documentation routes and returns relevant paths based on the user's query. This tool helps navigate the documentation by finding the most appropriate sections that match the search criteria.",
54
+
{
55
+
query: z.string()
56
+
.describe(`A refined search term extracted from the user's question.
57
+
For example, if user asks 'How do I create a pipe?', the query would be 'SDK Pipe'.
58
+
This should be the specific concept or topic to search for in the documentation.
59
+
Treat keyword add as create if user ask for Eg. 'How do I add memory to pipe?' the query should be 'create memory'`)
60
+
},
61
+
async({ query })=>{
62
+
constdocs=awaitfetchSdkDocsList();
63
+
consturl=findRelevantLink(docs,query);
39
64
40
-
if(hasRelevantDocs){
65
+
if(!url){
41
66
return{
42
67
content: [
43
68
{
@@ -50,22 +75,20 @@ export async function docsMcpServer() {
text: `This is the most relevant documentation for the query: ${url}`
60
83
}
61
84
]
62
85
};
63
86
}
64
87
);
65
88
66
89
server.tool(
67
-
'sdk-documentation-fetcher',
68
-
'Fetches detailed SDK documentation, specializing in implementation guides for core features like pipes, memory, and tools. This is the primary source for the latest SDK documentation and should be consulted first for questions about creating or implementing SDK components. Use this tool for detailed step-by-step instructions on building pipes, configuring memory systems, and developing custom tools.',
90
+
'sdk-docs-tool',
91
+
'Always First Use sdk-route-finder to find the most relevant documentation and then use this tool to fetch the detailed documentation.Fetches detailed SDK documentation, specializing in implementation guides for core features like pipes, memory, and tools. This is the primary source for the latest SDK documentation and should be consulted first for questions about creating or implementing SDK components. Use this tool for detailed step-by-step instructions on building pipes, configuring memory systems, and developing custom tools.',
69
92
{
70
93
url: z
71
94
.string()
@@ -90,7 +113,7 @@ export async function docsMcpServer() {
90
113
91
114
server.tool(
92
115
'examples-tool',
93
-
'Fetches code examples and sample implementations from the documentation. Use this tool when users specifically request examples, sample code, or implementation demonstrations. This tool provides practical code snippets and complete working examples that demonstrate how to implement various features.',
116
+
'Always first use docs-route-finder to find the most relevant documentation and then use this tool to fetch the detailed documentation. Fetches code examples and sample implementations from the documentation. Use this tool when users specifically request examples, sample code, or implementation demonstrations. This tool provides practical code snippets and complete working examples that demonstrate how to implement various features.',
94
117
{
95
118
url: z
96
119
.string()
@@ -115,7 +138,7 @@ export async function docsMcpServer() {
115
138
116
139
server.tool(
117
140
'guide-tool',
118
-
'Fetches detailed guides and tutorials from the documentation. Use this tool when users explicitly request guides, tutorials, or how-to content. This tool provides step-by-step instructions and practical examples for implementing various features.',
141
+
'Always first use docs-route-finder to find the most relevant documentation and then use this tool to fetch the detailed documentation. Fetches detailed guides and tutorials from the documentation. Use this tool when users explicitly request guides, tutorials, or how-to content. This tool provides step-by-step instructions and practical examples for implementing various features.',
119
142
{
120
143
url: z
121
144
.string()
@@ -140,7 +163,7 @@ export async function docsMcpServer() {
140
163
141
164
server.tool(
142
165
'api-reference-tool',
143
-
'Fetches API reference documentation. Use this tool ONLY when the user explicitly asks about API endpoints, REST API calls, or programmatically creating/updating/deleting resources (like pipes, memory, etc.) through the API interface. For general SDK implementation questions, use the sdk-documentation-fetcher instead.',
166
+
'Always first use docs-route-finder to find the most relevant documentation and then use this tool to fetch the detailed documentation. Fetches API reference documentation. Use this tool ONLY when the user explicitly asks about API endpoints, REST API calls, or programmatically creating/updating/deleting resources (like pipes, memory, etc.) through the API interface. For general SDK implementation questions, use the sdk-documentation-fetcher instead.',
0 commit comments