Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

McpPropertyType.FLOAT emits invalid JSON Schema type "float" in MCP tool inputSchema

Đang mở Phù hợp với người mới
#367 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@zecloud đang làm issue này rồi.

Từ ngày 1/10/2026.

  • #368 của @zecloud — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu trong azure/functions/decorators/core.py tại định nghĩa McpPropertyType.FLOAT, sau đó so sánh nó với _TYPE_MAPPING và luồng build_property_metadata trong azure/functions/decorators/mcp.py. Cập nhật enum để mục toolProperties được tái tạo sử dụng một kiểu JSON Schema hợp lệ, và xác minh rằng ví dụ công cụ MCP được cung cấp tạo ra "number" thay vì "float".

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

McpPropertyType.FLOAT is defined as "float" in azure/functions/decorators/core.py. When a tool property is declared explicitly with this enum, the value is written as-is into toolProperties and the Functions host copies it into the MCP tool inputSchema.

"float" is not a valid JSON Schema type (valid types: null, boolean, object, array, number, string, integer), and the MCP spec defines inputSchema as a JSON Schema object. Strict MCP clients therefore reject the whole tool. For example, an OpenAI-backed client fails with:

400 Invalid schema for function '<server>-create_music_video': 'float' is not valid under any of the given schemas.

This is also inconsistent within the library itself: type-hint inference in azure/functions/decorators/mcp.py (_TYPE_MAPPING) correctly maps Python float to "number". However, build_property_metadata gives explicit @app.mcp_tool_property(property_type=...) overrides precedence, so declaring McpPropertyType.FLOAT overwrites the correct inferred "number" with "float".

Repro

@app.mcp_tool()
@app.mcp_tool_property(arg_name="a", property_type=func.McpPropertyType.FLOAT)
def tool(a: float) -> str:
    ...

The resulting toolProperties contains "propertyType": "float". The expected value is "number".

Libraries that generate properties from Pydantic models through the explicit enum path are always affected.

Proposed fix

Change the enum value to the JSON Schema type:

FLOAT = "number"

This follows the existing DATETIME = "string" pattern, where the member name describes the Python type and the value is the wire/JSON Schema type.

Version: azure-functions 2.3.0 (latest on PyPI). The bug is also present on dev.

Ngôn ngữ chính
Python
Star
179
Fork
80
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Azure/azure-functions-python-library

Tất cả issue của Azure/azure-functions-python-library

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.