Skip to content

fix(tools): declare items for array parameters of built-in tools - #297

Open
mayuriphad wants to merge 1 commit into
ANative-Lab:mainfrom
mayuriphad:fix/tool-array-items
Open

mayuriphad wants to merge 1 commit into
ANative-Lab:mainfrom
mayuriphad:fix/tool-array-items

Conversation

@mayuriphad

Copy link
Copy Markdown

Fixes #296

What

OpenAI rejects a whole request when a function schema has an array parameter without items (400 invalid_function_parameters: array schema missing items). CustomizeAction sends the tools' inputs unchanged, so an agent with any of these toolkits failed on its first call to an OpenAI (or OpenRouter) model, before any tool ran.

This declares the item type on every built-in array parameter that was missing it:

Tool file Parameters items
request_arxiv.py id_list {"type": "string"}
gmail_tools.py label_ids (3 tools), message_ids (2 tools), add_labels, remove_labels, attachments (2 tools) {"type": "string"}
image_tools/openai_image_tools/image_edit.py images {"type": "string"}
image_tools/openrouter_image_tools/image_generation.py image_urls, image_paths {"type": "string"}
database_faiss.py documents {"anyOf": [{"type": "string"}, {"type": "object"}]}, since a document is a text/file path or an object with text, metadata, doc_id

The other array parameters (e.g. doc_ids in FaissToolkit, the research tools) already declare items.

Test

tests/src/tools/test_tool_array_schemas.py parses every module under evoagentx/tools/ with ast, takes each class-level inputs dict literal, and fails if any "type": "array" schema, at any depth, has no items. It reads the source only, so it doesn't need the optional dependencies of the toolkits (Gmail, FAISS, image providers). On main it lists the 14 parameters above; with this change it passes. I checked that by running the same scan against both trees; I did not run the full pytest suite locally.

OpenAI rejects a function schema when an array parameter has no
items, so any agent given ArxivToolkit, GmailToolkit, FaissToolkit or
the image toolkits failed on its first OpenAI call with
"array schema missing items". Declare the item type on each of these
parameters, and add a test that checks every tool's inputs.

Fixes ANative-Lab#296

Signed-off-by: mayuriphad <mayuriphad656@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 31, 2026 08:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ArxivToolkit and other built-in tools send array parameters without items, OpenAI rejects the request

2 participants