Not able to test 'List Config Entities' with tools explorer

Created on 30 August 2025, about 1 month 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

remove default_value: ['id'],
from

 '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'],
    ),

to

 '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,
    ),

from:

  $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;

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇮🇹Italy salvatore_severo Foggia

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024