Transforms tool approval and ask-user payloads into SDK-friendly decision maps, enforcing validation and limits.
// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { GraphEvents } from '@librechat/agents';
import type {
ToolApprovalDecision,
ToolApprovalDecisionMap,
AskUserQuestionResolution,
AskUserQuestionsResolution,
EventHandler,
RunStep,
} from '@librechat/agents';
import type { Agents } from 'librechat-data-provider';
import { ASK_USER_QUESTION_TOOL_NAME } from './askUserQuestionTool';
import { isToolApprovalPayloadValid } from './policy';
/**
* Translate the host-facing approval wire format into the SDK's resume value.
*
* The wire format ({@link Agents.ToolApprovalResolution}) is shaped for the UI —
* a flat `decision` string plus optional `editedArguments` / `re
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key