fix: match overlap error to actual tool parameter schema

This commit is contained in:
wassname
2026-04-16 13:09:53 +08:00
parent 49f62ac2d0
commit 3281b2f9bd
+6 -3
View File
@@ -205,12 +205,15 @@ export function registerCompressTool(
.join(', ') .join(', ')
const gapInfo = gaps.length > 0 const gapInfo = gaps.length > 0
? gaps.map(g => `compress(${g.replace('..', ', ')})`).join('; ') ? gaps.map(g => {
const [s, e] = g.split('..')
return `{startId: "${s}", endId: "${e}"}`
}).join(', ')
: 'none available — all visible messages are covered by existing blocks' : 'none available — all visible messages are covered by existing blocks'
throw new Error( throw new Error(
`You tried compress(${startId}, ${endId}) but this overlaps existing summaries: ${overlapInfo}. ` + `Range {startId: "${startId}", endId: "${endId}"} overlaps existing summaries: ${overlapInfo}. ` +
`Instead use: ${gapInfo}`, `Available ranges: ${gapInfo}`,
) )
} }