In the previous post, we looked at Server Features—where the host or model drives the interaction by calling Tools, reading Resources, and expanding Prompts.
Client Features invert that flow. Instead of the client simply asking the server for data or execution, the MCP server pauses mid-execution to ask the host application (and by extension, the user) for missing input, workspace boundaries, or an LLM completion.
In the 2026-07-28 stateless specification, server-initiated requests are strictly scoped to an active client request so a server cannot interrupt a user out of nowhere—while older stateful primitives like roots and sampling were formally deprecated (with a 12-month sunset window until July 2027) in favor of explicit arguments and direct model API calls.
Let's break down the three Client Features, where each fits in the protocol lifecycle, and how to upgrade our DevOps rollback_deployment tool to enforce server-side human approval using Elicitation.
The Three MCP Client Features
1. Elicitation (elicitation/create) — Active & Recommended
Control Model: The Server requests structured, validated input directly from the End User.
When: When a tool lacks critical parameters or hits a high-stakes confirmation gate, relying on prompt instructions alone is fragile.
Any client can invoke tools/call directly and bypass the prompt's guardrails. Elicitation lets the server pause inside a tool handler and send a JSON Schema form (requestedSchema) back to the host. The host renders a native UI prompt, collects the user's response (accept, decline, or cancel), and resumes the tool call over a stateless Multi Round-Trip Request (MRTR).
- Best for: Destructive action approvals, environment/tenant selection, missing runtime parameters, and step-up confirmation gates.
- 2026-07-28 Status: Core, active primitive for human-in-the-loop workflows.
2. Roots (roots/list) — Deprecated in 2026-07-28
Control Model: The Host exposes filesystem or workspace URI boundaries to the Server.
Originally designed for local stdio servers (like filesystem or Git integrations), Roots allowed a server to ask the host, "Which directories am I allowed to inspect?" and subscribe to notifications/roots/list_changed events when a user opened or closed folders in their IDE.
-
Best for: Legacy local workspace scoping (
file:///Users/dev/project). - 2026-07-28 Status: Deprecated. Maintaining server-side root state clashed with stateless HTTP deployments. Modern servers accept explicit path/repository arguments in tool schemas or rely on host-managed folder sandboxing.
3. Sampling (sampling/createMessage) — Deprecated in 2026-07-28
Control Model: The Server asks the Host to run an LLM inference call on its behalf.
Sampling enabled an MCP server to stay "model-agnostic" without managing its own API keys. Inside a tool handler, the server could send a messages array, a systemPrompt, and modelPreferences back to the client, letting the host approve the prompt, run inference using the user's model subscription, and return the generated completion.
- Best for: Legacy local tools needing lightweight summarization or classification without bundled LLM credentials.
- 2026-07-28 Status: Deprecated. Cross-boundary nested LLM calls introduced unpredictable latency, token-billing ambiguity, and prompt-injection risks. Servers that need LLM reasoning now call model providers directly.
Upgrading rollback_deployment with Elicitation
In our previous post, prepare_deployment_rollback didn't actually pause to ask the user; it simply returned a prompt message instructing the model to ask for confirmation in chat before calling rollback_deployment. That guardrail lived purely in prompt text: the model could ignore it, or a client could bypass the prompt and invoke rollback_deployment directly via tools/call.
By moving the approval check inside the rollback_deployment handler with inputRequired (and acceptedContent), the server itself enforces confirmation regardless of which prompt or agent invoked the tool:
1. The Tool Handler (rollback_deployment)
import { acceptedContent, inputRequired, inputResponse, McpServer } from "@modelcontextprotocol/server";
import * as z from "zod/v4";
const approvalKey = "rollbackApproval";
const approvalSchema = z.object({
confirmRollback: z.boolean().describe("Explicitly approve this rollback"),
});
export function registerRollbackDeploymentTool(server: McpServer): void {
server.registerTool(
"rollback_deployment",
{
title: "Rollback Deployment",
description:
"Request interactive approval for a deployment rollback. This starter tool does not execute a rollback.",
inputSchema: z.object({
serviceName: z.string().trim().min(3).describe("Name of the service to roll back"),
sha: z.string().trim().min(7).describe("Commit SHA to roll back to"),
reason: z.string().trim().min(10).describe("Reason for the rollback"),
}),
},
async ({ serviceName, sha, reason }, ctx) => {
const approvalResponse = inputResponse(ctx.mcpReq.inputResponses, approvalKey);
if (approvalResponse.kind === "elicit" && approvalResponse.action !== "accept") {
const status = approvalResponse.action === "decline" ? "declined" : "cancelled";
const message = `Rollback for ${serviceName} was ${status} by the user. No deployment action was taken.`;
return {
structuredContent: { status, serviceName, sha, reason, message },
content: [{ type: "text" as const, text: message }],
};
}
const approval = acceptedContent(ctx.mcpReq.inputResponses, approvalKey, approvalSchema);
if (!approval) {
return inputRequired({
inputRequests: {
[approvalKey]: inputRequired.elicit({
message: `Confirm the rollback of "${serviceName}" to commit ${sha}?`,
requestedSchema: approvalSchema,
}),
},
});
}
const status = approval.confirmRollback ? "validated" : "declined";
const message = approval.confirmRollback
? `Rollback request validated for ${serviceName} -> ${sha}, but no deployment action was taken. Connect a deployment provider to execute rollbacks.`
: `Rollback for ${serviceName} was declined by the user. No deployment action was taken.`;
console.error("rollback_deployment approval completed; no deployment action taken");
return {
structuredContent: { status, serviceName, sha, reason, message },
content: [{ type: "text" as const, text: message }],
};
},
);
}
2. The Updated Prompt (prepare_deployment_rollback)
With the tool itself enforcing interactive approval, prepare_deployment_rollback becomes simpler and cleaner—it attaches the service status and runbook resources, then instructs the model to call rollback_deployment directly to trigger the user confirmation dialog:
server.registerPrompt(
"prepare_deployment_rollback",
{
title: "Prepare Deployment Rollback",
description: "Review the runbook and service status before requesting rollback approval.",
argsSchema: z.object({
serviceName: z.string().trim().min(1).describe("Service to roll back"),
sha: z.string().trim().min(7).describe("Target commit SHA"),
reason: z.string().trim().min(10).describe("Reason for the rollback"),
}),
},
({ serviceName, sha, reason }) => {
const encodedServiceName = encodeURIComponent(serviceName);
return {
messages: [
{
role: "user" as const,
content: {
type: "text" as const,
text:
`Review the linked status and rollback runbook for ${serviceName}.
Summarize the current status and the requested target (${sha}) and reason (${reason}).
Call rollback_deployment with exactly serviceName="${serviceName}", sha="${sha}", and reason="${reason}" to request explicit approval from the user.
The tool is a demo scaffold: it validates approval but does not execute a deployment change. Make that limitation clear.`,
},
},
{
role: "user" as const,
content: {
type: "resource_link" as const,
uri: `devops://services/${encodedServiceName}/status`,
name: `${serviceName} status`,
title: "Service Status",
description: "A fictional status record for the selected service.",
mimeType: "application/json",
},
},
{
role: "user" as const,
content: {
type: "resource_link" as const,
uri: "devops://runbooks/rollback",
name: "rollback-runbook",
title: "Rollback Runbook",
description: "A fictional, read-only rollback checklist.",
mimeType: "text/markdown",
},
},
],
};
},
);
How the Stateless Round-Trip Works
Because the 2026-07-28 runtime constructs a fresh McpServer per HTTP request rather than holding open stateful sockets, elicitation runs as an idempotent two-pass flow:
-
First Pass (
ctx.mcpReq.inputResponsesis empty):acceptedContent(...)returnsundefined, so the handler returnsinputRequired({ inputRequests: { rollbackApproval: inputRequired.elicit(...) } }). -
Host UI & Replay: The host renders a confirmation prompt for
approvalSchema(confirmRollback: boolean) and replays thetools/callrequest with the user's answer attached underctx.mcpReq.inputResponses. -
Second Pass (Evaluation):
-
inputResponse(ctx.mcpReq.inputResponses, "rollbackApproval")checks if the user dismissed (cancel) or rejected (decline) the dialog before validating payload data. -
acceptedContent(..., "rollbackApproval", approvalSchema)parses and validates the accepted payload against our Zod schema. - Only when
approval.confirmRollbackistruedoes the tool returnstatus: "validated". Notice also theconsole.error(...)diagnostic log—keeping operational logs onstderrrather than deprecated protocol logging notifications.
-
Design Takeaways
-
Enforce safety in the server, not the prompt: Prompts assemble context (
resource_links and runbooks), while Elicitation (inputRequired+acceptedContent) puts a deterministic approval gate inside the tool handler itself. -
Write tool handlers for stateless replay: Under
2026-07-28Multi Round-Trip Requests, your tool handler runs once to emitinputRequiredand again whenctx.mcpReq.inputResponsesarrives—keep everything before theinputRequiredreturn side-effect-free. -
Design for statelessness: Avoid building new integrations around
rootsorsampling. Pass workspace paths explicitly via toolinputSchema, and keep LLM orchestration inside your host or server-side SDKs.
Top comments (0)