Ausgabeschemas für Clients
Veröffentlichen Sie die Struktur, damit sich Verbraucher darauf verlassen können.
Ausgabeschemas für Clients ist eine kostenlose MCP Academy-Lektion auf CoddyKit. Dies ist Lektion 3 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des MCP Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der MCP Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Publish the Shape
A structured tool can also advertise an output schema: a JSON Schema that tells clients exactly what fields and types to expect.
What an Output Schema Is
It is a machine-readable description of your result, listing each field name and its type. Clients read it before ever calling the tool.
Generated From Your Model
When you return a Pydantic model, the SDK derives the output schema for you. Your type hints become the published contract automatically.
Where Clients See It
The schema rides along in the tool listing under outputSchema. A client inspecting tools learns the shape without trial and error.
{"type": "object", "properties": {"temp_c": {"type": "number"}}}Why Clients Want It
With a known schema, a client can validate results and build UI ahead of time. There is no guessing about which fields will appear.
Types Carry Meaning
The schema marks temp_c as a number and condition as a string. Consumers trust these types instead of inferring them from one sample.
Required vs Optional
Fields with defaults become optional in the schema; others are required. Clients learn which keys are guaranteed to be present.
class Weather(BaseModel):
temp_c: float
note: str = ""A Stable Contract
Treat the output schema like a promise. Once clients depend on it, changing field names or types can break them downstream.
Schemas Aid Validation
Strict clients validate every result against the schema and reject mismatches. This catches server bugs fast, right at the boundary.
Self-Documenting Tools
An output schema doubles as documentation. New developers read the schema to understand a tool without digging through your code.
Keep Schemas Honest
Make sure your tool always returns what the schema claims. A result that drifts from its schema erodes the trust clients place in it.
Quick Check
Where does a tool publish the shape of its result?
Recap: Output Schemas
You saw how a tool publishes an output schema from your model. It documents fields, enables validation, and forms a stable contract. ✅
Häufig gestellte Fragen
Ist die Lektion „Ausgabeschemas für Clients“ kostenlos?
Ja — der vollständige Text von „Ausgabeschemas für Clients“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des MCP Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der MCP Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Ausgabeschemas für Clients“?
Veröffentlichen Sie die Struktur, damit sich Verbraucher darauf verlassen können. Du übst MCP Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um MCP Academy zu starten?
Keine Vorkenntnisse erforderlich. MCP Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 3 von 4.
Wie lange dauert die Lektion „Ausgabeschemas für Clients“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser MCP Academy-Lektion Code schreiben und ausführen?
Ja. Jede MCP Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Text oder strukturierter Inhalt
- Ein typisiertes Ergebnisobjekt zurückgeben
- Ausgabeschemas für Clients
- Bilder und Binärdaten zurückgeben