@mcpc-tech/core 0.3.29 → 0.3.31

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 (3) hide show
  1. package/index.cjs +33 -57
  2. package/index.mjs +33 -57
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -2193,7 +2193,7 @@ var Doc = class {
2193
2193
  var version = {
2194
2194
  major: 4,
2195
2195
  minor: 3,
2196
- patch: 5
2196
+ patch: 6
2197
2197
  };
2198
2198
 
2199
2199
  // __mcpc__core_latest/node_modules/zod/v4/core/schemas.js
@@ -3484,7 +3484,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3484
3484
  if (keyResult instanceof Promise) {
3485
3485
  throw new Error("Async schemas not supported in object keys currently");
3486
3486
  }
3487
- const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length && keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number");
3487
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
3488
3488
  if (checkNumericKey) {
3489
3489
  const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
3490
3490
  if (retryResult instanceof Promise) {
@@ -5370,7 +5370,7 @@ function finalize(ctx, schema) {
5370
5370
  }
5371
5371
  }
5372
5372
  }
5373
- if (refSchema.$ref) {
5373
+ if (refSchema.$ref && refSeen.def) {
5374
5374
  for (const key in schema2) {
5375
5375
  if (key === "$ref" || key === "allOf")
5376
5376
  continue;
@@ -17778,9 +17778,7 @@ var SystemPrompts = {
17778
17778
  * - `man` command for fetching tool schemas (like Unix manual)
17779
17779
  * - No `hasDefinitions` - trusts model's context memory
17780
17780
  */
17781
- AUTONOMOUS_EXECUTION: `Agentic tool \`{toolName}\` that executes complex tasks by iteratively selecting and calling tools.
17782
-
17783
- You must follow the <manual/>, obey the <rules/>, and use the <format/>.
17781
+ AUTONOMOUS_EXECUTION: `Agentic tool \`{toolName}\` that executes tasks by calling its tools, following the <manual/>, obeying the <rules/>, and using the <format/>.
17784
17782
 
17785
17783
  <manual>
17786
17784
  {description}
@@ -17794,26 +17792,11 @@ You must follow the <manual/>, obey the <rules/>, and use the <format/>.
17794
17792
  <rules>
17795
17793
  1. **First call**: Use \`man\` to get tool schemas you need
17796
17794
  2. **Execute tools**: Use tool name in \`tool\` and parameters in \`args\`
17797
- 3. **Parallel calls**: If your client supports it, call \`man\` and execute tools simultaneously
17798
- 4. Note: You are an agent exposed as an MCP tool
17799
17795
  </rules>
17800
17796
 
17801
17797
  <format>
17802
- Get tool schemas:
17803
- \`\`\`json
17804
- {
17805
- "tool": "man",
17806
- "args": { "tools": ["tool1", "tool2"] }
17807
- }
17808
- \`\`\`
17809
-
17810
- Execute a tool:
17811
- \`\`\`json
17812
- {
17813
- "tool": "tool_name",
17814
- "args": { /* tool parameters */ }
17815
- }
17816
- \`\`\`
17798
+ Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
17799
+ Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
17817
17800
  </format>`,
17818
17801
  /**
17819
17802
  * Compact system prompt for autonomous MCP execution (when manual is provided)
@@ -17822,14 +17805,17 @@ Execute a tool:
17822
17805
  * - Short description shown by default
17823
17806
  * - Use `man` command with args `{ manual: true }` to get full manual
17824
17807
  */
17825
- AUTONOMOUS_EXECUTION_COMPACT: `Agentic tool \`{toolName}\`: {description}
17808
+ AUTONOMOUS_EXECUTION_COMPACT: `Agentic tool \`{toolName}\` that executes tasks by calling its tools, following the <rules/> and using the <format/>.
17826
17809
 
17827
- Use \`man\` command with args \`{ tools: [], manual: true }\` to get the full manual, or \`{ tools: ["tool1"] }\` to get tool schemas.
17810
+ {description}
17811
+
17812
+ <rules>
17813
+ 1. **First call**: Use \`man\` to get tool schemas and full manual
17814
+ 2. **Execute tools**: Use tool name in \`tool\` and parameters in \`args\`
17815
+ </rules>
17828
17816
 
17829
17817
  <format>
17830
- Get full manual: \`{ "tool": "man", "args": { "tools": [], "manual": true } }\`
17831
- Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
17832
- Get both: \`{ "tool": "man", "args": { "tools": ["tool1"], "manual": true } }\`
17818
+ Get manual + schemas: \`{ "tool": "man", "args": { "tools": ["tool1"], "manual": true } }\`
17833
17819
  Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
17834
17820
  </format>`,
17835
17821
  /**
@@ -17870,30 +17856,12 @@ You must follow the <manual/>, obey the <rules/>, and use the <format/>.
17870
17856
  </rules>{context}`
17871
17857
  };
17872
17858
  var ResponseTemplates = {
17873
- /**
17874
- * Success response for action execution
17875
- */
17876
- ACTION_SUCCESS: `Action \`{currentAction}\` completed.
17877
-
17878
- Next: Execute \`{nextAction}\` by calling \`{toolName}\` again.`,
17879
- /**
17880
- * Planning prompt when no next action is specified
17881
- */
17882
- PLANNING_PROMPT: `Action \`{currentAction}\` completed. Determine next step:
17883
-
17884
- 1. Analyze results from \`{currentAction}\`
17885
- 2. Decide: Continue with another action or Complete?
17886
- 3. Call \`{toolName}\` with chosen action or \`decision: "complete"\``,
17887
17859
  /**
17888
17860
  * Error response templates
17889
17861
  */
17890
17862
  ERROR_RESPONSE: `Validation failed: {errorMessage}
17891
17863
 
17892
17864
  Adjust parameters and retry.`,
17893
- /**
17894
- * Completion message
17895
- */
17896
- COMPLETION_MESSAGE: `Task completed.`,
17897
17865
  /**
17898
17866
  * Security validation messages
17899
17867
  */
@@ -17911,13 +17879,10 @@ var CompiledPrompts = {
17911
17879
  autonomousExecutionCompact: p(SystemPrompts.AUTONOMOUS_EXECUTION_COMPACT),
17912
17880
  samplingToolDescription: p(SystemPrompts.SAMPLING_TOOL_DESCRIPTION),
17913
17881
  aiLoopSystem: p(SystemPrompts.AI_LOOP_SYSTEM),
17914
- actionSuccess: p(ResponseTemplates.ACTION_SUCCESS),
17915
- planningPrompt: p(ResponseTemplates.PLANNING_PROMPT),
17916
17882
  errorResponse: p(ResponseTemplates.ERROR_RESPONSE),
17917
17883
  securityPassed: p(ResponseTemplates.SECURITY_VALIDATION.PASSED),
17918
17884
  securityFailed: p(ResponseTemplates.SECURITY_VALIDATION.FAILED),
17919
- auditLog: p(ResponseTemplates.AUDIT_LOG),
17920
- completionMessage: () => ResponseTemplates.COMPLETION_MESSAGE
17885
+ auditLog: p(ResponseTemplates.AUDIT_LOG)
17921
17886
  };
17922
17887
 
17923
17888
  // __mcpc__core_latest/node_modules/@mcpc/core/src/factories/args-def-factory.js
@@ -18906,7 +18871,7 @@ IMPORTANT: You MUST respond with valid JSON only. Do not include any text before
18906
18871
  let enhanced = systemPrompt || "";
18907
18872
  const toolsPrompt = `
18908
18873
 
18909
- AVAILABLE TOOLS:
18874
+ <available_tools>
18910
18875
  You have access to the following tools. To use a tool, respond with this XML format:
18911
18876
  <use_tool tool="tool_name">
18912
18877
  {"param1": "value1", "param2": "value2"}
@@ -18915,23 +18880,34 @@ You have access to the following tools. To use a tool, respond with this XML for
18915
18880
  Follow the JSON schema definition for each tool's parameters.
18916
18881
  You can use multiple tools in one response. DO NOT include text before or after tool calls - wait for the tool results first.
18917
18882
 
18918
- Tools:`;
18883
+ <tools>`;
18919
18884
  const toolDescriptions = tools.map((tool2) => {
18920
18885
  if (tool2.type === "function") {
18921
18886
  const toolAny = tool2;
18922
18887
  const description = toolAny.description || "No description provided";
18923
18888
  const schema = toolAny.inputSchema || toolAny.parameters;
18924
- const params = schema ? `
18925
- JSON Schema: ${JSON.stringify(schema, null, 2)}` : "";
18889
+ const schemaStr = schema ? `
18890
+ <schema>
18891
+ ${JSON.stringify(schema, null, 2)}
18892
+ </schema>` : "";
18926
18893
  return `
18927
- - ${tool2.name}: ${description}${params}`;
18894
+ <tool name="${tool2.name}">
18895
+ <description>
18896
+ ${description}
18897
+ </description>${schemaStr}
18898
+ </tool>`;
18928
18899
  } else if (tool2.type === "provider-defined") {
18929
18900
  return `
18930
- - ${tool2.name}: ${tool2.id || "No description provided"}`;
18901
+ <tool name="${tool2.name}">
18902
+ <description>${tool2.id || "No description provided"}</description>
18903
+ </tool>`;
18931
18904
  }
18932
18905
  return "";
18933
18906
  }).filter(Boolean).join("");
18934
- enhanced = enhanced ? `${enhanced}${toolsPrompt}${toolDescriptions}` : `${toolsPrompt}${toolDescriptions}`.trim();
18907
+ const toolsEnd = `
18908
+ </tools>
18909
+ </available_tools>`;
18910
+ enhanced = enhanced ? `${enhanced}${toolsPrompt}${toolDescriptions}${toolsEnd}` : `${toolsPrompt}${toolDescriptions}${toolsEnd}`.trim();
18935
18911
  return enhanced || void 0;
18936
18912
  }
18937
18913
  /**
package/index.mjs CHANGED
@@ -2179,7 +2179,7 @@ var Doc = class {
2179
2179
  var version = {
2180
2180
  major: 4,
2181
2181
  minor: 3,
2182
- patch: 5
2182
+ patch: 6
2183
2183
  };
2184
2184
 
2185
2185
  // __mcpc__core_latest/node_modules/zod/v4/core/schemas.js
@@ -3470,7 +3470,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
3470
3470
  if (keyResult instanceof Promise) {
3471
3471
  throw new Error("Async schemas not supported in object keys currently");
3472
3472
  }
3473
- const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length && keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number");
3473
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
3474
3474
  if (checkNumericKey) {
3475
3475
  const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
3476
3476
  if (retryResult instanceof Promise) {
@@ -5356,7 +5356,7 @@ function finalize(ctx, schema) {
5356
5356
  }
5357
5357
  }
5358
5358
  }
5359
- if (refSchema.$ref) {
5359
+ if (refSchema.$ref && refSeen.def) {
5360
5360
  for (const key in schema2) {
5361
5361
  if (key === "$ref" || key === "allOf")
5362
5362
  continue;
@@ -17764,9 +17764,7 @@ var SystemPrompts = {
17764
17764
  * - `man` command for fetching tool schemas (like Unix manual)
17765
17765
  * - No `hasDefinitions` - trusts model's context memory
17766
17766
  */
17767
- AUTONOMOUS_EXECUTION: `Agentic tool \`{toolName}\` that executes complex tasks by iteratively selecting and calling tools.
17768
-
17769
- You must follow the <manual/>, obey the <rules/>, and use the <format/>.
17767
+ AUTONOMOUS_EXECUTION: `Agentic tool \`{toolName}\` that executes tasks by calling its tools, following the <manual/>, obeying the <rules/>, and using the <format/>.
17770
17768
 
17771
17769
  <manual>
17772
17770
  {description}
@@ -17780,26 +17778,11 @@ You must follow the <manual/>, obey the <rules/>, and use the <format/>.
17780
17778
  <rules>
17781
17779
  1. **First call**: Use \`man\` to get tool schemas you need
17782
17780
  2. **Execute tools**: Use tool name in \`tool\` and parameters in \`args\`
17783
- 3. **Parallel calls**: If your client supports it, call \`man\` and execute tools simultaneously
17784
- 4. Note: You are an agent exposed as an MCP tool
17785
17781
  </rules>
17786
17782
 
17787
17783
  <format>
17788
- Get tool schemas:
17789
- \`\`\`json
17790
- {
17791
- "tool": "man",
17792
- "args": { "tools": ["tool1", "tool2"] }
17793
- }
17794
- \`\`\`
17795
-
17796
- Execute a tool:
17797
- \`\`\`json
17798
- {
17799
- "tool": "tool_name",
17800
- "args": { /* tool parameters */ }
17801
- }
17802
- \`\`\`
17784
+ Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
17785
+ Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
17803
17786
  </format>`,
17804
17787
  /**
17805
17788
  * Compact system prompt for autonomous MCP execution (when manual is provided)
@@ -17808,14 +17791,17 @@ Execute a tool:
17808
17791
  * - Short description shown by default
17809
17792
  * - Use `man` command with args `{ manual: true }` to get full manual
17810
17793
  */
17811
- AUTONOMOUS_EXECUTION_COMPACT: `Agentic tool \`{toolName}\`: {description}
17794
+ AUTONOMOUS_EXECUTION_COMPACT: `Agentic tool \`{toolName}\` that executes tasks by calling its tools, following the <rules/> and using the <format/>.
17812
17795
 
17813
- Use \`man\` command with args \`{ tools: [], manual: true }\` to get the full manual, or \`{ tools: ["tool1"] }\` to get tool schemas.
17796
+ {description}
17797
+
17798
+ <rules>
17799
+ 1. **First call**: Use \`man\` to get tool schemas and full manual
17800
+ 2. **Execute tools**: Use tool name in \`tool\` and parameters in \`args\`
17801
+ </rules>
17814
17802
 
17815
17803
  <format>
17816
- Get full manual: \`{ "tool": "man", "args": { "tools": [], "manual": true } }\`
17817
- Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
17818
- Get both: \`{ "tool": "man", "args": { "tools": ["tool1"], "manual": true } }\`
17804
+ Get manual + schemas: \`{ "tool": "man", "args": { "tools": ["tool1"], "manual": true } }\`
17819
17805
  Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
17820
17806
  </format>`,
17821
17807
  /**
@@ -17856,30 +17842,12 @@ You must follow the <manual/>, obey the <rules/>, and use the <format/>.
17856
17842
  </rules>{context}`
17857
17843
  };
17858
17844
  var ResponseTemplates = {
17859
- /**
17860
- * Success response for action execution
17861
- */
17862
- ACTION_SUCCESS: `Action \`{currentAction}\` completed.
17863
-
17864
- Next: Execute \`{nextAction}\` by calling \`{toolName}\` again.`,
17865
- /**
17866
- * Planning prompt when no next action is specified
17867
- */
17868
- PLANNING_PROMPT: `Action \`{currentAction}\` completed. Determine next step:
17869
-
17870
- 1. Analyze results from \`{currentAction}\`
17871
- 2. Decide: Continue with another action or Complete?
17872
- 3. Call \`{toolName}\` with chosen action or \`decision: "complete"\``,
17873
17845
  /**
17874
17846
  * Error response templates
17875
17847
  */
17876
17848
  ERROR_RESPONSE: `Validation failed: {errorMessage}
17877
17849
 
17878
17850
  Adjust parameters and retry.`,
17879
- /**
17880
- * Completion message
17881
- */
17882
- COMPLETION_MESSAGE: `Task completed.`,
17883
17851
  /**
17884
17852
  * Security validation messages
17885
17853
  */
@@ -17897,13 +17865,10 @@ var CompiledPrompts = {
17897
17865
  autonomousExecutionCompact: p(SystemPrompts.AUTONOMOUS_EXECUTION_COMPACT),
17898
17866
  samplingToolDescription: p(SystemPrompts.SAMPLING_TOOL_DESCRIPTION),
17899
17867
  aiLoopSystem: p(SystemPrompts.AI_LOOP_SYSTEM),
17900
- actionSuccess: p(ResponseTemplates.ACTION_SUCCESS),
17901
- planningPrompt: p(ResponseTemplates.PLANNING_PROMPT),
17902
17868
  errorResponse: p(ResponseTemplates.ERROR_RESPONSE),
17903
17869
  securityPassed: p(ResponseTemplates.SECURITY_VALIDATION.PASSED),
17904
17870
  securityFailed: p(ResponseTemplates.SECURITY_VALIDATION.FAILED),
17905
- auditLog: p(ResponseTemplates.AUDIT_LOG),
17906
- completionMessage: () => ResponseTemplates.COMPLETION_MESSAGE
17871
+ auditLog: p(ResponseTemplates.AUDIT_LOG)
17907
17872
  };
17908
17873
 
17909
17874
  // __mcpc__core_latest/node_modules/@mcpc/core/src/factories/args-def-factory.js
@@ -18892,7 +18857,7 @@ IMPORTANT: You MUST respond with valid JSON only. Do not include any text before
18892
18857
  let enhanced = systemPrompt || "";
18893
18858
  const toolsPrompt = `
18894
18859
 
18895
- AVAILABLE TOOLS:
18860
+ <available_tools>
18896
18861
  You have access to the following tools. To use a tool, respond with this XML format:
18897
18862
  <use_tool tool="tool_name">
18898
18863
  {"param1": "value1", "param2": "value2"}
@@ -18901,23 +18866,34 @@ You have access to the following tools. To use a tool, respond with this XML for
18901
18866
  Follow the JSON schema definition for each tool's parameters.
18902
18867
  You can use multiple tools in one response. DO NOT include text before or after tool calls - wait for the tool results first.
18903
18868
 
18904
- Tools:`;
18869
+ <tools>`;
18905
18870
  const toolDescriptions = tools.map((tool2) => {
18906
18871
  if (tool2.type === "function") {
18907
18872
  const toolAny = tool2;
18908
18873
  const description = toolAny.description || "No description provided";
18909
18874
  const schema = toolAny.inputSchema || toolAny.parameters;
18910
- const params = schema ? `
18911
- JSON Schema: ${JSON.stringify(schema, null, 2)}` : "";
18875
+ const schemaStr = schema ? `
18876
+ <schema>
18877
+ ${JSON.stringify(schema, null, 2)}
18878
+ </schema>` : "";
18912
18879
  return `
18913
- - ${tool2.name}: ${description}${params}`;
18880
+ <tool name="${tool2.name}">
18881
+ <description>
18882
+ ${description}
18883
+ </description>${schemaStr}
18884
+ </tool>`;
18914
18885
  } else if (tool2.type === "provider-defined") {
18915
18886
  return `
18916
- - ${tool2.name}: ${tool2.id || "No description provided"}`;
18887
+ <tool name="${tool2.name}">
18888
+ <description>${tool2.id || "No description provided"}</description>
18889
+ </tool>`;
18917
18890
  }
18918
18891
  return "";
18919
18892
  }).filter(Boolean).join("");
18920
- enhanced = enhanced ? `${enhanced}${toolsPrompt}${toolDescriptions}` : `${toolsPrompt}${toolDescriptions}`.trim();
18893
+ const toolsEnd = `
18894
+ </tools>
18895
+ </available_tools>`;
18896
+ enhanced = enhanced ? `${enhanced}${toolsPrompt}${toolDescriptions}${toolsEnd}` : `${toolsPrompt}${toolDescriptions}${toolsEnd}`.trim();
18921
18897
  return enhanced || void 0;
18922
18898
  }
18923
18899
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/core",
3
- "version": "0.3.29",
3
+ "version": "0.3.31",
4
4
  "homepage": "https://jsr.io/@mcpc/core",
5
5
  "dependencies": {
6
6
  "@ai-sdk/provider": "^2.0.0",