McpPropertyType.FLOAT emits invalid JSON Schema type "float" in MCP tool inputSchema
評価
調査の方向性
azure/functions/decorators/core.py の McpPropertyType.FLOAT の定義から始め、azure/functions/decorators/mcp.py の _TYPE_MAPPING と build_property_metadata のフローと比較します。再現された toolProperties エントリが有効な JSON Schema 型を使用するように enum を更新し、提供されている MCP ツールの例が "float" ではなく "number" を生成することを確認します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 179
- フォーク
- 80
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/azure-functions-python-library のほかの issue
-
area:python-functions
難易度 1/5 1時間未満 初心者へのやさしさ 10/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
-
area:python-functions
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
Azure/azure-functions-python-library#226 · コメント 1 件 · リアクション 2 件 ·
-
area:python-functions
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
Azure/azure-functions-python-library の issue をすべて見る
似ている issue
-
area/install reliability
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
FluidNumerics/fluid-walk-blocker#191 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
TransformerLensOrg/TransformerLens#1868 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
climate-analytics-lab/jax-gcm#1057 ·
メンテナーはふだん 1 日以内に返信