Learn Claude Code: MCP Mastery Tools, Resources, and Prompts in Depth

Tools, Resources, and Prompts in Depth

Advanced 🕐 12 min Lesson 6 of 12
What you'll learn
  • Use MCP resources with @ mentions and MCP prompts as slash commands to reference server data and execute structured templates
  • Configure tool output size limits using MAX_MCP_OUTPUT_TOKENS and the anthropic/maxResultSizeChars annotation for tools that return large datasets
  • Apply the anthropic/requiresUserInteraction annotation and the Elicitation protocol to build tools that always require human confirmation

Beyond tool calls: the full MCP primitive surface

Most developers who connect MCP servers think of them entirely in terms of tool calls — Claude calls a function, the server responds, done. But tools are only one of three primitives. Resources let you reference server-provided data in any prompt using @ syntax. Prompts let servers define reusable command templates that appear as slash commands. Understanding all three changes how you design server integrations and how you use servers that expose them.

Resources: referencing server data with @ mentions

Resources are named data objects a server exposes — a database schema, an API spec, a configuration snapshot, a specific documentation page. When a server provides resources, they appear alongside local files in the @ mention autocomplete. Type @ in your prompt and Claude Code shows both local file suggestions and available resources from connected servers.

Reference a specific resource with the format @server:protocol://resource/path:

Can you analyze @github:issue://123 and suggest a fix?

Claude Code fetches the resource and attaches it to the prompt as context. You can reference multiple resources in a single prompt:

Compare @postgres:schema://users with @docs:file://database/user-model

Resource paths are fuzzy-searchable in the autocomplete. Resources can contain any content the server provides — text, JSON, structured data, or binary content.

Prompts: reusable command templates as slash commands

When a server exposes prompts, they become slash commands inside Claude Code under the format /mcp__servername__promptname. Spaces in server or prompt names are normalized to underscores. Discover available MCP prompts by typing / in your prompt — they appear alongside built-in Claude Code commands.

Run a prompt without arguments:

/mcp__github__list_prs

Pass arguments space-separated for prompts that require them:

/mcp__github__pr_review 456 /mcp__jira__create_issue "Bug in login flow" high

The server defines which parameters a prompt accepts. Claude Code parses them from the space-separated input and injects the prompt result directly into the conversation.

Elicitation: servers asking for mid-task input

Some server operations need information they cannot retrieve on their own — credentials for a one-time action, approval for a destructive step, a choice between options. MCP servers can request this structured input mid-task using the elicitation protocol. When a server sends an elicitation request, Claude Code displays an interactive dialog:

  • Form mode: the server defines input fields (like username and password) that you fill in and submit.
  • URL mode: the server sends a browser URL for authentication or approval. You complete the flow in the browser and confirm in the CLI.

No configuration is needed to receive elicitation dialogs — they appear automatically when a server requests them. To auto-respond to elicitation requests programmatically, use the Elicitation hook, which fires whenever a server sends an elicitation request and lets your hook script provide the response.

Managing large tool outputs

Some MCP tools return large amounts of data — full database schemas, detailed reports, extensive log files. Claude Code manages this with two thresholds. When a tool's output exceeds 10,000 tokens, Claude Code displays a warning in the session. The default maximum allowed output is 25,000 tokens. To increase this limit:

export MAX_MCP_OUTPUT_TOKENS=50000

If you are building an MCP server and a specific tool legitimately needs to return large outputs — a schema tool, a full file tree — annotate it with anthropic/maxResultSizeChars in the tool's _meta object:

{"name": "get_schema", "description": "Returns the full database schema", "_meta": {"anthropic/maxResultSizeChars": 200000}}

This raises the threshold for that specific tool to 200,000 characters (up to a ceiling of 500,000), independently of MAX_MCP_OUTPUT_TOKENS. Users do not need to change the environment variable to use that tool. The annotation applies to text content only — tools returning image data are still subject to the token limit.

Requiring explicit approval on every call

For tools where automatic approval would mean no human ever agreed — consent forms, access grants, destructive one-time operations — mark the tool with anthropic/requiresUserInteraction: true in its _meta:

{"name": "grant_access", "_meta": {"anthropic/requiresUserInteraction": true}}

Claude Code shows a permission prompt on every call to this tool, regardless of permission mode. In acceptEdits, auto, and bypassPermissions modes — which normally skip prompts — this tool still prompts. The "don't ask again" option is not offered. Allow rules that match the tool do not skip the prompt either. In dontAsk mode, which never prompts, Claude Code denies the call instead of silently approving it.

Dynamic tool updates and schema combinators

Claude Code supports MCP list_changed notifications, allowing servers to dynamically update their available tools, prompts, and resources without requiring you to disconnect and reconnect. When a server sends a list_changed notification, Claude Code refreshes the available capabilities from that server automatically.

If a tool's input schema uses anyOf, oneOf, or allOf at the top level — which the Claude API does not accept at the schema root — Claude Code flattens the schema and prepends a description of the parameter groups before sending the tool to the API. This behavior was introduced in v2.1.195. On older versions, tools with root-level combinators are skipped individually while the rest of the server's tools remain available.

Key takeaways
  • MCP resources appear alongside files in the @ mention autocomplete — reference them with @server:protocol://path to attach server-provided data to any prompt without copying
  • MCP prompts become slash commands in the format /mcp__servername__promptname — pass space-separated arguments after the command name for prompts that require parameters
  • Elicitation lets a server request structured input mid-task through an interactive dialog — the Elicitation hook lets you auto-respond to elicitation requests programmatically
  • anthropic/requiresUserInteraction: true forces a permission prompt on every tool call regardless of mode — the don't ask again option is never offered for these tools
  • anthropic/maxResultSizeChars in a tool's _meta lets that specific tool return up to 500k characters without requiring users to raise MAX_MCP_OUTPUT_TOKENS globally