Skip to content

Fix McpPropertyType.FLOAT to emit JSON Schema 'number' type - #368

Open
Aymeric Weinbach (zecloud) wants to merge 1 commit into
Azure:devfrom
zecloud:fix-mcp-float-property-type
Open

Aymeric Weinbach (zecloud) wants to merge 1 commit into
Azure:devfrom
zecloud:fix-mcp-float-property-type

Conversation

@zecloud

Copy link
Copy Markdown

Fixes #367.

McpPropertyType.FLOAT was "float", which is not a valid JSON Schema type. Explicit @app.mcp_tool_property(property_type=McpPropertyType.FLOAT) declarations, which take precedence over type-hint inference, therefore produced an MCP inputSchema that strict clients reject (for example: 400 Invalid schema ... 'float' is not valid under any of the given schemas).

This change sets FLOAT = "number", consistent with _TYPE_MAPPING in mcp.py (float -> number) and with the existing DATETIME = "string" pattern. The expectation in test_mcp_property_input_enum_float is updated accordingly.

Tests: pytest tests/decorators/test_mcp.py tests/test_mcp.py, 97 passed.

'float' is not a valid JSON Schema type, so MCP clients reject tool
inputSchema generated from McpPropertyType.FLOAT. Type-hint inference
already maps float to 'number'; align the explicit enum with it.

Fixes Azure#367

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 08:14
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused fix aligns explicit float declarations with JSON Schema and existing type inference behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Corrects MCP float properties to emit valid JSON Schema.

Changes:

  • Maps McpPropertyType.FLOAT to "number".
  • Updates the corresponding decorator test expectation.
File Description
azure/​functions/​decorators/​core.py Corrects the float wire type.
tests/​decorators/​test_mcp.py Verifies "number" serialization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants