You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tools automatically generate JSON Schema definitions for their return types, helping LLMs understand the structure of the data they'll receive:
253
+
Tools automatically generate JSON Schema definitions for their return types, helping LLMs understand the structure of the data they'll receive. FastMCP also enhances these schemas with semantic metadata that enables intelligent UI rendering and data formatting.
254
+
255
+
##### Basic Schema Generation
254
256
255
257
```python
256
258
from pydantic import BaseModel
@@ -309,7 +311,7 @@ class WeatherForecast(BaseModel):
FastMCP automatically enhances output schemas with semantic metadata by analyzing field names and types. This helps client applications provide intelligent UI rendering and formatting:
332
+
333
+
```python
334
+
from pydantic import BaseModel
335
+
from mcp.server.fastmcp import FastMCP
336
+
337
+
mcp = FastMCP("Enhanced Schema Demo")
338
+
339
+
340
+
classUserProfile(BaseModel):
341
+
email: str# Automatically detected as semantic_type: "email"
342
+
profile_url: str# Automatically detected as semantic_type: "url"
343
+
avatar_image: str# Automatically detected as semantic_type: "image_url"
344
+
created_date: str# Automatically detected as semantic_type: "datetime"
345
+
account_balance: float# Automatically detected as semantic_type: "currency"
346
+
completion_percentage: (
347
+
float# Automatically detected as semantic_type: "percentage"
348
+
)
349
+
primary_color: str# Automatically detected as semantic_type: "color"
0 commit comments