File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -435,6 +435,23 @@ export class Serializer {
435435
436436 // Validate tool parameters (for blocks with tools)
437437 if ( currentTool ) {
438+ // Apply the block's tools.config.params transform to mirror execution-time
439+ // canonical → tool-param renaming (e.g. canonical `document` → tool param `file`).
440+ // Without this, validation looks up the pre-rename name and incorrectly reports
441+ // a missing field for blocks that rename inputs in tools.config.params.
442+ let mappedParams : Record < string , any > = params
443+ try {
444+ const paramsMapper = blockConfig . tools ?. config ?. params
445+ if ( typeof paramsMapper === 'function' ) {
446+ const result = paramsMapper ( { ...params } )
447+ if ( result && typeof result === 'object' ) {
448+ mappedParams = { ...params , ...result }
449+ }
450+ }
451+ } catch {
452+ // Mapper may throw on placeholder/runtime values — fall back to raw params.
453+ }
454+
438455 Object . entries ( currentTool . params || { } ) . forEach ( ( [ paramId , paramConfig ] ) => {
439456 if ( paramConfig . required && paramConfig . visibility === 'user-only' ) {
440457 const matchingConfigs =
@@ -468,7 +485,7 @@ export class Serializer {
468485 return
469486 }
470487
471- const fieldValue = params [ paramId ]
488+ const fieldValue = mappedParams [ paramId ] ?? params [ paramId ]
472489 if ( fieldValue === undefined || fieldValue === null || fieldValue === '' ) {
473490 const activeConfig = matchingConfigs . find ( ( config : any ) =>
474491 shouldSerializeSubBlock (
You can’t perform that action at this time.
0 commit comments