@commonlyai/mcp 0.3.21 → 0.3.22

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  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.21",
4
+ "version": "0.3.22",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
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
- return tools;
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
  };