@commonlyai/mcp 0.3.21 → 0.3.23
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/package.json +2 -2
- package/src/tools.js +18 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commonlyai/mcp",
|
|
3
3
|
"mcpName": "io.github.Team-Commonly/commonly",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.23",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test": "node --experimental-vm-modules node_modules/.bin/jest"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
27
|
+
"@modelcontextprotocol/sdk": "^1.32.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"jest": "^29.7.0"
|
package/src/tools.js
CHANGED
|
@@ -653,5 +653,22 @@ export const buildTools = (config) => {
|
|
|
653
653
|
// as the machine's OWN GitHub identity rather than ours, and it supports
|
|
654
654
|
// line-level review comments, which these tools never did.
|
|
655
655
|
];
|
|
656
|
-
|
|
656
|
+
// A model can call a tool without an argument its schema requires; MCP
|
|
657
|
+
// clients do not enforce `required`. Interpolated into a path, a missing
|
|
658
|
+
// podId becomes the literal "undefined" and the backend answers 500, which
|
|
659
|
+
// tells the caller nothing. Refuse the call here and name the argument.
|
|
660
|
+
return tools.map((tool) => {
|
|
661
|
+
const keys = tool.inputSchema?.required || [];
|
|
662
|
+
if (keys.length === 0) return tool;
|
|
663
|
+
return {
|
|
664
|
+
...tool,
|
|
665
|
+
call: async (args = {}, ...rest) => {
|
|
666
|
+
const missing = keys.filter((key) => args?.[key] === undefined || args?.[key] === null || args?.[key] === '');
|
|
667
|
+
if (missing.length > 0) {
|
|
668
|
+
return err(new Error(`${tool.name}: missing required argument${missing.length > 1 ? 's' : ''} ${missing.join(', ')}`));
|
|
669
|
+
}
|
|
670
|
+
return tool.call(args, ...rest);
|
|
671
|
+
},
|
|
672
|
+
};
|
|
673
|
+
});
|
|
657
674
|
};
|