在本讲中,我们讲解如何在 MCP 和 ChatGPT Apps 中通过
JSON Schema来描述工具:
inputSchema 的结构、为何它是模型“提示词”的一部分、如何编写合适的
description、何时使用
enum 与约束(
minItems、
format)。接着我们在 TypeScript 中用
Zod +
zod-to-json-schema 搭建“single source of truth”,讨论
optional 字段的问题,并展示
_meta/annotations(例如
readOnlyHint、
destructiveHint、
openai/outputTemplate)在 UX 与安全上的作用。