[PR #278] fix: add enum support in OpenAPI schema generation #224

Open
opened 2026-02-15 21:15:23 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/mcpo/pull/278
Author: @majiayu000
Created: 1/5/2026
Status: 🔄 Open

Base: devHead: fix/issue-245-enum-support


📝 Commits (1)

  • a5ebaa7 fix: add enum support in OpenAPI schema generation

📊 Changes

2 files changed (+62 additions, -3 deletions)

View changed files

📝 src/mcpo/tests/test_main.py (+55 -2)
📝 src/mcpo/utils/main.py (+7 -1)

📄 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:
    • fix: Bug fix or error correction

Changelog Entry

Description

When MCP servers define enum constraints on string or integer properties, these constraints were not being reflected in the generated OpenAPI schema. This caused LLMs to guess field values incorrectly.

Fixed

  • Enum values in string type properties are now converted to Literal[...values] type
  • Enum values in integer type properties are now converted to Literal[...values] type
  • Updated existing tests to reflect the new enum handling behavior
  • Added dedicated test cases for enum support

Closes #245


🔄 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/278 **Author:** [@majiayu000](https://github.com/majiayu000) **Created:** 1/5/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/issue-245-enum-support` --- ### 📝 Commits (1) - [`a5ebaa7`](https://github.com/open-webui/mcpo/commit/a5ebaa717da21f075d864bbbbfe32ac5e94a004b) fix: add enum support in OpenAPI schema generation ### 📊 Changes **2 files changed** (+62 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/mcpo/tests/test_main.py` (+55 -2) 📝 `src/mcpo/utils/main.py` (+7 -1) </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. - [x] **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? - [x] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **fix**: Bug fix or error correction # Changelog Entry ### Description When MCP servers define enum constraints on string or integer properties, these constraints were not being reflected in the generated OpenAPI schema. This caused LLMs to guess field values incorrectly. ### Fixed - Enum values in string type properties are now converted to `Literal[...values]` type - Enum values in integer type properties are now converted to `Literal[...values]` type - Updated existing tests to reflect the new enum handling behavior - Added dedicated test cases for enum support Closes #245 --- <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:23 -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#224