Skip to content

Commit 96f6905

Browse files
authored
Merge pull request #4 from VisLab/implement_interface
Full implmentation of the basic validation interface
2 parents a0d8731 + 9309187 commit 96f6905

31 files changed

+2688
-168
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ MCP for HED (Hierarchical Event Descriptor) validation
77
```bash
88
npm install https://github.com/hed-standard/hed-javascript.git
99
``
10+
11+
12+
## Running in the inspector
13+
14+
1. Must run `npm run build` to create a distribution in the `dist\` directory.
15+
2. Run: `npx @modelcontextprotocol/inspector node dist/server.js`

example-definition-usage.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Example of how to use the definition processor utilities
3+
*/
4+
5+
import { processDefinitions, createDefinitionManager } from './src/utils/definitionProcessor.js';
6+
import { buildSchemasFromVersion } from 'hed-validator';
7+
8+
async function exampleUsage() {
9+
// Load HED schemas
10+
const hedSchemas = await buildSchemasFromVersion('8.4.0');
11+
12+
// Example definition strings
13+
const definitionStrings = [
14+
'(Definition/MyColor, (Red))',
15+
'(Definition/MyAction, (Move))',
16+
'(Definition/InvalidDef, Red)' // This will cause an error
17+
];
18+
19+
// Process the definitions - now synchronous!
20+
console.log('Processing definitions...');
21+
const result = processDefinitions(definitionStrings, hedSchemas);
22+
23+
console.log('Result:', {
24+
success: result.success,
25+
processedCount: result.processedCount,
26+
failedCount: result.failedCount,
27+
issueCount: result.issues.length,
28+
definitionCount: result.definitionManager.definitions.size
29+
});
30+
31+
if (result.issues.length > 0) {
32+
console.log('Issues found:');
33+
result.issues.forEach(issue => {
34+
console.log(` ${issue.severity}: ${issue.message}`);
35+
});
36+
}
37+
38+
// If successful, the definition manager can be used for validation
39+
if (result.success) {
40+
console.log('Definitions in manager:');
41+
for (const [name, definition] of result.definitionManager.definitions) {
42+
console.log(` - ${name}: ${(definition as any).defContents?.normalized || 'No contents'}`);
43+
}
44+
}
45+
}
46+
47+
// Only run if this file is executed directly
48+
if (require.main === module) {
49+
exampleUsage().catch(console.error);
50+
}
51+
52+
export { exampleUsage };

mcp-config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"servers": {
3+
"hed-mcp": {
4+
"command": "node",
5+
"args": ["dist/server.js"],
6+
"cwd": "h:\\Repos\\hed-mcp-typescript"
7+
}
8+
}
9+
}

package-lock.json

Lines changed: 159 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)