Tool calls with no properties causes a failure

Created on 10 June 2025, 27 days ago

Problem/Motivation

If you have a tool call with no input (or all input is forced+hidden), you get an error back from the AWS API that toolConfig.tools[0].inputSchema.json is invalid.

Currently that ends up as null as docroot/modules/contrib/ai_provider_aws_bedrock/src/Plugin/AiProvider/BedrockProvider.php:396 is run with no $parameters.

Steps to reproduce

Call an agent with a function call with no exposed parameters.

Proposed resolution

Explored:

  • Completely removing inputSchema: AWS error due to missing required property
  • Making inputSchema.json.properties an empty array: AWS error due to array when expecting object
  • Making inputSchema.json.properties an empty object: AWS SDK error due to expecting an array :P
  • Always setting parameters to {"type":"object"} in \Drupal\ai\OperationType\Chat\Tools\ToolsFunctionInput::renderFunctionArray: OpenAI error due to peroprties being required.

So propose this is handled as a special case where we do 4, but in the AWS Bedrock provider (we already have custom code there anyway).

Remaining tasks

Implement the fix.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇬🇧United Kingdom andrewbelcher

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