Module 6 · Lesson 3 · 16 min read
Tools, resources and prompts in MCP
MCP Tools, Resources and Prompts
Introduction
An MCP server offers its capabilities through three core components: tools, resources and prompts. This lesson explains the fields of each component and the methods used to discover and use it, and shows when to design a capability as a tool and when to make it a resource or a prompt, according to the 2026-07-28 specification.
Learning objectives
- List the fields of a tool definition and its result in MCP
- Use the resources methods resources/list, resources/read and resources/templates/list
- Use the prompts methods prompts/list and prompts/get
- Choose the right component for a particular capability and justify the choice
Tools: what the model decides to call
A tool is a function the server runs when the model decides so, which is why it is described as model-controlled. The client discovers tools with the tools/list method and calls them with the tools/call method. A tool definition includes the fields:
name: a unique name used in the call.title: a readable name to show the user.description: a description that helps the model know when to use it.inputSchema: a required field, a JSON Schema describing the arguments.outputSchema: optional, describes the shape of the structured result.annotations: hints about the tool's behavior, treated as untrusted unless the server is trusted.icons: icons to show in the host's interface.
An example of a tool definition as it might appear in a tools/list result:
{
"name": "get_course_schedule",
"title": "Course timetable",
"description": "Returns the lecture times of a university course from its code",
"inputSchema": {
"type": "object",
"properties": {"course_code": {"type": "string", "description": "The course code, such as CS101"}},
"required": ["course_code"]
},
"outputSchema": {
"type": "object",
"properties": {"day": {"type": "string"}, "time": {"type": "string"}},
"required": ["day", "time"]
}
}The result of tools/call carries a content array (text, an image or others), it may carry structuredContent matching the outputSchema, and the isError field, which becomes true when the tool fails to run. In the 2026-07-28 specification every result carries the resultType field with the value complete or input_required:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [{"type": "text", "text": "CS101: Sunday 10:00"}],
"structuredContent": {"day": "Sunday", "time": "10:00"},
"isError": false,
"resultType": "complete"
}
}Resources: what the application decides to include
A resource is data that the host reads and decides itself (or the user through its interface) to add to the model's context, so it is application-controlled. Each resource has a URI identifier, such as course://CS101/syllabus. The methods:
resources/list: the list of available resources.resources/read: reading a resource by itsuri.resources/templates/list: URI templates with variables, such ascourse://{code}/syllabus, to generate many identifiers without listing them all.
If a resource that does not exist is requested, the server returns error -32602.
Prompts: what the user chooses
A prompt is a ready-made message or set of messages that the server offers for the user to choose explicitly (user-controlled), like a command in a menu or a shortcut such as "Summarize the lecture". The methods: prompts/list to show the prompts, and prompts/get to fetch a prompt by its name with its arguments, so the server returns the messages ready to send to the model.
A practical example: a course server with all three components
A server for the course "Introduction to Agents" offers: a tool for searching past exam questions, a resource for the course plan, and an "Explain a concept to me" prompt. The following Python simulation checks the arguments against the inputSchema in a simplified way, reads a resource by its identifier, and generates prompt messages:
TOOL = {"name": "search_past_exams",
"inputSchema": {"type": "object",
"properties": {"keyword": {"type": "string"}},
"required": ["keyword"]}}
RESOURCES = {"course://AGENTS101/syllabus": "Week 1: What is an agent? Week 2: Memory"}
PROMPTS = {"explain_concept": "Explain the concept of {concept} to a first-year student with an example."}
EXAMS = ["Define the agent loop", "Compare short-term and long-term memory"]
def check_args(schema, args):
for key in schema.get("required", []):
if key not in args:
return f"Missing required argument: {key}"
for key, value in args.items():
expected = schema["properties"].get(key, {}).get("type")
if expected == "string" and not isinstance(value, str):
return f"Wrong type in {key}"
return None
def call_tool(args):
problem = check_args(TOOL["inputSchema"], args)
if problem:
return {"content": [{"type": "text", "text": problem}], "isError": True}
hits = [q for q in EXAMS if args["keyword"] in q]
return {"content": [{"type": "text", "text": "; ".join(hits) or "No results"}], "isError": False}
def read_resource(uri):
return {"contents": [{"uri": uri, "text": RESOURCES[uri]}]} if uri in RESOURCES else None
def get_prompt(name, arguments):
return [{"role": "user", "content": {"type": "text", "text": PROMPTS[name].format(**arguments)}}]
print(call_tool({"keyword": "memory"}))
print(call_tool({"keyword": 5}))
print(read_resource("course://AGENTS101/syllabus"))
print(get_prompt("explain_concept", {"concept": "handoff"}))Notice that the argument with the wrong type did not crash the program; it returned a result carrying isError: true and a clear message the model can read and use to correct its call.
Summary
The model decides to call tools through tools/call; each tool has a name, a description and a required inputSchema, and its result is content, which may include structuredContent and isError. Resources are data with URI identifiers that the application decides to include; they are read through resources/read and discovered through resources/list and resources/templates/list. Prompts are ready-made messages the user chooses through prompts/list and prompts/get. And tool annotations are treated as untrusted.
Terms
| Term | English | Definition |
|---|---|---|
| Tool | Tool | A function the server runs when the model decides to call it |
| Resource | Resource | Data with a URI identifier that the application decides to include in the context |
| Prompt | Prompt | A ready-made message the user chooses explicitly |
| Input schema | inputSchema | A required JSON Schema describing the tool's arguments |
| Structured content | structuredContent | A structured result that matches the output schema |
| Resource template | Resource Template | A URI identifier with variables for generating many resources |
| Annotations | Annotations | Hints about the tool's behavior that are considered untrusted by default |
Review questions
- What field is always required in an MCP tool definition, and why is it important?
- When would you make a capability a resource instead of a tool? Give an example.
- What is the difference between content and structuredContent in a tool's result?
- Why must the host not trust the annotations of a tool from an unknown server?
References
- MCP Specification 2026-07-28: Tools modelcontextprotocol.io Reviewed on 2026-11-18
- MCP Specification 2026-07-28: Resources modelcontextprotocol.io Reviewed on 2026-11-18
- MCP Specification 2026-07-28: Prompts modelcontextprotocol.io Reviewed on 2026-11-18
