Not able to test 'List Config Entities' tool

Created on 13 May 2025, 4 months ago

Problem/Motivation

Unable to test the 'List Config Entities' tool using tools explorer.

The website encountered an unexpected error. Try again later.

InvalidArgumentException: "0" is an invalid render array key. Value should be an array but got a string. in Drupal\Core\Render\Element::children() (line 97 of core/lib/Drupal/Core/Render/Element.php).

Steps to reproduce

Enable tools explorer
Try to access '/admin/config/ai/explorers/tools_explorer?tool=ai_agent%3Alist_config_entities'

Proposed resolution

The 'default value' for the 'fields' option of the tool, should be a string. Currently, it's array

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇮🇳India Akhil Babu Chengannur

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Akhil Babu
  • Merge request !125Update default value → (Merged) created by Akhil Babu
  • 🇮🇳India Akhil Babu Chengannur

    Please review

  • Pipeline finished with Success
    4 months ago
    Total: 174s
    #496014
  • 🇩🇪Germany marcus_johansson

    Thanks, I wonder if it makes sense to remove the default, but I'll just merge this for now.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Issue was unassigned.
  • Status changed to Fixed about 2 months ago
  • 🇺🇸United States Kristen Pol Santa Cruz, CA, USA

    unassigning

  • 🇮🇹Italy salvatore_severo Foggia

    The problem persists on 1.2.x-dev

     'fields' => new ContextDefinition(
          data_type: 'list',
          label: new TranslatableMarkup("Fields"),
          description: new TranslatableMarkup("The fields to list. Leave empty to list all fields."),
          required: FALSE,
          default_value: ['id'],
        ),

    We should remove default_value: ['id'] and then modify

      $entity_data = [];
      foreach ($fields as $field) {
        $entity_data[] = $entity->get($field);
      }
      $this->list[] = $entity_data;
    

    to

    $entity_data = [];
    if (!is_null($fields) && count($fields)) {
      foreach ($fields as $field) {
         $entity_data[$field] = $entity->get($field);
      }
    }
    else {
      // Else the whole entity.
      $entity_data[] = $entity->toArray();
    }
    $this->list[] = $entity_data;
    
Production build 0.71.5 2024