19 lines
417 B
Markdown
19 lines
417 B
Markdown
---
|
|
title: "Pydantic参数验证"
|
|
type: concept
|
|
tags: [python, validation, mcp]
|
|
date: 2026-04-20
|
|
---
|
|
|
|
## Definition
|
|
在 Python MCP Server 中使用 Pydantic 为工具参数提供运行时类型验证、默认值和字段约束。
|
|
|
|
## Key Points
|
|
- 适合 Python FastMCP / MCP Server 实现
|
|
- 将输入校验前置到工具边界
|
|
- 让错误更可读、更可操作
|
|
|
|
## Connections
|
|
- [[MCP Builder]]
|
|
- [[MCP服务器]]
|