Share via

Schema validation of MCP server tools/list operation fails when using MCP tools in Foundry

Andrew McGregor 30 Reputation points
2025-12-29T07:39:06.72+00:00

Added MCP tool in foundry, however when I call it I get

Errorinvalid_request_error: Invalid tool schema for: <FoundryToolName>.<first tool returned from tools/list operation>

An example schema returned is shown below:

                "inputSchema": {
                    "description": "Parameters for creating an incident.",
                    "properties": {
                        "short_description": {
                            "description": "Short description of the incident",
                            "title": "Short Description",
                            "type": "string"
                        },
                        "description": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "Detailed description of the incident",
                            "title": "Description"
                        },
                        "caller_id": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "User who reported the incident",
                            "title": "Caller Id"
                        },
                        "category": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "Category of the incident",
                            "title": "Category"
                        },
                        "subcategory": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "Subcategory of the incident",
                            "title": "Subcategory"
                        },
                        "priority": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "Priority of the incident",
                            "title": "Priority"
                        },
                        "impact": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "Impact of the incident",
                            "title": "Impact"
                        },
                        "urgency": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "Urgency of the incident",
                            "title": "Urgency"
                        },
                        "assigned_to": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "User assigned to the incident",
                            "title": "Assigned To"
                        },
                        "assignment_group": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "default": null,
                            "description": "Group assigned to the incident",
                            "title": "Assignment Group"
                        }
                    },
                    "required": [
                        "short_description"
                    ],
                    "title": "CreateIncidentParams",
                    "type": "object"
                }

Researching this it seems that foundry enforces a more restrictive schema and rejects the use of validation keywords such as "anyof". Is this true? If so what are the validation rules?

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform


Answer accepted by question author

SRILAKSHMI C 18,390 Reputation points Microsoft External Staff Moderator
2025-12-29T11:06:19.0966667+00:00

Hello Andrew McGregor,

Welcome to Microsoft Q&A and Thank you for reaching out.

Yes, this behavior is expected when using MCP tools in Azure AI Foundry.

Why this is happening

Azure AI Foundry enforces stricter schema validation rules for MCP tools than full JSON Schema specifications. While your schema is valid JSON Schema, Foundry only supports a limited subset of schema features. Validation keywords such as anyOf are not supported and will cause the tool invocation to fail with:

Invalid tool schema

This is why the tool may register successfully but fails during execution.

What schema rules Foundry enforces

Foundry expects simple, deterministic schemas for tool inputs.

Supported

  • type: "object"
  • properties with a single concrete type
    • string, number, boolean
  • required
  • description
  • title

Not supported

  • anyOf, oneOf, allOf
  • Nullable union types (e.g., string | null)
  • Complex validation logic
  • Advanced JSON Schema constructs

Foundry does not support nullable fields defined via unions.

Why nullable fields fail

Patterns like this are rejected:

"priority": {
  "anyOf": [
    { "type": "string" },
    { "type": "null" }
  ]
}

Foundry requires each property to have exactly one type.

How to fix your schema

Simplify the schema

Remove anyOf and similar constructs

Define optional parameters using a single type

Only list truly required fields in the required array

Omit optional fields from the request instead of passing null

Example

{
  "type": "object",
  "properties": {
    "short_description": {
      "type": "string",
      "description": "Short description of the incident"
    },
    "description": {
      "type": "string",
      "description": "Detailed description of the incident"
    },
    "priority": {
      "type": "string",
      "description": "Priority of the incident"
    }
  },
  "required": ["short_description"]
}

Recommended troubleshooting steps,

Start with a minimal schema Define only one required field and confirm the tool executes successfully.

Add properties incrementally This helps identify which schema element triggers validation failure.

Avoid OpenAPI-generated schemas without cleanup Auto-generated schemas often include unsupported constructs and require simplification before use with Foundry.

Foundry validates MCP tool schemas using a restricted schema subset

Keywords like anyOf are not supported

Nullable fields must be handled by omission, not unions

Simplified, single-type schemas are required

This is a platform limitation, not an issue with your MCP server logic

Once the schema is simplified to match Foundry’s expectations, the tool should execute correctly.

Please refer this https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/tools/azure-foundry?wt.mc_id=knowledgesearch_inproduct_azure-cxp-community-insider

I Hope this helps. Do let me know if you have any further queries.

Thank you!

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.