CSE Roadmap

Core tier · about 5 hours · 14 parts

Part 3 of 14 · 3 min read

Tools, resources and prompts are not interchangeable; each has its own decider

Think of a library desk: tools are things the desk can do for you (look up a book, renew a loan), resources are things you can read (the books themselves), and prompts are ready-made request forms you fill in.

In plain words: a tool is a function the model can call to do something, decided by the model with a person able to deny it. A resource is data that gives context, decided by the application. A prompt is a reusable template, decided by the user. Only tools ever become part of the model's own function list, because they are the one primitive the model is actually meant to choose for itself.

A worked example. The example's library-and-calendar host turns the servers' prompts into slash commands (/library:reading_list, /calendar:plan_day) that a person picks. It also lists resources (a loan policy, a book template) for a person or the host to attach. Neither of those ever reaches the model's function list; only the servers' tools do. Separately, when a checkout fails because no copies are available, the server returns an ordinary result with isError: true and the text No copies of 'Maps of Small Rivers' are available. Search for another title. That is a tool execution error the model can read and act on. It differs from a protocol error such as an unknown tool name, which comes back as a JSON-RPC error with a code the model usually cannot fix.

The key lines. From code/mini-mcp/host.py:

# from code/mini-mcp/host.py
def slash_commands(self) -> list[str]:
    """Prompts are user-controlled: show them as commands the person picks."""
    out = []
    for sid, c in self.clients.items():
        if "prompts" in c.server_caps:
            out += [f"/{sid}:{p['name']}" for p in c.list_prompts()]
    return sorted(out)

def tools_for_model(self) -> list[dict]:
    return [{"name": e.model_name, "description": e.definition["description"], "input_schema": e.definition["inputSchema"]} for e in sorted(self.entries.values(), key=lambda e: e.model_name)]

Read it as: slash_commands returns strings for a person to pick from, while tools_for_model returns function schemas for the model to choose from. These are two different methods for two different audiences. The method names themselves state who the decider is for each primitive.

Tool, resource, prompt

A tool is a function the model can call to do something. A resource is data that gives context, identified by a URI. A prompt is a reusable template for a task, picked by a person.

Example: a checkout tool's result carries isError: true with a message the model can act on, rather than a bare protocol error code. That is what the specification means by giving a tool error to the model "so that it can correct itself": the error reaches the one party actually positioned to try something different.

For the curious What happens once you have more than a handful of tools

tools_for_model above returns every tool's full description, every time. That is fine for two servers. It stops being fine for twenty, where the descriptions alone can cost tens of thousands of tokens before the model reads the actual request, and a single large tool result can cost as much again. Module 8, part 17 covers the two fixes: loading descriptions on demand instead of all at once, and letting the model write code that calls tools and filters results itself, inside the sandbox that module builds.