@recapt/mcp 0.0.44 → 0.0.45
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/index.js +15 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3084,6 +3084,7 @@ var EXPOSED_TOOL_NAMES = [
|
|
|
3084
3084
|
"search_tools",
|
|
3085
3085
|
"call_tool",
|
|
3086
3086
|
"memory_save",
|
|
3087
|
+
"query_memory",
|
|
3087
3088
|
"memory_recall",
|
|
3088
3089
|
"memory_list",
|
|
3089
3090
|
"memory_delete",
|
|
@@ -3481,20 +3482,21 @@ function createMemoryStore() {
|
|
|
3481
3482
|
}
|
|
3482
3483
|
|
|
3483
3484
|
// ../../libraries/mcp-tools/dist/wrapToolsWithMemory.js
|
|
3484
|
-
var SUMMARIZE_THRESHOLD =
|
|
3485
|
+
var SUMMARIZE_THRESHOLD = 500;
|
|
3485
3486
|
var MAX_ARRAY_ITEMS = 2;
|
|
3486
3487
|
var MAX_STRING_LENGTH = 120;
|
|
3487
3488
|
var MAX_DEPTH = 3;
|
|
3488
3489
|
var PASSTHROUGH_TOOLS = /* @__PURE__ */ new Set([
|
|
3489
3490
|
"memory_save",
|
|
3490
3491
|
"memory_recall",
|
|
3492
|
+
"query_memory",
|
|
3491
3493
|
"memory_list",
|
|
3492
3494
|
"memory_delete",
|
|
3493
3495
|
"memory_clear",
|
|
3494
3496
|
"search_tools",
|
|
3495
3497
|
"get_domains"
|
|
3496
3498
|
]);
|
|
3497
|
-
function
|
|
3499
|
+
function isRecord2(value) {
|
|
3498
3500
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3499
3501
|
}
|
|
3500
3502
|
function wrapToolResult(toolName, args, result, memory, options) {
|
|
@@ -3514,7 +3516,7 @@ function wrapToolResult(toolName, args, result, memory, options) {
|
|
|
3514
3516
|
} catch {
|
|
3515
3517
|
return result;
|
|
3516
3518
|
}
|
|
3517
|
-
if (
|
|
3519
|
+
if (isRecord2(parsed) && parsed.error) {
|
|
3518
3520
|
return result;
|
|
3519
3521
|
}
|
|
3520
3522
|
const key = MemoryStore.buildKey(toolName, args);
|
|
@@ -3533,7 +3535,7 @@ function wrapToolResult(toolName, args, result, memory, options) {
|
|
|
3533
3535
|
function summarizeTruncate(data, memoryKey) {
|
|
3534
3536
|
const summary = truncateDeep(data, 0);
|
|
3535
3537
|
addMemoryMetadata(summary, memoryKey, "truncate");
|
|
3536
|
-
return
|
|
3538
|
+
return isRecord2(summary) ? summary : { data: summary, _memory_key: memoryKey };
|
|
3537
3539
|
}
|
|
3538
3540
|
function truncateDeep(value, depth) {
|
|
3539
3541
|
if (value == null || typeof value === "number" || typeof value === "boolean")
|
|
@@ -3548,7 +3550,7 @@ function truncateDeep(value, depth) {
|
|
|
3548
3550
|
}
|
|
3549
3551
|
return items;
|
|
3550
3552
|
}
|
|
3551
|
-
if (
|
|
3553
|
+
if (isRecord2(value)) {
|
|
3552
3554
|
if (depth >= MAX_DEPTH) {
|
|
3553
3555
|
const keys = Object.keys(value);
|
|
3554
3556
|
return `{${keys.slice(0, 5).join(", ")}${keys.length > 5 ? ", ..." : ""}}`;
|
|
@@ -3564,7 +3566,7 @@ function truncateDeep(value, depth) {
|
|
|
3564
3566
|
function summarizeSchema(data, memoryKey) {
|
|
3565
3567
|
const summary = describeSchema(data, 0);
|
|
3566
3568
|
addMemoryMetadata(summary, memoryKey, "schema");
|
|
3567
|
-
return
|
|
3569
|
+
return isRecord2(summary) ? summary : { data: summary, _memory_key: memoryKey };
|
|
3568
3570
|
}
|
|
3569
3571
|
var SCHEMA_MAX_DISTINCT = 6;
|
|
3570
3572
|
var SCHEMA_PRIMITIVE_CAP = 5;
|
|
@@ -3583,7 +3585,7 @@ function describeSchema(value, depth) {
|
|
|
3583
3585
|
if (Array.isArray(value)) {
|
|
3584
3586
|
if (value.length === 0)
|
|
3585
3587
|
return [];
|
|
3586
|
-
if (value[0] !== void 0 &&
|
|
3588
|
+
if (value[0] !== void 0 && isRecord2(value[0])) {
|
|
3587
3589
|
return describeObjectArray(value);
|
|
3588
3590
|
}
|
|
3589
3591
|
if (value.length <= SCHEMA_PRIMITIVE_CAP)
|
|
@@ -3593,7 +3595,7 @@ function describeSchema(value, depth) {
|
|
|
3593
3595
|
`+${value.length - SCHEMA_PRIMITIVE_CAP} more`
|
|
3594
3596
|
];
|
|
3595
3597
|
}
|
|
3596
|
-
if (
|
|
3598
|
+
if (isRecord2(value)) {
|
|
3597
3599
|
if (depth >= SCHEMA_DEPTH_LIMIT) {
|
|
3598
3600
|
return { _keys: Object.keys(value) };
|
|
3599
3601
|
}
|
|
@@ -3634,7 +3636,7 @@ function computeFieldStat(values) {
|
|
|
3634
3636
|
const avgLen = arrays.reduce((sum, a) => sum + a.length, 0) / arrays.length;
|
|
3635
3637
|
return { type: "array", avg_length: round4(avgLen) };
|
|
3636
3638
|
}
|
|
3637
|
-
if (values.every((v) =>
|
|
3639
|
+
if (values.every((v) => isRecord2(v))) {
|
|
3638
3640
|
const nestedKeys = /* @__PURE__ */ new Set();
|
|
3639
3641
|
for (const v of values) {
|
|
3640
3642
|
for (const k of Object.keys(v)) {
|
|
@@ -3665,19 +3667,19 @@ function describeObjectArray(items) {
|
|
|
3665
3667
|
};
|
|
3666
3668
|
}
|
|
3667
3669
|
function addMemoryMetadata(summary, memoryKey, strategy) {
|
|
3668
|
-
if (!
|
|
3670
|
+
if (!isRecord2(summary))
|
|
3669
3671
|
return;
|
|
3670
3672
|
summary._memory_key = memoryKey;
|
|
3671
3673
|
if (strategy === "truncate") {
|
|
3672
|
-
summary._recall = `Full data available via
|
|
3674
|
+
summary._recall = `Full data available via query_memory with key "${memoryKey}". Use where/select/limit to query slices.`;
|
|
3673
3675
|
} else {
|
|
3674
3676
|
const arrayPaths = detectArrayPaths(summary);
|
|
3675
3677
|
const pathHint = arrayPaths.length > 0 ? ` Array fields: ${arrayPaths.join(", ")}.` : "";
|
|
3676
|
-
summary._hint = `Use
|
|
3678
|
+
summary._hint = `Use query_memory with key "${memoryKey}" to get full data. Supports where, sort, aggregate, group_by, select, limit.${pathHint}`;
|
|
3677
3679
|
}
|
|
3678
3680
|
}
|
|
3679
3681
|
function detectArrayPaths(data) {
|
|
3680
|
-
if (!
|
|
3682
|
+
if (!isRecord2(data))
|
|
3681
3683
|
return [];
|
|
3682
3684
|
const paths = [];
|
|
3683
3685
|
for (const [key, value] of Object.entries(data)) {
|