-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathfind-examples-basic.ts
More file actions
48 lines (40 loc) · 1.26 KB
/
find-examples-basic.ts
File metadata and controls
48 lines (40 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { exec, ProcessOutput, silentNpm } from '../../utils/process';
import assert from 'node:assert/strict';
const MCP_INSPECTOR_PACKAGE_NAME = '@modelcontextprotocol/inspector-cli';
const MCP_INSPECTOR_PACKAGE_VERSION = '0.16.2';
const MCP_INSPECTOR_COMMAND_NAME = 'mcp-inspector-cli';
async function runInspector(...args: string[]): Promise<ProcessOutput> {
const result = await exec(
MCP_INSPECTOR_COMMAND_NAME,
'--cli',
'npx',
'--no',
'@angular/cli',
'mcp',
...args,
);
return result;
}
export default async function () {
const [nodeMajor, nodeMinor] = process.versions.node.split('.', 2).map(Number);
if (nodeMajor < 22 || (nodeMajor === 22 && nodeMinor < 16)) {
console.log('Test bypassed: find_examples tool requires Node.js 22.16 or higher.');
return;
}
await silentNpm(
'install',
'--ignore-scripts',
'-g',
`${MCP_INSPECTOR_PACKAGE_NAME}@${MCP_INSPECTOR_PACKAGE_VERSION}`,
);
// Ensure `get_best_practices` returns the markdown content
const { stdout: stdoutInsideWorkspace } = await runInspector(
'--method',
'tools/call',
'--tool-name',
'find_examples',
'--tool-arg',
'query=if',
);
assert.match(stdoutInsideWorkspace, /Using the @if Built-in Control Flow Block/);
}