リソース:モデルが読み取るデータ
AIが取得できる読み取り専用のコンテキストについて学びます。
「リソース:モデルが読み取るデータ」はCoddyKit上の無料MCP Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMCP Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 MCP Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
The Second Primitive
After tools comes the resource: read-only data your server hands to the model as context, like a file, a record, or a config value. 📄
Resources Are for Reading
A resource never changes the world. It only exposes information the model can read, the way a GET request fetches a page without editing anything.
Every Resource Has a URI
Each resource is addressed by a URI, such as file:///notes.txt or config://app. The scheme and path tell clients exactly what they are asking for.
Declaring a Resource
In Python you mark a function with @mcp.resource() and pass its URI. The function returns the content whenever a client reads that URI.
@mcp.resource("config://version")
def get_version() -> str:
return "1.0.0"Content Comes Back as Text
What your resource returns becomes the content the model reads. Plain strings work great for notes, settings, or any small document.
MIME Types Describe Content
A resource also carries a MIME type like text/plain or application/json. It tells the client how to interpret the bytes it receives.
Application-Controlled, Not Model-Picked
Resources are usually application-controlled. The host app or user chooses which ones to attach, rather than the model grabbing them on its own.
Listing What's Available
A client can ask your server to list its resources. That discovery step lets a host show the user which documents it can pull into context.
Reading a Resource
To fetch one, the client sends a read request with the URI. Your server runs the matching function and returns the current content.
Think Files and Records
Good resources are things you'd want the AI to see but not run: a README, a database row, log output, or the latest settings.
Tool vs Resource
A simple test: if it does something, make it a tool; if it just provides information to read, make it a resource. Action versus context.
Quick Check
Let's confirm what a resource is for.
Recap: Resources
Great! A resource is read-only context with a URI and MIME type. Clients list and read them, and the model gains information without running anything. ✅
よくある質問
「リソース:モデルが読み取るデータ」レッスンは無料ですか?
はい。「リソース:モデルが読み取るデータ」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、MCP Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 MCP Academyコースには全4レッスンが含まれています。
「リソース:モデルが読み取るデータ」で何を学びますか?
AIが取得できる読み取り専用のコンテキストについて学びます。 ブラウザで直接実行するハンズオンコードでMCP Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
MCP Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのMCP Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「リソース:モデルが読み取るデータ」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このMCP Academyレッスンでコードを書いて実行できますか?
はい。すべてのMCP Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- ツール:モデルが実行するアクション
- リソース:モデルが読み取るデータ
- プロンプト:再利用可能な指示
- 適切なプリミティブを選ぶ