Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

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

Ouverte Adaptée aux débutants
#367 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

@zecloud y travaille déjà.

Depuis le 1/10/2026.

  • #368 par @zecloud — ouverte

Évaluation

Difficulté
1/5
Temps estimé
Moins d'une heure
Accessibilité débutants
88/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
api

Piste de recherche

Commencez dans azure/functions/decorators/core.py à la définition de McpPropertyType.FLOAT, puis comparez-la avec _TYPE_MAPPING et le flux de build_property_metadata dans azure/functions/decorators/mcp.py. Mettez à jour l’enum afin que l’entrée toolProperties reproduite utilise un type JSON Schema valide, et vérifiez que l’exemple d’outil MCP fourni produit "number" plutôt que "float".

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Python
Étoiles
179
Forks
80
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de Azure/azure-functions-python-library

Toutes les issues de Azure/azure-functions-python-library

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.