AI Agent's Can't Access the "People Friendly" Labels appearing in canvas UI
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3551315. --> Reported by: [afoster](https://www.drupal.org/user/594458) Related to !526 >>> <h3 id="overview">Overview</h3> <p>When using AI chat to update content on the canvas, the Canvas Template Agent creates a list of components it can choose from as an input in decision-making. To see what is available to the agent visit: <a href="https://v2025demo.ddev.site/admin/config/ai/explorers/tools_explorer?tool=canvas_ai%3Aget_component_context">https://v2025demo.ddev.site/admin/config/ai/explorers/tools_explorer?tool=canvas_ai%3Aget_component_context</a><br> and select "run Function".</p> <p>This outputs yaml data like this (example truncated to show "section" component from Mercury)</p> <pre>sdc.mercury.section:<br>&nbsp; id: sdc.mercury.section<br>&nbsp; name: Section<br>&nbsp; description: 'A section for components in a column. This can set in between 1 to 4 columns in different ratios. Note that the main slot is where the columns can be set. Header and footer always is 100% width. ALWAYS PUT THE COMPONENTS IN THE main_slot '<br>&nbsp; group: Layout<br>&nbsp; props:<br>&nbsp;&nbsp;&nbsp; columns:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name: 'Content layout'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description: 'No description available'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: string<br>&nbsp;&nbsp;&nbsp; width:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name: 'Section width'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description: 'No description available'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: string<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: 'hg:lg:max-w-full'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; enum:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - 'hg:lg:max-w-full'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - 'hg:lg:max-w-9/10'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - 'hg:lg:max-w-8/10'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - 'hg:lg:max-w-3/4'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - 'hg:lg:max-w-1/2'<br>&nbsp;&nbsp;&nbsp; margin_block_start:</pre><p>In the Canvas UI, the "section width" property values in the select list are "100%, 90%, 80%, 75%, 50%". </p> <p>These people-friendly UI labels do not appear to the Agent; They only see the values. </p> <p>If I write a prompt with things I want to happen with specific properties, I'll use the labels I can see on the screen. </p> <p>"Resize the width of all the sections currently set to 100% to 75%". Currently, the LLM must interpret what I type and guess which values are the closest. </p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Update the Get Component Context (canvas_ai) function to show both the value and labels for components available to Canvas. </p> <pre>- label: '100%'<br>&nbsp; value: 'hg:lg:max-w-full'<br>- label: '90%'<br>&nbsp; value: 'hg:lg:max-w-9/10'<br>- label: '80%'<br>&nbsp; value: 'hg:lg:max-w-8/10'<br>- label: '75%'<br>&nbsp; value: 'hg:lg:max-w-3/4'<br>- label: '50%'<br>&nbsp; value: 'hg:lg:max-w-1/2'</pre><h3 id="ui-changes">User interface changes</h3> <p>None.</p>
issue