テキストと構造化コンテンツ
プレーンテキストを返す場合とデータを返す場合を学びます。
「テキストと構造化コンテンツ」はCoddyKit上の無料MCP Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMCP Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 MCP Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Two Ways to Reply
Every MCP tool result carries content, and you choose its shape. The big split is plain text versus structured data the client can parse.
What Text Content Is
A text result is just a string for the model to read, like a sentence or a paragraph. It is simple, human-friendly, and easy to drop into a prompt. 📝
What Structured Content Is
Structured content is real data, like a JSON object with named fields. Clients can read each field instead of guessing from prose.
{"temp_c": 21, "condition": "sunny", "city": "Cappadocia"}Why Text Alone Can Fail
If a tool returns "It is 21 degrees and sunny," the client must parse that English to use it. Wording changes break the parsing instantly.
Why Structure Wins for Code
With structured output, a client reads result.temp_c directly. The shape is predictable, so apps and agents can rely on it without scraping text.
You Can Send Both
MCP lets a tool return a readable text summary and structured data together. The model reads the prose; code reads the fields.
When Text Is the Right Call
Pick plain text when the answer is a message for a human to read, like an explanation, a status note, or a short summary.
When Structure Is the Right Call
Pick structured content when another program will consume the result, such as a price, a record, or a list of items to act on.
Default Is Text
If your tool just returns a string, MCP wraps it as text content automatically. Structured output is something you opt into on purpose.
def get_status() -> str:
return "All systems healthy"Think Consumer First
Ask who reads the result: a human, the model, or downstream code? That consumer decides whether you reach for text or structure.
Mixing Is Common
Mature tools usually return both: a friendly summary for the model plus a typed payload for the app. This keeps the result useful on every side.
Quick Check
A tool feeds prices into a billing app. Which output fits best?
Recap: Text vs Structure
You learned the two result shapes: readable text for humans and the model, and structured data for code. Match the shape to who reads it. ✅
よくある質問
「テキストと構造化コンテンツ」レッスンは無料ですか?
はい。「テキストと構造化コンテンツ」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、MCP Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 MCP Academyコースには全4レッスンが含まれています。
「テキストと構造化コンテンツ」で何を学びますか?
プレーンテキストを返す場合とデータを返す場合を学びます。 ブラウザで直接実行するハンズオンコードでMCP Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
MCP Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのMCP Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。
「テキストと構造化コンテンツ」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このMCP Academyレッスンでコードを書いて実行できますか?
はい。すべてのMCP Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- テキストと構造化コンテンツ
- 型付きの結果オブジェクトを返す
- クライアント向け出力スキーマ
- 画像とバイナリデータを返す