Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#367 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@zecloud がすでに取り組んでいます。

2026年10月1日 から。

  • #368 @zecloud による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api

調査の方向性

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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Azure/azure-functions-python-library のほかの issue

Azure/azure-functions-python-library の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。