MCP
3 / 6
MCP 3 min

Tools, Resources, and Prompts

The three primitives MCP exposes and how a model uses each one to interact with external systems.

MCP exposes three core primitives: tools, resources, and prompts. Tools are executable actions the model decides to invoke. Resources are readable data the host can attach to context, usually without the model deciding anything. Prompts are reusable instruction templates the user (not the model) selects.

When to Use Each Primitive
Use tools for actions like querying APIs or writing files. Use resources for structured context like schemas, docs, and configs. Use prompts for consistent workflows and repeatable task setup.
python
# A tool: the model decides when to call this, with what arguments
Tool(
    name="run_query",
    description="Run a read-only SQL query against the database",
    inputSchema={
        "type": "object",
        "properties": {"sql": {"type": "string"}},
        "required": ["sql"],
    },
)

# A resource: no arguments, no model decision, just an addressable
# piece of context the host can fetch and inject directly
Resource(
    uri="postgres://schema",
    name="Database Schema",
    description="Full schema of all public tables",
    mimeType="text/plain",
)

Notice the resource has no `inputSchema`. It is not something the model calls with arguments, it is something the host reads and hands to the model as context, the same way you might paste a file into a prompt. This is why schema discovery works well as a resource (`postgres://schema` in the companion Postgres server) while running a query works well as a tool.

Description Quality Is Not Optional
Models choose tools based on name and description text alone. If two tools overlap or a description is vague, tool selection quality drops fast. You already saw this exact failure mode in the Foundations module's Tool Calling Fundamentals lesson, where a vague `get_weather` description made the model fall back to 'I don't have access to that.' MCP tool descriptions fail the same way, for the same reason: the model only has the words you gave it.
Control Panel

Think of MCP as a control panel. Tools are buttons, resources are display screens, and prompts are saved operating procedures.

What's Next
Now that you know what a server can expose, the next question is how those messages actually travel between processes: stdio or network transport.