Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#367 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@zecloud ci sta già lavorando.

Dal 1/10/2026.

  • #368 di @zecloud — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api

Direzione di ricerca

Inizia in azure/functions/decorators/core.py alla definizione di McpPropertyType.FLOAT, quindi confrontala con _TYPE_MAPPING e con il flusso di build_property_metadata in azure/functions/decorators/mcp.py. Aggiorna l’enum in modo che la voce toolProperties riprodotta utilizzi un tipo JSON Schema valido e verifica che l’esempio di strumento MCP fornito produca "number" anziché "float".

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
179
Fork
80
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/azure-functions-python-library

Tutte le issue di Azure/azure-functions-python-library

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.