Skip to content

Conversation

@ganeshyb
Copy link
Member

@ganeshyb ganeshyb commented Feb 6, 2026

Problem

Some MCP tool servers (e.g. HuggingFace MCP Server) return tool manifests where certain parameters have an empty string for their JSON Schema type field (e.g. "seed": {"type": ""}). This causes a pydantic_core.ValidationError when the SDK deserialises the ListFoundryConnectedToolsResponse, because SchemaType only accepts the six standard JSON Schema types (string, number, integer, boolean, array, object).

Error

pydantic_core._pydantic_core.ValidationError: 1 validation error for ListFoundryConnectedToolsResponse
ResultType.tools.0.manifest.9.parameters.properties.seed.type
  Input should be 'string', 'number', 'integer', 'boolean', 'array' or 'object'

Fix

1. azure-ai-agentserver-core - _models.py

  • Changed SchemaProperty.type from SchemaType to Optional[SchemaType] with a default of None
  • Added a model_validator(mode='before') that coerces empty type strings ("") to None

2. azure-ai-agentserver-agentframework - _foundry_tools.py

  • Added a guard in FoundryToolClient._create_ai_function that skips parameters with type is None and logs a warning, instead of crashing with AttributeError: 'NoneType' object has no attribute 'py_type'

Testing

  • Verified locally with HuggingFace MCP Server (previously failing) — now works
  • Verified MicrosoftLearn MCP Server still works (was never affected)
  • No existing tests broken

Some MCP tool servers (e.g. HuggingFace) return tool manifests where
certain parameters have an empty string for their JSON Schema 'type'
field. This causes a Pydantic ValidationError when the SDK tries to
deserialise the ListFoundryConnectedToolsResponse, because SchemaType
only accepts the six standard JSON Schema types.

Changes:
- SchemaProperty.type is now Optional[SchemaType] with a model_validator
  that coerces empty type strings to None.
- FoundryToolClient._create_ai_function skips parameters whose type is
  None with a warning log, instead of crashing with an AttributeError.
@github-actions github-actions bot added the Hosted Agents sdk/agentserver/* label Feb 6, 2026
@lusu-msft lusu-msft merged commit 2b1ddab into lusu/agentserver-1110 Feb 6, 2026
4 of 5 checks passed
@lusu-msft lusu-msft deleted the fix/handle-empty-schema-type branch February 6, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hosted Agents sdk/agentserver/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants