Skip to content

make_tool_server: map JSON Schema "array" to list - #393

Open
rpinho wants to merge 1 commit into
Future-House:mainfrom
rpinho:fix-array-schema
Open

rpinho wants to merge 1 commit into
Future-House:mainfrom
rpinho:fix-array-schema

Conversation

@rpinho

@rpinho rpinho commented Nov 16, 2026 •

Copy link
Copy Markdown

There's a bug in the tool server: Tool.from_function describes a list[int] parameter with the JSON Schema type "array", but the type map the server uses to build the request model has "list". So make_tool_server raises KeyError: 'array' for any tool with a list parameter, before any endpoint exists.

def total(values: list[int]) -> str: ...
make_tool_server(...)  # KeyError: 'array'

This changes the list entry of the type map in src/aviary/tools/base.py from "list" to "array", the JSON Schema name, so the lookup finds it, the server builds, and POST {"values": [1, 2]} reaches the tool.

Test: test_make_tool_server_array_parameter in tests/test_tools.py fails on main and passes here. Core tests: 181 passed, 1 skipped (2 live cases deselected); ruff, mypy, refurb and pylint pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N


Note

Low Risk
Single-line mapping fix in shared type metadata; behavior change is limited to enabling list/array tool parameters on the tool server.

Overview
Fixes make_tool_server failing with KeyError: 'array' when a tool parameter is typed as a Python list.

type_map in base.py now maps list to the JSON Schema type "array" (not "list"), matching what Tool.from_function emits via Pydantic and what create_request_model_from_tool resolves through reverse_type_map. Tools with list parameters can build HTTP request models and serve POST bodies with JSON arrays.

Adds test_make_tool_server_array_parameter, which stands up a tool server for list[int] and asserts a summed result from {"values": [1, 2, 3]}.

Reviewed by Cursor Bugbot for commit a960c31. Configure here.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 14:26

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.

🟢 Approval recommended

No active review issues block approval of the list-parameter schema fix.

No open issues 🎉

What changed in this PR

Fixes make_tool_server failing with KeyError: 'array' when building endpoints for tools with list parameters.

Changes:

  • Changes the shared type map to use JSON Schema’s "array" name for Python list.
  • Adds a regression test that creates a server for a list[int] tool, posts an array, and checks the summed result.
File Description
tests/​test_tools.py Adds an endpoint regression test for list parameters.
src/​aviary/​tools/​base.py Corrects the list mapping from "list" to "array".

Review effort: Balanced

@rpinho

rpinho commented Nov 24, 2026

Copy link
Copy Markdown
Author

Let me know if you have any thoughts on this one.

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.

2 participants