tool_ai_connector does not handle tools returning list of entities
`Drupal\tool_ai_connector\Plugin\AiFunctionCall\ToolPluginBase::getReadableOutput()` assumes every entity type output is a single entity. When a tool declares an output definition with `data_type: 'entity'` and `multiple: TRUE`, the output value is a list (array) of entities, not a single entity object. It results in a fatal error. ### Steps to reproduce 1. Enable the `tool_belt_content` module. 2. Create at least two nodes with same title. 3. Enable the `tool_ai_connector`. 4. Create a new agent and add the `tool_belt:entity_load_by_property` to it. 5. In the prompt ask the agent to call this tool to look for the entities by title. 6. In the AI Agents Explorer, try to load the entities with a prompt. (Eg prompt - Update the article with title "Drupal" and update it's body with "...") ### Expected behavior The agent should be able to find the list of articles and maybe ask the user a clarifying question. ### Actual behavior Fatal error in the logs: > TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, array given in method_exists() (line 149 of modules/contrib/tool/modules/tool_ai_connector/src/Plugin/AiFunctionCall/ToolPluginBase.php). ### Drupal version 11 ### Tool module version Latest dev release ### AI usage (if applicable) - [ ] **AI Assisted Issue:** This issue was generated with AI assistance, but was reviewed and refined by the creator. - [ ] **AI Assisted Code:** This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision. - [ ] **AI Generated Code:** This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human. - [ ] **Vibe Coded:** This code was generated by an AI and has only been functionally tested.
issue