[mcp-server] Add more tools to mcp server#5215
Conversation
| ): Promise<ICommandResult> { | ||
| const commandPath: string = this._resolveCommand(command); | ||
|
|
||
| const result: child_process.SpawnSyncReturns<string> = Executable.spawnSync(commandPath, args, options); |
There was a problem hiding this comment.
This should probably be rewritten to use Executable.spawn(); otherwise the "async" function will block the MCP server process.
| type: 'text', | ||
| text: | ||
| `Project "${projectName}" migrated to subspace "${targetSubspaceName}" successfully. ` + | ||
| `You can ask whether user wants to run "rush update --subspace ${targetSubspaceName}" to update the project. ` + |
There was a problem hiding this comment.
| `You can ask whether user wants to run "rush update --subspace ${targetSubspaceName}" to update the project. ` + | |
| `You can ask whether the user wants to run "rush update --subspace ${targetSubspaceName}" to update the project. ` + |
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: `The package "${packageName}" does not exist in the Rush workspace. You can retrive package name from 'package.json' file in the project folder.` |
There was a problem hiding this comment.
| text: `The package "${packageName}" does not exist in the Rush workspace. You can retrive package name from 'package.json' file in the project folder.` | |
| text: `The package "${packageName}" does not exist in the Rush workspace. You can retrieve the package name from the 'package.json' file in the project folder.` |
| super({ | ||
| name: 'rush_docs', | ||
| description: | ||
| 'Search and retrieve relevant sections from Rush official documentation based on user queries.', |
There was a problem hiding this comment.
| 'Search and retrieve relevant sections from Rush official documentation based on user queries.', | |
| 'Search and retrieve relevant sections from the official Rush documentation based on user queries.', |
|
|
||
| public async executeAsync({ userQuery }: { userQuery: string }): Promise<CallToolResult> { | ||
| // An example of a knowledge base that can run, but needs to be replaced with Microsoft’s service. | ||
| const response: Response = await fetch('http://47.120.46.115/search', { |
There was a problem hiding this comment.
We should change this demo so that it doesn't rely on a black box.
If the code behind 47.120.46.115 is not too complex, maybe we could make it open source, or host it on the rushjs.io server. Otherwise, what happens 3 years from now when someone tries the demo? Most likely that IP address won't be running any more. 😄
But for demo/example purposes, it probably would be sufficient to rewrite this function so that it replies with static responses, e.g. from a JSON file.
There was a problem hiding this comment.
Another idea would be to use the duckduckgo.com web search:
const https = require('https');
const query = 'dogs';
const url = `https://api.duckduckgo.com/?q=${encodeURIComponent(query)}&format=json`;
https.get(url, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
try {
const json = JSON.parse(data);
console.log('Heading:', json.Heading);
console.log('Abstract:', json.Abstract);
console.log('Abstract URL:', json.AbstractURL);
if (json.RelatedTopics && json.RelatedTopics.length > 0) {
console.log('\nRelated Topics:');
json.RelatedTopics.forEach((topic, index) => {
if (topic.Text && topic.FirstURL) {
console.log(`${index + 1}. ${topic.Text}`);
console.log(topic.FirstURL);
}
});
}
} catch (e) {
console.error('Error parsing JSON:', e.message);
}
});
}).on('error', (err) => {
console.error('Request failed:', err.message);
});Output:
Heading: Dog
Abstract:
Abstract URL: https://en.wikipedia.org/wiki/Dog_(disambiguation)
Related Topics:
1. Dog A domesticated descendant of the gray wolf.
https://duckduckgo.com/Dog
2. Diogenes of Sinope An ancient Greek philosopher and one of the founders of Cynicism.
https://duckduckgo.com/Diogenes
3. Hot dog A dish consisting of a grilled, steamed, or boiled sausage served in the slit of a partially...
https://duckduckgo.com/Hot_dog
| text: | ||
| `Project "${projectName}" migrated to subspace "${targetSubspaceName}" successfully. ` + | ||
| `You can ask whether user wants to run "rush update --subspace ${targetSubspaceName}" to update the project. ` + | ||
| `If user says "yes" you can run "rush update --subspace ${targetSubspaceName}" directly for them.` |
There was a problem hiding this comment.
| `If user says "yes" you can run "rush update --subspace ${targetSubspaceName}" directly for them.` | |
| `If the user says "yes", you can run "rush update --subspace ${targetSubspaceName}" directly for them.` |
| "allowedCategories": [ "libraries", "tests", "vscode-extensions" ] | ||
| }, | ||
| { | ||
| "name": "zod", |
There was a problem hiding this comment.
Move this to nonbrowser-approved-packages.json
Uh oh!
There was an error while loading. Please reload this page.