@mcpc-tech/cli 0.1.33 → 0.1.34
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/bin/mcpc.cjs +144 -20
- package/bin/mcpc.mjs +144 -20
- package/package.json +1 -1
package/bin/mcpc.cjs
CHANGED
|
@@ -8324,6 +8324,23 @@ Execute a tool:
|
|
|
8324
8324
|
"args": { /* tool parameters */ }
|
|
8325
8325
|
}
|
|
8326
8326
|
\`\`\`
|
|
8327
|
+
</format>`,
|
|
8328
|
+
/**
|
|
8329
|
+
* Compact system prompt for autonomous MCP execution (when manual is provided)
|
|
8330
|
+
*
|
|
8331
|
+
* Uses simplified description with progressive disclosure:
|
|
8332
|
+
* - Short description shown by default
|
|
8333
|
+
* - Use `man` command with args `{ manual: true }` to get full manual
|
|
8334
|
+
*/
|
|
8335
|
+
AUTONOMOUS_EXECUTION_COMPACT: `Agentic tool \`{toolName}\`: {description}
|
|
8336
|
+
|
|
8337
|
+
Use \`man\` command with args \`{ tools: [], manual: true }\` to get the full manual, or \`{ tools: ["tool1"] }\` to get tool schemas.
|
|
8338
|
+
|
|
8339
|
+
<format>
|
|
8340
|
+
Get full manual: \`{ "tool": "man", "args": { "tools": [], "manual": true } }\`
|
|
8341
|
+
Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
|
|
8342
|
+
Get both: \`{ "tool": "man", "args": { "tools": ["tool1"], "manual": true } }\`
|
|
8343
|
+
Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
|
|
8327
8344
|
</format>`,
|
|
8328
8345
|
/**
|
|
8329
8346
|
* Tool description for sampling tools (shown in MCP tools list)
|
|
@@ -8401,6 +8418,7 @@ Adjust parameters and retry.`,
|
|
|
8401
8418
|
};
|
|
8402
8419
|
var CompiledPrompts = {
|
|
8403
8420
|
autonomousExecution: p(SystemPrompts.AUTONOMOUS_EXECUTION),
|
|
8421
|
+
autonomousExecutionCompact: p(SystemPrompts.AUTONOMOUS_EXECUTION_COMPACT),
|
|
8404
8422
|
samplingToolDescription: p(SystemPrompts.SAMPLING_TOOL_DESCRIPTION),
|
|
8405
8423
|
aiLoopSystem: p(SystemPrompts.AI_LOOP_SYSTEM),
|
|
8406
8424
|
actionSuccess: p(ResponseTemplates.ACTION_SUCCESS),
|
|
@@ -8467,7 +8485,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
8467
8485
|
},
|
|
8468
8486
|
args: {
|
|
8469
8487
|
type: "object",
|
|
8470
|
-
description: `For "man": { tools: ["tool1", "tool2"] }. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
|
|
8488
|
+
description: `For "man": { tools: ["tool1", "tool2"], manual?: true }. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
|
|
8471
8489
|
}
|
|
8472
8490
|
},
|
|
8473
8491
|
required: [
|
|
@@ -8478,7 +8496,10 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
8478
8496
|
},
|
|
8479
8497
|
/**
|
|
8480
8498
|
* Schema for "man" command args validation
|
|
8481
|
-
* Expected format: { tools: ["tool1", "tool2"] }
|
|
8499
|
+
* Expected format: { tools: ["tool1", "tool2"], manual?: true }
|
|
8500
|
+
*
|
|
8501
|
+
* - Always require `tools`
|
|
8502
|
+
* - Allow empty tools only when `manual: true`
|
|
8482
8503
|
*/
|
|
8483
8504
|
forMan: function(allToolNames) {
|
|
8484
8505
|
return {
|
|
@@ -8492,16 +8513,50 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
8492
8513
|
errorMessage: {
|
|
8493
8514
|
enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
|
|
8494
8515
|
}
|
|
8495
|
-
},
|
|
8496
|
-
minItems: 1,
|
|
8497
|
-
errorMessage: {
|
|
8498
|
-
minItems: "At least one tool name is required"
|
|
8499
8516
|
}
|
|
8517
|
+
},
|
|
8518
|
+
manual: {
|
|
8519
|
+
type: "boolean",
|
|
8520
|
+
description: "Set to true to get the full manual for this agent (progressive disclosure)."
|
|
8500
8521
|
}
|
|
8501
8522
|
},
|
|
8502
8523
|
required: [
|
|
8503
8524
|
"tools"
|
|
8504
8525
|
],
|
|
8526
|
+
additionalProperties: false,
|
|
8527
|
+
anyOf: [
|
|
8528
|
+
// manual-only (tools can be empty)
|
|
8529
|
+
{
|
|
8530
|
+
properties: {
|
|
8531
|
+
manual: {
|
|
8532
|
+
enum: [
|
|
8533
|
+
true
|
|
8534
|
+
]
|
|
8535
|
+
},
|
|
8536
|
+
tools: {
|
|
8537
|
+
minItems: 0
|
|
8538
|
+
}
|
|
8539
|
+
},
|
|
8540
|
+
required: [
|
|
8541
|
+
"tools",
|
|
8542
|
+
"manual"
|
|
8543
|
+
]
|
|
8544
|
+
},
|
|
8545
|
+
// tool schemas (require at least one tool)
|
|
8546
|
+
{
|
|
8547
|
+
properties: {
|
|
8548
|
+
tools: {
|
|
8549
|
+
minItems: 1,
|
|
8550
|
+
errorMessage: {
|
|
8551
|
+
minItems: "At least one tool name is required"
|
|
8552
|
+
}
|
|
8553
|
+
}
|
|
8554
|
+
},
|
|
8555
|
+
required: [
|
|
8556
|
+
"tools"
|
|
8557
|
+
]
|
|
8558
|
+
}
|
|
8559
|
+
],
|
|
8505
8560
|
errorMessage: {
|
|
8506
8561
|
required: {
|
|
8507
8562
|
tools: 'Missing "tools" field. Expected: { tools: ["tool1", "tool2"] }'
|
|
@@ -8623,14 +8678,16 @@ var AgenticExecutor = class {
|
|
|
8623
8678
|
allToolNames;
|
|
8624
8679
|
toolNameToDetailList;
|
|
8625
8680
|
server;
|
|
8681
|
+
manual;
|
|
8626
8682
|
logger;
|
|
8627
8683
|
tracingEnabled;
|
|
8628
8684
|
toolSchemaMap;
|
|
8629
|
-
constructor(name, allToolNames, toolNameToDetailList, server) {
|
|
8685
|
+
constructor(name, allToolNames, toolNameToDetailList, server, manual) {
|
|
8630
8686
|
this.name = name;
|
|
8631
8687
|
this.allToolNames = allToolNames;
|
|
8632
8688
|
this.toolNameToDetailList = toolNameToDetailList;
|
|
8633
8689
|
this.server = server;
|
|
8690
|
+
this.manual = manual;
|
|
8634
8691
|
this.tracingEnabled = false;
|
|
8635
8692
|
this.logger = createLogger(`mcpc.agentic.${name}`, server);
|
|
8636
8693
|
this.toolSchemaMap = new Map(toolNameToDetailList);
|
|
@@ -8698,7 +8755,34 @@ var AgenticExecutor = class {
|
|
|
8698
8755
|
};
|
|
8699
8756
|
}
|
|
8700
8757
|
const argsObj = args.args;
|
|
8701
|
-
|
|
8758
|
+
const tools = argsObj.tools ?? [];
|
|
8759
|
+
const wantManual = argsObj.manual === true;
|
|
8760
|
+
const wantTools = tools.length > 0;
|
|
8761
|
+
if (wantTools && wantManual) {
|
|
8762
|
+
const toolSchemas = this.handleManCommand(tools, null);
|
|
8763
|
+
const manualResult = this.handleManualRequest(null);
|
|
8764
|
+
if (executeSpan) {
|
|
8765
|
+
executeSpan.setAttributes({
|
|
8766
|
+
toolType: "man",
|
|
8767
|
+
requestType: "tools+manual"
|
|
8768
|
+
});
|
|
8769
|
+
endSpan(executeSpan);
|
|
8770
|
+
}
|
|
8771
|
+
return {
|
|
8772
|
+
content: [
|
|
8773
|
+
...toolSchemas.content,
|
|
8774
|
+
{
|
|
8775
|
+
type: "text",
|
|
8776
|
+
text: "\n---\n"
|
|
8777
|
+
},
|
|
8778
|
+
...manualResult.content
|
|
8779
|
+
]
|
|
8780
|
+
};
|
|
8781
|
+
}
|
|
8782
|
+
if (wantManual) {
|
|
8783
|
+
return this.handleManualRequest(executeSpan);
|
|
8784
|
+
}
|
|
8785
|
+
return this.handleManCommand(tools, executeSpan);
|
|
8702
8786
|
}
|
|
8703
8787
|
const toolArgs = args.args || {};
|
|
8704
8788
|
return await this.executeTool(tool2, toolArgs, executeSpan);
|
|
@@ -8721,6 +8805,44 @@ var AgenticExecutor = class {
|
|
|
8721
8805
|
};
|
|
8722
8806
|
}
|
|
8723
8807
|
}
|
|
8808
|
+
/**
|
|
8809
|
+
* Handle `man { manual: true }` - return full manual for progressive disclosure
|
|
8810
|
+
*/
|
|
8811
|
+
handleManualRequest(executeSpan) {
|
|
8812
|
+
if (executeSpan) {
|
|
8813
|
+
executeSpan.setAttributes({
|
|
8814
|
+
toolType: "man",
|
|
8815
|
+
requestType: "manual"
|
|
8816
|
+
});
|
|
8817
|
+
}
|
|
8818
|
+
if (!this.manual) {
|
|
8819
|
+
if (executeSpan) {
|
|
8820
|
+
endSpan(executeSpan);
|
|
8821
|
+
}
|
|
8822
|
+
return {
|
|
8823
|
+
content: [
|
|
8824
|
+
{
|
|
8825
|
+
type: "text",
|
|
8826
|
+
text: "No manual available for this agent."
|
|
8827
|
+
}
|
|
8828
|
+
]
|
|
8829
|
+
};
|
|
8830
|
+
}
|
|
8831
|
+
if (executeSpan) {
|
|
8832
|
+
executeSpan.setAttributes({
|
|
8833
|
+
success: true
|
|
8834
|
+
});
|
|
8835
|
+
endSpan(executeSpan);
|
|
8836
|
+
}
|
|
8837
|
+
return {
|
|
8838
|
+
content: [
|
|
8839
|
+
{
|
|
8840
|
+
type: "text",
|
|
8841
|
+
text: this.manual
|
|
8842
|
+
}
|
|
8843
|
+
]
|
|
8844
|
+
};
|
|
8845
|
+
}
|
|
8724
8846
|
/**
|
|
8725
8847
|
* Handle `man` command - return schemas for requested tools
|
|
8726
8848
|
* @param requestedTools - Array of tool names (already validated via JSON Schema)
|
|
@@ -8878,19 +9000,18 @@ ${JSON.stringify(cleanedSchema, null, 2)}
|
|
|
8878
9000
|
};
|
|
8879
9001
|
|
|
8880
9002
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-tool-registrar.js
|
|
8881
|
-
function registerAgenticTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList }) {
|
|
9003
|
+
function registerAgenticTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, manual }) {
|
|
8882
9004
|
const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, void 0, void 0);
|
|
8883
|
-
const agenticExecutor = new AgenticExecutor(name, allToolNames, toolNameToDetailList, server);
|
|
8884
|
-
description = CompiledPrompts.
|
|
9005
|
+
const agenticExecutor = new AgenticExecutor(name, allToolNames, toolNameToDetailList, server, manual);
|
|
9006
|
+
description = manual ? CompiledPrompts.autonomousExecutionCompact({
|
|
9007
|
+
toolName: name,
|
|
9008
|
+
description
|
|
9009
|
+
}) : CompiledPrompts.autonomousExecution({
|
|
8885
9010
|
toolName: name,
|
|
8886
9011
|
description
|
|
8887
9012
|
});
|
|
8888
9013
|
const agenticArgsDef = createArgsDef.forAgentic(allToolNames);
|
|
8889
|
-
const
|
|
8890
|
-
const schema = allToolNames.length > 0 ? argsDef : {
|
|
8891
|
-
type: "object",
|
|
8892
|
-
properties: {}
|
|
8893
|
-
};
|
|
9014
|
+
const schema = agenticArgsDef;
|
|
8894
9015
|
server.tool(name, description, jsonSchema(createModelCompatibleJSONSchema(schema)), async (args) => {
|
|
8895
9016
|
return await agenticExecutor.execute(args, schema);
|
|
8896
9017
|
});
|
|
@@ -8909,7 +9030,8 @@ var createAgenticModePlugin = () => ({
|
|
|
8909
9030
|
name: context2.name,
|
|
8910
9031
|
allToolNames: context2.allToolNames,
|
|
8911
9032
|
depGroups: context2.depGroups,
|
|
8912
|
-
toolNameToDetailList: context2.toolNameToDetailList
|
|
9033
|
+
toolNameToDetailList: context2.toolNameToDetailList,
|
|
9034
|
+
manual: context2.manual
|
|
8913
9035
|
});
|
|
8914
9036
|
}
|
|
8915
9037
|
});
|
|
@@ -11013,9 +11135,10 @@ var ComposableMCPServer = class extends Server {
|
|
|
11013
11135
|
mcpServers: {}
|
|
11014
11136
|
}, options = {
|
|
11015
11137
|
mode: "agentic"
|
|
11016
|
-
}) {
|
|
11138
|
+
}, manual) {
|
|
11017
11139
|
const refDesc = options.refs?.join("") ?? "";
|
|
11018
|
-
const
|
|
11140
|
+
const combinedSource = description + refDesc + (manual ?? "");
|
|
11141
|
+
const { tagToResults } = parseTags(combinedSource, [
|
|
11019
11142
|
"tool",
|
|
11020
11143
|
"fn"
|
|
11021
11144
|
]);
|
|
@@ -11166,6 +11289,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
11166
11289
|
server: this,
|
|
11167
11290
|
name,
|
|
11168
11291
|
description,
|
|
11292
|
+
manual,
|
|
11169
11293
|
mode,
|
|
11170
11294
|
allToolNames,
|
|
11171
11295
|
toolNameToDetailList,
|
|
@@ -11244,7 +11368,7 @@ async function mcpc(serverConf, composeConf, optionsOrSetup) {
|
|
|
11244
11368
|
await options.setup(server);
|
|
11245
11369
|
}
|
|
11246
11370
|
for (const mcpcConfig of parsed) {
|
|
11247
|
-
await server.compose(mcpcConfig.name, mcpcConfig.description ?? "", mcpcConfig.deps, mcpcConfig.options);
|
|
11371
|
+
await server.compose(mcpcConfig.name, mcpcConfig.description ?? "", mcpcConfig.deps, mcpcConfig.options, mcpcConfig.manual);
|
|
11248
11372
|
}
|
|
11249
11373
|
return server;
|
|
11250
11374
|
}
|
package/bin/mcpc.mjs
CHANGED
|
@@ -8332,6 +8332,23 @@ Execute a tool:
|
|
|
8332
8332
|
"args": { /* tool parameters */ }
|
|
8333
8333
|
}
|
|
8334
8334
|
\`\`\`
|
|
8335
|
+
</format>`,
|
|
8336
|
+
/**
|
|
8337
|
+
* Compact system prompt for autonomous MCP execution (when manual is provided)
|
|
8338
|
+
*
|
|
8339
|
+
* Uses simplified description with progressive disclosure:
|
|
8340
|
+
* - Short description shown by default
|
|
8341
|
+
* - Use `man` command with args `{ manual: true }` to get full manual
|
|
8342
|
+
*/
|
|
8343
|
+
AUTONOMOUS_EXECUTION_COMPACT: `Agentic tool \`{toolName}\`: {description}
|
|
8344
|
+
|
|
8345
|
+
Use \`man\` command with args \`{ tools: [], manual: true }\` to get the full manual, or \`{ tools: ["tool1"] }\` to get tool schemas.
|
|
8346
|
+
|
|
8347
|
+
<format>
|
|
8348
|
+
Get full manual: \`{ "tool": "man", "args": { "tools": [], "manual": true } }\`
|
|
8349
|
+
Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
|
|
8350
|
+
Get both: \`{ "tool": "man", "args": { "tools": ["tool1"], "manual": true } }\`
|
|
8351
|
+
Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
|
|
8335
8352
|
</format>`,
|
|
8336
8353
|
/**
|
|
8337
8354
|
* Tool description for sampling tools (shown in MCP tools list)
|
|
@@ -8409,6 +8426,7 @@ Adjust parameters and retry.`,
|
|
|
8409
8426
|
};
|
|
8410
8427
|
var CompiledPrompts = {
|
|
8411
8428
|
autonomousExecution: p(SystemPrompts.AUTONOMOUS_EXECUTION),
|
|
8429
|
+
autonomousExecutionCompact: p(SystemPrompts.AUTONOMOUS_EXECUTION_COMPACT),
|
|
8412
8430
|
samplingToolDescription: p(SystemPrompts.SAMPLING_TOOL_DESCRIPTION),
|
|
8413
8431
|
aiLoopSystem: p(SystemPrompts.AI_LOOP_SYSTEM),
|
|
8414
8432
|
actionSuccess: p(ResponseTemplates.ACTION_SUCCESS),
|
|
@@ -8475,7 +8493,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
8475
8493
|
},
|
|
8476
8494
|
args: {
|
|
8477
8495
|
type: "object",
|
|
8478
|
-
description: `For "man": { tools: ["tool1", "tool2"] }. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
|
|
8496
|
+
description: `For "man": { tools: ["tool1", "tool2"], manual?: true }. For other tools: tool parameters that strictly adhere to the tool's JSON schema.`
|
|
8479
8497
|
}
|
|
8480
8498
|
},
|
|
8481
8499
|
required: [
|
|
@@ -8486,7 +8504,10 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
8486
8504
|
},
|
|
8487
8505
|
/**
|
|
8488
8506
|
* Schema for "man" command args validation
|
|
8489
|
-
* Expected format: { tools: ["tool1", "tool2"] }
|
|
8507
|
+
* Expected format: { tools: ["tool1", "tool2"], manual?: true }
|
|
8508
|
+
*
|
|
8509
|
+
* - Always require `tools`
|
|
8510
|
+
* - Allow empty tools only when `manual: true`
|
|
8490
8511
|
*/
|
|
8491
8512
|
forMan: function(allToolNames) {
|
|
8492
8513
|
return {
|
|
@@ -8500,16 +8521,50 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
8500
8521
|
errorMessage: {
|
|
8501
8522
|
enum: `Invalid tool name. Available: ${allToolNames.join(", ")}`
|
|
8502
8523
|
}
|
|
8503
|
-
},
|
|
8504
|
-
minItems: 1,
|
|
8505
|
-
errorMessage: {
|
|
8506
|
-
minItems: "At least one tool name is required"
|
|
8507
8524
|
}
|
|
8525
|
+
},
|
|
8526
|
+
manual: {
|
|
8527
|
+
type: "boolean",
|
|
8528
|
+
description: "Set to true to get the full manual for this agent (progressive disclosure)."
|
|
8508
8529
|
}
|
|
8509
8530
|
},
|
|
8510
8531
|
required: [
|
|
8511
8532
|
"tools"
|
|
8512
8533
|
],
|
|
8534
|
+
additionalProperties: false,
|
|
8535
|
+
anyOf: [
|
|
8536
|
+
// manual-only (tools can be empty)
|
|
8537
|
+
{
|
|
8538
|
+
properties: {
|
|
8539
|
+
manual: {
|
|
8540
|
+
enum: [
|
|
8541
|
+
true
|
|
8542
|
+
]
|
|
8543
|
+
},
|
|
8544
|
+
tools: {
|
|
8545
|
+
minItems: 0
|
|
8546
|
+
}
|
|
8547
|
+
},
|
|
8548
|
+
required: [
|
|
8549
|
+
"tools",
|
|
8550
|
+
"manual"
|
|
8551
|
+
]
|
|
8552
|
+
},
|
|
8553
|
+
// tool schemas (require at least one tool)
|
|
8554
|
+
{
|
|
8555
|
+
properties: {
|
|
8556
|
+
tools: {
|
|
8557
|
+
minItems: 1,
|
|
8558
|
+
errorMessage: {
|
|
8559
|
+
minItems: "At least one tool name is required"
|
|
8560
|
+
}
|
|
8561
|
+
}
|
|
8562
|
+
},
|
|
8563
|
+
required: [
|
|
8564
|
+
"tools"
|
|
8565
|
+
]
|
|
8566
|
+
}
|
|
8567
|
+
],
|
|
8513
8568
|
errorMessage: {
|
|
8514
8569
|
required: {
|
|
8515
8570
|
tools: 'Missing "tools" field. Expected: { tools: ["tool1", "tool2"] }'
|
|
@@ -8631,14 +8686,16 @@ var AgenticExecutor = class {
|
|
|
8631
8686
|
allToolNames;
|
|
8632
8687
|
toolNameToDetailList;
|
|
8633
8688
|
server;
|
|
8689
|
+
manual;
|
|
8634
8690
|
logger;
|
|
8635
8691
|
tracingEnabled;
|
|
8636
8692
|
toolSchemaMap;
|
|
8637
|
-
constructor(name, allToolNames, toolNameToDetailList, server) {
|
|
8693
|
+
constructor(name, allToolNames, toolNameToDetailList, server, manual) {
|
|
8638
8694
|
this.name = name;
|
|
8639
8695
|
this.allToolNames = allToolNames;
|
|
8640
8696
|
this.toolNameToDetailList = toolNameToDetailList;
|
|
8641
8697
|
this.server = server;
|
|
8698
|
+
this.manual = manual;
|
|
8642
8699
|
this.tracingEnabled = false;
|
|
8643
8700
|
this.logger = createLogger(`mcpc.agentic.${name}`, server);
|
|
8644
8701
|
this.toolSchemaMap = new Map(toolNameToDetailList);
|
|
@@ -8706,7 +8763,34 @@ var AgenticExecutor = class {
|
|
|
8706
8763
|
};
|
|
8707
8764
|
}
|
|
8708
8765
|
const argsObj = args.args;
|
|
8709
|
-
|
|
8766
|
+
const tools = argsObj.tools ?? [];
|
|
8767
|
+
const wantManual = argsObj.manual === true;
|
|
8768
|
+
const wantTools = tools.length > 0;
|
|
8769
|
+
if (wantTools && wantManual) {
|
|
8770
|
+
const toolSchemas = this.handleManCommand(tools, null);
|
|
8771
|
+
const manualResult = this.handleManualRequest(null);
|
|
8772
|
+
if (executeSpan) {
|
|
8773
|
+
executeSpan.setAttributes({
|
|
8774
|
+
toolType: "man",
|
|
8775
|
+
requestType: "tools+manual"
|
|
8776
|
+
});
|
|
8777
|
+
endSpan(executeSpan);
|
|
8778
|
+
}
|
|
8779
|
+
return {
|
|
8780
|
+
content: [
|
|
8781
|
+
...toolSchemas.content,
|
|
8782
|
+
{
|
|
8783
|
+
type: "text",
|
|
8784
|
+
text: "\n---\n"
|
|
8785
|
+
},
|
|
8786
|
+
...manualResult.content
|
|
8787
|
+
]
|
|
8788
|
+
};
|
|
8789
|
+
}
|
|
8790
|
+
if (wantManual) {
|
|
8791
|
+
return this.handleManualRequest(executeSpan);
|
|
8792
|
+
}
|
|
8793
|
+
return this.handleManCommand(tools, executeSpan);
|
|
8710
8794
|
}
|
|
8711
8795
|
const toolArgs = args.args || {};
|
|
8712
8796
|
return await this.executeTool(tool2, toolArgs, executeSpan);
|
|
@@ -8729,6 +8813,44 @@ var AgenticExecutor = class {
|
|
|
8729
8813
|
};
|
|
8730
8814
|
}
|
|
8731
8815
|
}
|
|
8816
|
+
/**
|
|
8817
|
+
* Handle `man { manual: true }` - return full manual for progressive disclosure
|
|
8818
|
+
*/
|
|
8819
|
+
handleManualRequest(executeSpan) {
|
|
8820
|
+
if (executeSpan) {
|
|
8821
|
+
executeSpan.setAttributes({
|
|
8822
|
+
toolType: "man",
|
|
8823
|
+
requestType: "manual"
|
|
8824
|
+
});
|
|
8825
|
+
}
|
|
8826
|
+
if (!this.manual) {
|
|
8827
|
+
if (executeSpan) {
|
|
8828
|
+
endSpan(executeSpan);
|
|
8829
|
+
}
|
|
8830
|
+
return {
|
|
8831
|
+
content: [
|
|
8832
|
+
{
|
|
8833
|
+
type: "text",
|
|
8834
|
+
text: "No manual available for this agent."
|
|
8835
|
+
}
|
|
8836
|
+
]
|
|
8837
|
+
};
|
|
8838
|
+
}
|
|
8839
|
+
if (executeSpan) {
|
|
8840
|
+
executeSpan.setAttributes({
|
|
8841
|
+
success: true
|
|
8842
|
+
});
|
|
8843
|
+
endSpan(executeSpan);
|
|
8844
|
+
}
|
|
8845
|
+
return {
|
|
8846
|
+
content: [
|
|
8847
|
+
{
|
|
8848
|
+
type: "text",
|
|
8849
|
+
text: this.manual
|
|
8850
|
+
}
|
|
8851
|
+
]
|
|
8852
|
+
};
|
|
8853
|
+
}
|
|
8732
8854
|
/**
|
|
8733
8855
|
* Handle `man` command - return schemas for requested tools
|
|
8734
8856
|
* @param requestedTools - Array of tool names (already validated via JSON Schema)
|
|
@@ -8886,19 +9008,18 @@ ${JSON.stringify(cleanedSchema, null, 2)}
|
|
|
8886
9008
|
};
|
|
8887
9009
|
|
|
8888
9010
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-tool-registrar.js
|
|
8889
|
-
function registerAgenticTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList }) {
|
|
9011
|
+
function registerAgenticTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, manual }) {
|
|
8890
9012
|
const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, void 0, void 0);
|
|
8891
|
-
const agenticExecutor = new AgenticExecutor(name, allToolNames, toolNameToDetailList, server);
|
|
8892
|
-
description = CompiledPrompts.
|
|
9013
|
+
const agenticExecutor = new AgenticExecutor(name, allToolNames, toolNameToDetailList, server, manual);
|
|
9014
|
+
description = manual ? CompiledPrompts.autonomousExecutionCompact({
|
|
9015
|
+
toolName: name,
|
|
9016
|
+
description
|
|
9017
|
+
}) : CompiledPrompts.autonomousExecution({
|
|
8893
9018
|
toolName: name,
|
|
8894
9019
|
description
|
|
8895
9020
|
});
|
|
8896
9021
|
const agenticArgsDef = createArgsDef.forAgentic(allToolNames);
|
|
8897
|
-
const
|
|
8898
|
-
const schema = allToolNames.length > 0 ? argsDef : {
|
|
8899
|
-
type: "object",
|
|
8900
|
-
properties: {}
|
|
8901
|
-
};
|
|
9022
|
+
const schema = agenticArgsDef;
|
|
8902
9023
|
server.tool(name, description, jsonSchema(createModelCompatibleJSONSchema(schema)), async (args) => {
|
|
8903
9024
|
return await agenticExecutor.execute(args, schema);
|
|
8904
9025
|
});
|
|
@@ -8917,7 +9038,8 @@ var createAgenticModePlugin = () => ({
|
|
|
8917
9038
|
name: context2.name,
|
|
8918
9039
|
allToolNames: context2.allToolNames,
|
|
8919
9040
|
depGroups: context2.depGroups,
|
|
8920
|
-
toolNameToDetailList: context2.toolNameToDetailList
|
|
9041
|
+
toolNameToDetailList: context2.toolNameToDetailList,
|
|
9042
|
+
manual: context2.manual
|
|
8921
9043
|
});
|
|
8922
9044
|
}
|
|
8923
9045
|
});
|
|
@@ -11020,9 +11142,10 @@ var ComposableMCPServer = class extends Server {
|
|
|
11020
11142
|
mcpServers: {}
|
|
11021
11143
|
}, options = {
|
|
11022
11144
|
mode: "agentic"
|
|
11023
|
-
}) {
|
|
11145
|
+
}, manual) {
|
|
11024
11146
|
const refDesc = options.refs?.join("") ?? "";
|
|
11025
|
-
const
|
|
11147
|
+
const combinedSource = description + refDesc + (manual ?? "");
|
|
11148
|
+
const { tagToResults } = parseTags(combinedSource, [
|
|
11026
11149
|
"tool",
|
|
11027
11150
|
"fn"
|
|
11028
11151
|
]);
|
|
@@ -11173,6 +11296,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
11173
11296
|
server: this,
|
|
11174
11297
|
name,
|
|
11175
11298
|
description,
|
|
11299
|
+
manual,
|
|
11176
11300
|
mode,
|
|
11177
11301
|
allToolNames,
|
|
11178
11302
|
toolNameToDetailList,
|
|
@@ -11251,7 +11375,7 @@ async function mcpc(serverConf, composeConf, optionsOrSetup) {
|
|
|
11251
11375
|
await options.setup(server);
|
|
11252
11376
|
}
|
|
11253
11377
|
for (const mcpcConfig of parsed) {
|
|
11254
|
-
await server.compose(mcpcConfig.name, mcpcConfig.description ?? "", mcpcConfig.deps, mcpcConfig.options);
|
|
11378
|
+
await server.compose(mcpcConfig.name, mcpcConfig.description ?? "", mcpcConfig.deps, mcpcConfig.options, mcpcConfig.manual);
|
|
11255
11379
|
}
|
|
11256
11380
|
return server;
|
|
11257
11381
|
}
|