kojee-mcp 0.1.1 → 0.1.3
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/{chunk-TJNNT7XM.js → chunk-AYJ6WN2K.js} +25 -23
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -522,12 +522,6 @@ var BUILTIN_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
522
522
|
"kojee_revoke_request",
|
|
523
523
|
"kojee_send_feedback"
|
|
524
524
|
]);
|
|
525
|
-
function extractConnector(toolName) {
|
|
526
|
-
if (BUILTIN_TOOL_NAMES.has(toolName)) return null;
|
|
527
|
-
const idx = toolName.indexOf("_");
|
|
528
|
-
if (idx === -1) return null;
|
|
529
|
-
return toolName.substring(0, idx);
|
|
530
|
-
}
|
|
531
525
|
var ToolRegistry = class {
|
|
532
526
|
constructor(gateway) {
|
|
533
527
|
this.gateway = gateway;
|
|
@@ -550,8 +544,12 @@ var ToolRegistry = class {
|
|
|
550
544
|
}
|
|
551
545
|
for (const tool of toolList) {
|
|
552
546
|
this.allToolNames.add(tool.name);
|
|
553
|
-
|
|
554
|
-
|
|
547
|
+
if (BUILTIN_TOOL_NAMES.has(tool.name)) continue;
|
|
548
|
+
const connector = tool._connector_id ?? (tool.name.includes("_") ? tool.name.substring(0, tool.name.indexOf("_")) : null);
|
|
549
|
+
if (!connector) {
|
|
550
|
+
console.error(`[tools] Skipping tool with no connector: ${tool.name}`);
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
555
553
|
let info = this.connectors.get(connector);
|
|
556
554
|
if (!info) {
|
|
557
555
|
info = { id: connector, tools: [] };
|
|
@@ -573,7 +571,7 @@ var ToolRegistry = class {
|
|
|
573
571
|
for (const [connectorId, info] of this.connectors) {
|
|
574
572
|
const toolNames = info.tools.map((t) => t.name).join(", ");
|
|
575
573
|
tools.push({
|
|
576
|
-
name:
|
|
574
|
+
name: connectorId,
|
|
577
575
|
description: `${connectorId} tools available via Kojee (${info.tools.length} tools: ${toolNames}). Call this tool to see descriptions and details for each.`,
|
|
578
576
|
inputSchema: { type: "object", properties: {} }
|
|
579
577
|
});
|
|
@@ -644,11 +642,16 @@ import {
|
|
|
644
642
|
ListToolsRequestSchema,
|
|
645
643
|
CallToolRequestSchema
|
|
646
644
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
647
|
-
var
|
|
645
|
+
var UTILITY_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
646
|
+
"get_tool_schema",
|
|
647
|
+
"call_tool",
|
|
648
|
+
"check_approval",
|
|
649
|
+
"revoke_request"
|
|
650
|
+
]);
|
|
648
651
|
var UTILITY_TOOLS = [
|
|
649
652
|
{
|
|
650
|
-
name: "
|
|
651
|
-
description: "Get the full input schema for one or more Kojee tools. Call this before
|
|
653
|
+
name: "get_tool_schema",
|
|
654
|
+
description: "Get the full input schema for one or more Kojee tools. Call this before call_tool to know the exact parameters required.",
|
|
652
655
|
inputSchema: {
|
|
653
656
|
type: "object",
|
|
654
657
|
properties: {
|
|
@@ -662,8 +665,8 @@ var UTILITY_TOOLS = [
|
|
|
662
665
|
}
|
|
663
666
|
},
|
|
664
667
|
{
|
|
665
|
-
name: "
|
|
666
|
-
description: "Call a Kojee tool by name with the specified arguments. Use the connector tools (e.g. kojee_gmail) to discover tools, then
|
|
668
|
+
name: "call_tool",
|
|
669
|
+
description: "Call a Kojee tool by name with the specified arguments. Use the connector tools (e.g. kojee_gmail) to discover tools, then get_tool_schema to get parameters, then this to execute.",
|
|
667
670
|
inputSchema: {
|
|
668
671
|
type: "object",
|
|
669
672
|
properties: {
|
|
@@ -681,7 +684,7 @@ var UTILITY_TOOLS = [
|
|
|
681
684
|
}
|
|
682
685
|
},
|
|
683
686
|
{
|
|
684
|
-
name: "
|
|
687
|
+
name: "check_approval",
|
|
685
688
|
description: "Check the status of a pending approval request. Use this after a tool call returns 'require_approval' to poll whether the user has approved or denied.",
|
|
686
689
|
inputSchema: {
|
|
687
690
|
type: "object",
|
|
@@ -695,7 +698,7 @@ var UTILITY_TOOLS = [
|
|
|
695
698
|
}
|
|
696
699
|
},
|
|
697
700
|
{
|
|
698
|
-
name: "
|
|
701
|
+
name: "revoke_request",
|
|
699
702
|
description: "Revoke/cancel a pending approval request you no longer need.",
|
|
700
703
|
inputSchema: {
|
|
701
704
|
type: "object",
|
|
@@ -731,16 +734,15 @@ function createMcpServer(registry) {
|
|
|
731
734
|
});
|
|
732
735
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
733
736
|
const { name, arguments: args } = request.params;
|
|
734
|
-
if (
|
|
735
|
-
const
|
|
736
|
-
const toolList = registry.getConnectorToolList(connectorId);
|
|
737
|
+
if (!UTILITY_TOOL_NAMES.has(name)) {
|
|
738
|
+
const toolList = registry.getConnectorToolList(name);
|
|
737
739
|
return {
|
|
738
740
|
content: [{ type: "text", text: toolList }],
|
|
739
741
|
isError: false
|
|
740
742
|
};
|
|
741
743
|
}
|
|
742
744
|
switch (name) {
|
|
743
|
-
case "
|
|
745
|
+
case "get_tool_schema": {
|
|
744
746
|
const names = args?.names ?? [];
|
|
745
747
|
if (names.length === 0) {
|
|
746
748
|
return {
|
|
@@ -754,7 +756,7 @@ function createMcpServer(registry) {
|
|
|
754
756
|
isError: false
|
|
755
757
|
};
|
|
756
758
|
}
|
|
757
|
-
case "
|
|
759
|
+
case "call_tool": {
|
|
758
760
|
const toolName = args?.name;
|
|
759
761
|
if (!toolName) {
|
|
760
762
|
return {
|
|
@@ -770,8 +772,8 @@ function createMcpServer(registry) {
|
|
|
770
772
|
isError: result.isError
|
|
771
773
|
};
|
|
772
774
|
}
|
|
773
|
-
case "
|
|
774
|
-
case "
|
|
775
|
+
case "check_approval":
|
|
776
|
+
case "revoke_request": {
|
|
775
777
|
const rawResult = await registry.callTool(name, args ?? {});
|
|
776
778
|
const result = translateToolCallResult(rawResult);
|
|
777
779
|
return {
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED