@mcpc-tech/core 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.
- package/index.cjs +18 -33
- package/index.mjs +18 -33
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -17784,7 +17784,7 @@ You must follow the <manual/>, obey the <rules/>, and use the <format/>.
|
|
|
17784
17784
|
|
|
17785
17785
|
<parameters>
|
|
17786
17786
|
\`tool\` - Which tool to execute: "man" to get schemas, or a tool name to execute
|
|
17787
|
-
\`args\` - For "man":
|
|
17787
|
+
\`args\` - For "man": ["tool1", "tool2"]. For other tools: tool parameters that strictly adhere to the tool's JSON schema.
|
|
17788
17788
|
</parameters>
|
|
17789
17789
|
|
|
17790
17790
|
<rules>
|
|
@@ -17799,7 +17799,7 @@ Get tool schemas:
|
|
|
17799
17799
|
\`\`\`json
|
|
17800
17800
|
{
|
|
17801
17801
|
"tool": "man",
|
|
17802
|
-
"args":
|
|
17802
|
+
"args": ["tool1", "tool2"]
|
|
17803
17803
|
}
|
|
17804
17804
|
\`\`\`
|
|
17805
17805
|
|
|
@@ -17866,9 +17866,7 @@ Next: Execute \`{nextAction}\` by calling \`{toolName}\` again.`,
|
|
|
17866
17866
|
/**
|
|
17867
17867
|
* Error response templates
|
|
17868
17868
|
*/
|
|
17869
|
-
ERROR_RESPONSE: `Validation failed: {errorMessage}
|
|
17870
|
-
|
|
17871
|
-
Adjust parameters and retry.`,
|
|
17869
|
+
ERROR_RESPONSE: `Validation failed: {errorMessage}`,
|
|
17872
17870
|
/**
|
|
17873
17871
|
* Completion message
|
|
17874
17872
|
*/
|
|
@@ -17933,7 +17931,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
17933
17931
|
*
|
|
17934
17932
|
* Only two fields:
|
|
17935
17933
|
* - `tool`: which tool to execute (enum includes "man" + all tool names)
|
|
17936
|
-
* - `args`:
|
|
17934
|
+
* - `args`: For "man": ["tool1", "tool2"] or { tools: [...] }. For others: tool parameters.
|
|
17937
17935
|
*/
|
|
17938
17936
|
forAgentic: function(allToolNames) {
|
|
17939
17937
|
const toolEnum = [
|
|
@@ -17953,7 +17951,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
17953
17951
|
},
|
|
17954
17952
|
args: {
|
|
17955
17953
|
type: "object",
|
|
17956
|
-
description: `For "man":
|
|
17954
|
+
description: `For "man": ["tool1", "tool2"]. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
|
|
17957
17955
|
}
|
|
17958
17956
|
},
|
|
17959
17957
|
required: [
|
|
@@ -17963,35 +17961,22 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
17963
17961
|
};
|
|
17964
17962
|
},
|
|
17965
17963
|
/**
|
|
17966
|
-
* Schema for "man" command args validation
|
|
17967
|
-
* Expected format:
|
|
17964
|
+
* Schema for "man" command args validation (array format)
|
|
17965
|
+
* Expected format: ["tool1", "tool2"]
|
|
17968
17966
|
*/
|
|
17969
17967
|
forMan: function(allToolNames) {
|
|
17970
17968
|
return {
|
|
17971
|
-
type: "
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
17977
|
-
enum: allToolNames,
|
|
17978
|
-
errorMessage: {
|
|
17979
|
-
enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
|
|
17980
|
-
}
|
|
17981
|
-
},
|
|
17982
|
-
minItems: 1,
|
|
17983
|
-
errorMessage: {
|
|
17984
|
-
minItems: "At least one tool name is required"
|
|
17985
|
-
}
|
|
17969
|
+
type: "array",
|
|
17970
|
+
items: {
|
|
17971
|
+
type: "string",
|
|
17972
|
+
enum: allToolNames,
|
|
17973
|
+
errorMessage: {
|
|
17974
|
+
enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
|
|
17986
17975
|
}
|
|
17987
17976
|
},
|
|
17988
|
-
|
|
17989
|
-
"tools"
|
|
17990
|
-
],
|
|
17977
|
+
minItems: 1,
|
|
17991
17978
|
errorMessage: {
|
|
17992
|
-
|
|
17993
|
-
tools: 'Missing "tools" field. Expected: { tools: ["tool1", "tool2"] }'
|
|
17994
|
-
}
|
|
17979
|
+
minItems: "At least one tool name is required"
|
|
17995
17980
|
}
|
|
17996
17981
|
};
|
|
17997
17982
|
}
|
|
@@ -18169,9 +18154,10 @@ var AgenticExecutor = class {
|
|
|
18169
18154
|
}
|
|
18170
18155
|
const tool2 = args.tool;
|
|
18171
18156
|
if (tool2 === "man") {
|
|
18157
|
+
const toolsArray = Array.isArray(args.args) ? args.args : args.args?.tools;
|
|
18172
18158
|
const createArgsDef = createArgsDefFactory(this.name, this.allToolNames, {});
|
|
18173
18159
|
const manSchema = createArgsDef.forMan(this.allToolNames);
|
|
18174
|
-
const manValidation = validateSchema(
|
|
18160
|
+
const manValidation = validateSchema(toolsArray ?? [], manSchema);
|
|
18175
18161
|
if (!manValidation.valid) {
|
|
18176
18162
|
return {
|
|
18177
18163
|
content: [
|
|
@@ -18183,8 +18169,7 @@ var AgenticExecutor = class {
|
|
|
18183
18169
|
isError: true
|
|
18184
18170
|
};
|
|
18185
18171
|
}
|
|
18186
|
-
|
|
18187
|
-
return this.handleManCommand(argsObj.tools, executeSpan);
|
|
18172
|
+
return this.handleManCommand(toolsArray, executeSpan);
|
|
18188
18173
|
}
|
|
18189
18174
|
const toolArgs = args.args || {};
|
|
18190
18175
|
return await this.executeTool(tool2, toolArgs, executeSpan);
|
package/index.mjs
CHANGED
|
@@ -17772,7 +17772,7 @@ You must follow the <manual/>, obey the <rules/>, and use the <format/>.
|
|
|
17772
17772
|
|
|
17773
17773
|
<parameters>
|
|
17774
17774
|
\`tool\` - Which tool to execute: "man" to get schemas, or a tool name to execute
|
|
17775
|
-
\`args\` - For "man":
|
|
17775
|
+
\`args\` - For "man": ["tool1", "tool2"]. For other tools: tool parameters that strictly adhere to the tool's JSON schema.
|
|
17776
17776
|
</parameters>
|
|
17777
17777
|
|
|
17778
17778
|
<rules>
|
|
@@ -17787,7 +17787,7 @@ Get tool schemas:
|
|
|
17787
17787
|
\`\`\`json
|
|
17788
17788
|
{
|
|
17789
17789
|
"tool": "man",
|
|
17790
|
-
"args":
|
|
17790
|
+
"args": ["tool1", "tool2"]
|
|
17791
17791
|
}
|
|
17792
17792
|
\`\`\`
|
|
17793
17793
|
|
|
@@ -17854,9 +17854,7 @@ Next: Execute \`{nextAction}\` by calling \`{toolName}\` again.`,
|
|
|
17854
17854
|
/**
|
|
17855
17855
|
* Error response templates
|
|
17856
17856
|
*/
|
|
17857
|
-
ERROR_RESPONSE: `Validation failed: {errorMessage}
|
|
17858
|
-
|
|
17859
|
-
Adjust parameters and retry.`,
|
|
17857
|
+
ERROR_RESPONSE: `Validation failed: {errorMessage}`,
|
|
17860
17858
|
/**
|
|
17861
17859
|
* Completion message
|
|
17862
17860
|
*/
|
|
@@ -17921,7 +17919,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
17921
17919
|
*
|
|
17922
17920
|
* Only two fields:
|
|
17923
17921
|
* - `tool`: which tool to execute (enum includes "man" + all tool names)
|
|
17924
|
-
* - `args`:
|
|
17922
|
+
* - `args`: For "man": ["tool1", "tool2"] or { tools: [...] }. For others: tool parameters.
|
|
17925
17923
|
*/
|
|
17926
17924
|
forAgentic: function(allToolNames) {
|
|
17927
17925
|
const toolEnum = [
|
|
@@ -17941,7 +17939,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
17941
17939
|
},
|
|
17942
17940
|
args: {
|
|
17943
17941
|
type: "object",
|
|
17944
|
-
description: `For "man":
|
|
17942
|
+
description: `For "man": ["tool1", "tool2"]. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
|
|
17945
17943
|
}
|
|
17946
17944
|
},
|
|
17947
17945
|
required: [
|
|
@@ -17951,35 +17949,22 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
17951
17949
|
};
|
|
17952
17950
|
},
|
|
17953
17951
|
/**
|
|
17954
|
-
* Schema for "man" command args validation
|
|
17955
|
-
* Expected format:
|
|
17952
|
+
* Schema for "man" command args validation (array format)
|
|
17953
|
+
* Expected format: ["tool1", "tool2"]
|
|
17956
17954
|
*/
|
|
17957
17955
|
forMan: function(allToolNames) {
|
|
17958
17956
|
return {
|
|
17959
|
-
type: "
|
|
17960
|
-
|
|
17961
|
-
|
|
17962
|
-
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
enum: allToolNames,
|
|
17966
|
-
errorMessage: {
|
|
17967
|
-
enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
|
|
17968
|
-
}
|
|
17969
|
-
},
|
|
17970
|
-
minItems: 1,
|
|
17971
|
-
errorMessage: {
|
|
17972
|
-
minItems: "At least one tool name is required"
|
|
17973
|
-
}
|
|
17957
|
+
type: "array",
|
|
17958
|
+
items: {
|
|
17959
|
+
type: "string",
|
|
17960
|
+
enum: allToolNames,
|
|
17961
|
+
errorMessage: {
|
|
17962
|
+
enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
|
|
17974
17963
|
}
|
|
17975
17964
|
},
|
|
17976
|
-
|
|
17977
|
-
"tools"
|
|
17978
|
-
],
|
|
17965
|
+
minItems: 1,
|
|
17979
17966
|
errorMessage: {
|
|
17980
|
-
|
|
17981
|
-
tools: 'Missing "tools" field. Expected: { tools: ["tool1", "tool2"] }'
|
|
17982
|
-
}
|
|
17967
|
+
minItems: "At least one tool name is required"
|
|
17983
17968
|
}
|
|
17984
17969
|
};
|
|
17985
17970
|
}
|
|
@@ -18157,9 +18142,10 @@ var AgenticExecutor = class {
|
|
|
18157
18142
|
}
|
|
18158
18143
|
const tool2 = args.tool;
|
|
18159
18144
|
if (tool2 === "man") {
|
|
18145
|
+
const toolsArray = Array.isArray(args.args) ? args.args : args.args?.tools;
|
|
18160
18146
|
const createArgsDef = createArgsDefFactory(this.name, this.allToolNames, {});
|
|
18161
18147
|
const manSchema = createArgsDef.forMan(this.allToolNames);
|
|
18162
|
-
const manValidation = validateSchema(
|
|
18148
|
+
const manValidation = validateSchema(toolsArray ?? [], manSchema);
|
|
18163
18149
|
if (!manValidation.valid) {
|
|
18164
18150
|
return {
|
|
18165
18151
|
content: [
|
|
@@ -18171,8 +18157,7 @@ var AgenticExecutor = class {
|
|
|
18171
18157
|
isError: true
|
|
18172
18158
|
};
|
|
18173
18159
|
}
|
|
18174
|
-
|
|
18175
|
-
return this.handleManCommand(argsObj.tools, executeSpan);
|
|
18160
|
+
return this.handleManCommand(toolsArray, executeSpan);
|
|
18176
18161
|
}
|
|
18177
18162
|
const toolArgs = args.args || {};
|
|
18178
18163
|
return await this.executeTool(tool2, toolArgs, executeSpan);
|