mirror of
https://github.com/open-webui/mcpo.git
synced 2026-11-05 01:27:39 +00:00
[PR #300] fix: handle list-valued JSON Schema array items (tuple validation) #247
Labels
No labels
bug
can't reproduce
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/mcpo#247
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/mcpo/pull/300
Author: @SaurabhMaydeo
Created: 6/26/2026
Status: 🔄 Open
Base:
dev← Head:fix/array-tuple-items📝 Commits (1)
3ac6764fix: handle list-valued JSON Schema array items (tuple validation)📊 Changes
2 files changed (+102 additions, -2 deletions)
View changed files
📝
src/mcpo/tests/test_main.py(+61 -0)📝
src/mcpo/utils/main.py(+41 -2)📄 Description
Pull Request Checklist
devbranch.fix:prefix.Changelog Entry
Description
_process_schema_propertyassumed a property'sitemsis always a single schema object. JSON Schema also allowsitemsto be a list of schemas (tuple validation in Draft-07; Draft 2020-12 calls itprefixItems). When an MCP server emits that form, the list was passed into the recursive call andprop_schema.get("type")raisedAttributeError: 'list' object has no attribute 'get'. Because this happens while building the route, the whole tool's endpoint failed to mount.Reproduced with
@brave/brave-search-mcp-server(#296). Minimal repro:The fix handles list-valued
items(and the 2020-12prefixItemsform) by buildingList[Union[...]]over the element schemas, mirroring how the function already handlesanyOfand multi-typetypelists. Non-object elements (e.g. boolean sub-schemas) and empty tuples fall back toList[Any]instead of crashing. This is a deliberate approximation — it does not model positional or fixed-length tuple semantics; the goal is to stop the mount-time crash and keep OpenAPI generation working. Happy to collapse it to a plainList[Any]if you'd prefer the smaller change.Added
src/mcpo/tests/test_main.pyfor tuple-validation arrays: listitems,prefixItems, single element, empty list, and a non-object (boolean) element.Changed
Deprecated
Removed
Fixed
AttributeError: 'list' object has no attribute 'get'when a tool's input schema uses list-valueditems/prefixItems(tuple validation), which previously stopped the tool's endpoint from mounting (#296).Security
Breaking Changes
itemspath is unchanged.Additional Information
isinstance(items_schema, list)guard suggested by the reporter in that issue.src/mcpo/utils/main.py(thearraybranch of_process_schema_property) plus tests insrc/mcpo/tests/test_main.py. Behavior-preserving for all existing schemas.Screenshots or Videos
pytest src/mcpo/tests/→ 32 passed).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.