fix: allow larger note searches and recoverable MCP validation errors

Raise note_search limit to 100 while preserving the default and output budget. Return scoped-tool argument validation failures as tool errors so models can correct and retry instead of receiving MCP internal errors.

Validation: 64 focused tests, typecheck and changed-file lint passed. Full tests timed out with two heartbeat migration failures; full lint reports unrelated story-graph demo errors.

Release note: 笔记搜索单次最多支持 100 条结果;内置 MCP 参数错误会返回明确提示,便于模型纠正后重试。
This commit is contained in:
mesalogo
2026-09-16 15:02:11 +08:00
parent da23810205
commit 0a8439a855
4 changed files with 80 additions and 5 deletions
+13 -2
View File
@@ -1640,7 +1640,18 @@ export class KnowledgeMcpGateway {
name as ScopedDataToolName
)
if (definition) {
const parsedInput = definition.inputSchema.parse(input)
const parsedInput = definition.inputSchema.safeParse(input)
if (!parsedInput.success) {
return {
isError: true,
content: [{
type: 'text' as const,
text: `Invalid arguments for ${name}: ${parsedInput.error.issues
.map((issue) => `${issue.path.join('.') || 'arguments'}: ${issue.message}`)
.join('; ')}. Correct the arguments and retry.`
}]
}
}
return {
content: [
{
@@ -1649,7 +1660,7 @@ export class KnowledgeMcpGateway {
await this.callScopedTool(
token,
name as ScopedDataToolName,
parsedInput,
parsedInput.data,
extra.signal
)
)