AI Hints
Home›MCP Tutorial›Protocol Details
MCP · Lesson 80 of 120

Capabilities

What each side supports.

⏱ 2 min read▶ Video at 1:11:39🎓 Free
Watch this lesson in the MCP courseWatch on YouTube ↗Full MCP course

Not every server has tools, resources, and prompts. Capabilities say which features each side supports. A client should only use what the server says it supports.

Capabilities
From the video: Capabilities
  • Not every feature
  • Capabilities
  • Only use what's there

Reading capabilities

After connecting, server capabilities lists what the server offers. We print each feature, and its options. Run it. Tools, resources, and prompts, and resources can even be subscribed to.

capabilities.pypython
import asyncio
from mcp import Client
from northwind import mcp

async def main():
    async with Client(mcp) as client:
        caps = client.server_capabilities.model_dump(exclude_none=True)
        for feature, options in caps.items():
            print(f"{feature:10}", options)

asyncio.run(main())
Output
prompts    {'list_changed': True}
resources  {'subscribe': True, 'list_changed': True}
tools      {'list_changed': True}
Also uses northwind.py
from mcp.server.mcpserver import MCPServer
from mcp.server.mcpserver.exceptions import ToolError

mcp = MCPServer("northwind")
ORDERS = {1042: "shipped", 1043: "packing", 1044: "delivered"}

@mcp.tool()
def order_status(order_id: int) -> str:
    """Look up the status of a Northwind order by its number."""
    if order_id not in ORDERS:
        raise ToolError(f"Order {order_id} not found")
    return ORDERS[order_id]

@mcp.tool()
def delivery_cost(order_total: float) -> str:
    """UK delivery cost for an order total in pounds."""
    return "free" if order_total >= 50 else "£4.99"

@mcp.resource("policy://returns")
def returns_policy() -> str:
    """Northwind's returns policy."""
    return "You can return any unused item within 30 days of delivery."

@mcp.prompt()
def support_reply(question: str) -> str:
    """Draft a polite reply to a customer."""
    return f"Write a short, polite reply to this Northwind customer: {question}"

if __name__ == "__main__":
    mcp.run()

Common capabilities

Tools, resources, and prompts say the server has them. List changed means it can announce when the list changes. Subscribe means clients can watch a resource. Completions means it can suggest argument values.

CapabilityMeans
tools / resources / promptsthe server has them
listChangedannounces new lists
subscribewatch a resource
completionssuggests values

Summary

Capabilities say what each side supports. Check them before using a feature. Next, pagination.

Key takeaways
  • server_capabilities
  • listChanged
  • subscribe
Next up: Pagination — long lists