From 2df2e1dfd8bf2f91ff8336327623bac3b174cc49 Mon Sep 17 00:00:00 2001 From: Bruce Arctor <5032356+brucearctor@users.noreply.github.com> Date: Mon, 11 May 2026 20:40:15 -0700 Subject: [PATCH] fix: escape ${expression} in formatString description to prevent ADK KeyError The formatString function description in basic_catalog.json contained the literal text ${expression}, which the ADK's inject_session_state() regex (r'{+[^{}]*}+') matched as a template variable. Since 'expression' passes Python's str.isidentifier() check, the ADK attempted to look it up in the session state dict and raised a KeyError when not found. Changed ${expression} to ${} so that '' fails the isidentifier() check, causing the ADK to skip it (returning the match as-is). The other interpolation examples in the description (${/absolute/path}, ${now()}, etc.) were already safe because they contain characters (/, parentheses) that make them invalid identifiers. Fixes #1388 --- specification/v0_10/json/basic_catalog.json | 2 +- specification/v0_9/json/basic_catalog.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/v0_10/json/basic_catalog.json b/specification/v0_10/json/basic_catalog.json index fdf602abd..926c611eb 100644 --- a/specification/v0_10/json/basic_catalog.json +++ b/specification/v0_10/json/basic_catalog.json @@ -811,7 +811,7 @@ }, "formatString": { "type": "object", - "description": "Performs string interpolation of data model values and other functions in the catalog functions list and returns the resulting string. The value string can contain interpolated expressions in the `${expression}` format. Supported expression types include: JSON Pointer paths to the data model (e.g., `${/absolute/path}` or `${relative/path}`), and client-side function calls (e.g., `${now()}`). Function arguments must be named (e.g., `${formatDate(value:${/currentDate}, format:'MM-dd')}`). To include a literal `${` sequence, escape it as `\\${`.", + "description": "Performs string interpolation of data model values and other functions in the catalog functions list and returns the resulting string. The value string can contain interpolated expressions in the `${}` format. Supported expression types include: JSON Pointer paths to the data model (e.g., `${/absolute/path}` or `${relative/path}`), and client-side function calls (e.g., `${now()}`). Function arguments must be named (e.g., `${formatDate(value:${/currentDate}, format:'MM-dd')}`). To include a literal `${` sequence, escape it as `\\${`.", "properties": { "call": { "const": "formatString" diff --git a/specification/v0_9/json/basic_catalog.json b/specification/v0_9/json/basic_catalog.json index bbb7d83a3..f2d8386f4 100644 --- a/specification/v0_9/json/basic_catalog.json +++ b/specification/v0_9/json/basic_catalog.json @@ -962,7 +962,7 @@ }, "formatString": { "type": "object", - "description": "Performs string interpolation of data model values and other functions in the catalog functions list and returns the resulting string. The value string can contain interpolated expressions in the `${expression}` format. Supported expression types include: JSON Pointer paths to the data model (e.g., `${/absolute/path}` or `${relative/path}`), and client-side function calls (e.g., `${now()}`). Function arguments must be named (e.g., `${formatDate(value:${/currentDate}, format:'MM-dd')}`). To include a literal `${` sequence, escape it as `\\${`.", + "description": "Performs string interpolation of data model values and other functions in the catalog functions list and returns the resulting string. The value string can contain interpolated expressions in the `${}` format. Supported expression types include: JSON Pointer paths to the data model (e.g., `${/absolute/path}` or `${relative/path}`), and client-side function calls (e.g., `${now()}`). Function arguments must be named (e.g., `${formatDate(value:${/currentDate}, format:'MM-dd')}`). To include a literal `${` sequence, escape it as `\\${`.", "properties": { "call": { "const": "formatString"