This commit is contained in:
@@ -71,12 +71,17 @@ export async function executeTool(
|
||||
const category: 'requested' | 'unknown' = known.includes(toolName) || isMcp ? 'requested' : 'unknown';
|
||||
|
||||
if (category === 'unknown') {
|
||||
// The requested tool does not exist in the catalog (likely a hallucinated
|
||||
// name). Return a HARD ERROR so the agent does not mistake it for a pending
|
||||
// approval or a successful call. Still recorded for diagnostics (only when a
|
||||
// recorder is wired — `?.` is a silent no-op otherwise, so the message must
|
||||
// NOT claim it was recorded).
|
||||
ctx.recordToolRequest?.({ toolName, reason, category: 'unknown' });
|
||||
return {
|
||||
output:
|
||||
`"${toolName}" というツールは存在しません(要求は記録しました)。利用可能なツールで進めてください。` +
|
||||
` 何が使えるかは ReadToolDoc などで確認できます。`,
|
||||
isError: false,
|
||||
`"${toolName}" というツールは存在しません。RequestTool で要求できるのは実在するツール名だけです。` +
|
||||
` これは承認待ちではありません — 利用可能なツールで進めてください(一覧は ReadToolDoc 等で確認できます)。`,
|
||||
isError: true,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user