kibi-mcp 3.13.0 → 3.14.2
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/dist/server/tools.js +27 -2
- package/package.json +3 -3
package/dist/server/tools.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
import process from "node:process";
|
|
19
|
-
import { QUERY_LIMIT_EXCEEDED_CODE, detachedReadOnlyDiagnostic, executeOperation, queryLimitExceededOf, } from "kibi-runtime";
|
|
19
|
+
import { QUERY_LIMIT_EXCEEDED_CODE, codedErrorOf, detachedReadOnlyDiagnostic, executeOperation, queryLimitExceededOf, } from "kibi-runtime";
|
|
20
20
|
import { operationData, toKibiResult } from "kibi-runtime";
|
|
21
21
|
import { routedBusinessArgs, routedOperationName } from "../diagnostics.js";
|
|
22
22
|
import { isMcpDebugEnabled } from "../env.js";
|
|
@@ -259,7 +259,7 @@ function observeDetachedReads(base) {
|
|
|
259
259
|
notice: () => notice,
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
// implements REQ-002
|
|
262
|
+
// implements REQ-002, REQ-mcp-coded-error-envelope
|
|
263
263
|
export function addTool(server, name, description, inputSchema, handler,
|
|
264
264
|
// INTENTIONAL: DEFAULT_TOOLS_RUNTIME is typed as ToolsRuntime<PrologProcess>; the
|
|
265
265
|
// generic TProlog parameter exists so tests can inject a mock type. The cast is safe
|
|
@@ -476,6 +476,31 @@ runtime = DEFAULT_TOOLS_RUNTIME, spec, annotations, outputSchema) {
|
|
|
476
476
|
isError: true,
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
|
+
const coded = codedErrorOf(error);
|
|
480
|
+
if (coded !== null) {
|
|
481
|
+
// An error that carries a Kibi code (VALIDATION_FAILED and the
|
|
482
|
+
// like) answers with the same error envelope the CLI JSON route
|
|
483
|
+
// prints, so a client can branch on error.code instead of parsing
|
|
484
|
+
// the message.
|
|
485
|
+
const envelope = withWorkspaceNotice(withWorkspaceNotice(toKibiResult(operationSpec, null, {
|
|
486
|
+
status: "error",
|
|
487
|
+
error: {
|
|
488
|
+
code: coded.code,
|
|
489
|
+
message: coded.message,
|
|
490
|
+
retryable: coded.retryable,
|
|
491
|
+
},
|
|
492
|
+
}), workspaceNotice), observed.notice());
|
|
493
|
+
return {
|
|
494
|
+
content: [
|
|
495
|
+
{
|
|
496
|
+
type: "text",
|
|
497
|
+
text: `Tool ${name} failed: [${coded.code}] ${coded.message}`,
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
structuredContent: envelope,
|
|
501
|
+
isError: true,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
479
504
|
throw error;
|
|
480
505
|
}
|
|
481
506
|
finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kibi-mcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.2",
|
|
4
4
|
"mcpName": "io.github.Looted/kibi-mcp",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"fast-glob": "^3.2.12",
|
|
11
11
|
"gray-matter": "^4.0.3",
|
|
12
12
|
"js-yaml": "^4.1.0",
|
|
13
|
-
"kibi-runtime": "^2.16.
|
|
14
|
-
"kibi-core": "^0.22.
|
|
13
|
+
"kibi-runtime": "^2.16.3",
|
|
14
|
+
"kibi-core": "^0.22.2",
|
|
15
15
|
"zod": "^4.3.6"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|