MCP & Protocol Testing / Quiz
Context: The Injected Superpower
ctx by type hint: client logging, progress reporting, resource reads, and LLM sampling from inside a tool, plus the stdout trap that corrupts stdio.
- Difficulty
- Medium
- Format
- Quiz
- Points
- 150
- Estimate
- 9 min
// MISSION BRIEF
Your Mission
FastMCP tools can do more than compute: through the injected Context they log to the client, stream progress, read the server's own resources, and even borrow the client's LLM. The injection mechanism itself is a favorite interview question, and the stdout trap has broken more stdio servers than any protocol bug.
Six questions. Speed bonus active.
// FIRST CONTACT
Battle teaser
How does a FastMCP tool receive the Context object?
- ACall FastMCP.get_context() as a global anywhere
- BClients pass context as the first JSON argument
- CName any parameter exactly 'ctx'; the name triggers injection
- DDeclare a parameter type-hinted as Context; injection matches the TYPE hint (the parameter name is irrelevant), and the parameter is excluded from the tool's public schema
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
fastmcpcontextsamplingmcp