[PR #119] [CLOSED] Bugfix/117 support of complex schemas #166

Closed
opened 2026-02-15 21:15:11 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/mcpo/pull/119
Author: @dmytroDragan
Created: 5/3/2025
Status: Closed

Base: devHead: bugfix/117-support-of-complex-schemas


📝 Commits (5)

  • e37d0eb Merge pull request #108 from open-webui/dev
  • dc48d27 feat: add comprehensive schema processing tests and utilities
  • 5796e00 feat: refactor filter handling to align with flat filter structure
  • 51ececa feat: implement PatchedClientSession with enhanced tool execution and logging
  • 426558c feat: improve error handling for tool execution in FastAPI

📊 Changes

15 files changed (+2331 additions, -566 deletions)

View changed files

📝 src/mcpo/main.py (+111 -52)
src/mcpo/tests/__init__.py (+0 -0)
src/mcpo/tests/conftest.py (+54 -0)
src/mcpo/tests/test_complex_types.py (+187 -0)
src/mcpo/tests/test_integration.py (+220 -0)
📝 src/mcpo/tests/test_main.py (+3 -3)
src/mcpo/tests/test_primitive_types.py (+142 -0)
src/mcpo/tests/test_references.py (+166 -0)
src/mcpo/tests/test_schema_composition.py (+172 -0)
src/mcpo/tests/test_schema_processing.py (+483 -0)
src/mcpo/tests/test_validation.py (+181 -0)
src/mcpo/utils/__init__.py (+41 -0)
src/mcpo/utils/common_logging.py (+9 -0)
📝 src/mcpo/utils/main.py (+322 -272)
📝 uv.lock (+240 -239)

📄 Description

Pull Request Checklist

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

Adds robust support for complex and recursive JSON schemas, enabling dynamic FastAPI endpoint generation for tools with advanced input/output structures. Improves schema parsing, validation, and error handling to ensure correct processing of deeply nested, recursive, and mutually recursive schemas.

Added

  1. Support for recursive, mutually recursive, and deeply nested JSON schemas in dynamic endpoint generation.
  2. Comprehensive test cases for recursive and complex schema scenarios in src/mcpo/tests/test_schema_processing.py.
  3. Dynamic model generation and caching to handle circular references in schemas.

Changed

  1. Enhanced get_model_fields and _process_schema_property to process $ref, anyOf, oneOf, allOf, and arrays with complex types.
  2. Improved error handling for invalid or unsupported schema definitions.
  3. Updated dynamic endpoint creation logic in create_dynamic_endpoints to utilize improved schema processing.

Deprecated

  • None

Removed

  • None

Fixed

Security

  • None

Breaking Changes

  • BREAKING CHANGE: Tools with complex or recursive schemas are now fully supported; existing integrations relying on previous, simpler schema handling may require updates to accommodate the new, more accurate validation and model generation.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/mcpo/pull/119 **Author:** [@dmytroDragan](https://github.com/dmytroDragan) **Created:** 5/3/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `bugfix/117-support-of-complex-schemas` --- ### 📝 Commits (5) - [`e37d0eb`](https://github.com/open-webui/mcpo/commit/e37d0ebd27934378364f534bd8ee6ae82a370536) Merge pull request #108 from open-webui/dev - [`dc48d27`](https://github.com/open-webui/mcpo/commit/dc48d278ba40c784e5fd05b6d0dbfd450ceb92f0) feat: add comprehensive schema processing tests and utilities - [`5796e00`](https://github.com/open-webui/mcpo/commit/5796e009536c762861404ecf504b75beef1935fd) feat: refactor filter handling to align with flat filter structure - [`51ececa`](https://github.com/open-webui/mcpo/commit/51ececaf7cef37c0566db59ba3a2b925293a267a) feat: implement PatchedClientSession with enhanced tool execution and logging - [`426558c`](https://github.com/open-webui/mcpo/commit/426558c0d633ebdc8aa8cb3e88c3388be2b0f5fc) feat: improve error handling for tool execution in FastAPI ### 📊 Changes **15 files changed** (+2331 additions, -566 deletions) <details> <summary>View changed files</summary> 📝 `src/mcpo/main.py` (+111 -52) ➕ `src/mcpo/tests/__init__.py` (+0 -0) ➕ `src/mcpo/tests/conftest.py` (+54 -0) ➕ `src/mcpo/tests/test_complex_types.py` (+187 -0) ➕ `src/mcpo/tests/test_integration.py` (+220 -0) 📝 `src/mcpo/tests/test_main.py` (+3 -3) ➕ `src/mcpo/tests/test_primitive_types.py` (+142 -0) ➕ `src/mcpo/tests/test_references.py` (+166 -0) ➕ `src/mcpo/tests/test_schema_composition.py` (+172 -0) ➕ `src/mcpo/tests/test_schema_processing.py` (+483 -0) ➕ `src/mcpo/tests/test_validation.py` (+181 -0) ➕ `src/mcpo/utils/__init__.py` (+41 -0) ➕ `src/mcpo/utils/common_logging.py` (+9 -0) 📝 `src/mcpo/utils/main.py` (+322 -272) 📝 `uv.lock` (+240 -239) </details> ### 📄 Description # Pull Request Checklist **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Have you written and run sufficient tests to validate the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [ ] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description Adds robust support for complex and recursive JSON schemas, enabling dynamic FastAPI endpoint generation for tools with advanced input/output structures. Improves schema parsing, validation, and error handling to ensure correct processing of deeply nested, recursive, and mutually recursive schemas. ### Added 1. Support for recursive, mutually recursive, and deeply nested JSON schemas in dynamic endpoint generation. 2. Comprehensive test cases for recursive and complex schema scenarios in src/mcpo/tests/test_schema_processing.py. 3. Dynamic model generation and caching to handle circular references in schemas. ### Changed 1. Enhanced get_model_fields and _process_schema_property to process $ref, anyOf, oneOf, allOf, and arrays with complex types. 2. Improved error handling for invalid or unsupported schema definitions. 3. Updated dynamic endpoint creation logic in create_dynamic_endpoints to utilize improved schema processing. ### Deprecated - None ### Removed - None ### Fixed - Correct handling of circular and recursive schema references. - Validation and processing of complex tool schemas without raising unexpected errors. - Fixed the issue #117 ### Security - None ### Breaking Changes - **BREAKING CHANGE**: Tools with complex or recursive schemas are now fully supported; existing integrations relying on previous, simpler schema handling may require updates to accommodate the new, more accurate validation and model generation. --- --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 21:15:11 -05:00
yindo closed this issue 2026-02-15 21:15:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/mcpo#166