* url elicitation * single tool for normal and error path * Address review feedback on URL elicitation tool - Remove src/everything/pnpm-lock.yaml (monorepo uses npm workspaces) - Drop redundant TriggerUrlElicitationSchema.parse(args) in the handler; destructure directly from args like the other tools, since the SDK validates against the registered schema before invoking the handler - Add explicit accept/decline/cancel messaging in the request path, mirroring trigger-elicitation-request.ts - Clarify the registerTool count comment in registrations.test.ts (task-based tools register via registerToolTask, counted separately) - Add tests covering the no-url / undefined-capability registration guards, the randomUUID() elicitationId fallback, and the decline/cancel response paths (100% coverage of the tool) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Add tool annotations to trigger-url-elicitation Match the annotations block on sibling elicitation tools and the CLAUDE.md guidance. Uses openWorldHint: true since the tool drives an external browser flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(everything): prevent URL elicitation error-path infinite loop The trigger-url-elicitation tool's error path (errorPath=true) threw UrlElicitationRequiredError (-32042) carrying the same URL that failed and re-threw it on every retry, so clients looped (and tripped their own loop detection). - Point the prerequisite elicitation at a different URL (https://modelcontextprotocol.io) than the failing request. - Track issued prerequisites by the inputs a client resends on retry (session + url + caller-supplied elicitationId); a plain retry is then recognized, ignores errorPath, and proceeds via the request path instead of re-throwing the prerequisite. - Update tests and docs accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(everything): address review on URL elicitation error path - Replace raw NUL byte delimiters in errorPathKey with the \u0000 escape sequence so the source stays plain text and the diff is reviewable (same collision-proof delimiter at runtime). - Add a one-shot test reset helper + beforeEach so the suite is robust to the module-level marker state regardless of order. - Use a dedicated prerequisite message instead of reusing the caller's. - Document the unbounded-growth tradeoff as a demo simplification and note the one-shot marker semantics in docs/features.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: evalstate <1936278+evalstate@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9.7 KiB
Everything Server - Features
Architecture | Project Structure | Startup Process | Server Features | Extension Points | How It Works
Tools
echo(tools/echo.ts): Echoes the providedmessage: string. Uses Zod to validate inputs.get-annotated-message(tools/get-annotated-message.ts): Returns atextmessage annotated withpriorityandaudiencebased onmessageType(error,success, ordebug); can optionally include an annotatedimage.get-env(tools/get-env.ts): Returns all environment variables from the running process as pretty-printed JSON text.get-resource-links(tools/get-resource-links.ts): Returns an introtextblock followed by multipleresource_linkitems. For a requestedcount(1–10), alternates between dynamic Text and Blob resources using URIs fromresources/templates.ts.get-resource-reference(tools/get-resource-reference.ts): AcceptsresourceType(textorblob) andresourceId(positive integer). Returns a concreteresourcecontent block (with itsuri,mimeType, and data) with surrounding explanatorytext.get-roots-list(tools/get-roots-list.ts): Returns the last list of roots sent by the client.gzip-file-as-resource(tools/gzip-file-as-resource.ts): Accepts anameanddata(URL or data URI), fetches the data subject to size/time/domain constraints, compresses it, registers it as a session resource atdemo://resource/session/<name>withmimeType: application/gzip, and returns either aresource_link(default) or an inlineresourcedepending onoutputType.get-structured-content(tools/get-structured-content.ts): Demonstrates structured responses. Acceptslocationinput and returns both backward‑compatiblecontent(atextblock containing JSON) andstructuredContentvalidated by anoutputSchema(temperature, conditions, humidity).get-sum(tools/get-sum.ts): For two numbersaandbcalculates and returns their sum. Uses Zod to validate inputs.get-tiny-image(tools/get-tiny-image.ts): Returns a tiny PNG MCP logo as animagecontent item with brief descriptive text before and after.trigger-long-running-operation(tools/trigger-long-running-operation.ts): Simulates a multi-step operation over a givendurationand number ofsteps; reports progress vianotifications/progresswhen aprogressTokenis provided by the client.toggle-simulated-logging(tools/toggle-simulated-logging.ts): Starts or stops simulated, random‑leveled logging for the invoking session. Respects the client’s selected minimum logging level.toggle-subscriber-updates(tools/toggle-subscriber-updates.ts): Starts or stops simulated resource update notifications for URIs the invoking session has subscribed to.trigger-elicitation-request(tools/trigger-elicitation-request.ts): Issues anelicitation/createrequest using form-mode fields (strings, numbers, booleans, enums, and format validation) and returns the resulting action/content.trigger-url-elicitation(tools/trigger-url-elicitation.ts): Issues anelicitation/createrequest in URL mode (mode: "url") with anelicitationId, or throws MCP error-32042(UrlElicitationRequiredError) whenerrorPath=true. On the error path the prerequisite elicitation it returns points at a different URL than the failing request (https://modelcontextprotocol.io); when the client satisfies it and retries the same call, the retry ignoreserrorPathand proceeds via the request path, so the client does not loop on the same error. The retry marker is one-shot per(session, url, elicitationId): it is cleared on the recognized retry, so re-running the error path with identical arguments without an intervening prerequisite is treated as a retry and proceeds. Requires client capabilityelicitation.url.trigger-sampling-request(tools/trigger-sampling-request.ts): Issues asampling/createMessagerequest to the client/LLM using providedpromptand optional generation controls; returns the LLM's response payload.simulate-research-query(tools/simulate-research-query.ts): Demonstrates MCP Tasks (SEP-1686) with a simulated multi-stage research operation. Acceptstopicandambiguousparameters. Returns a task that progresses through stages with status updates. Ifambiguousis true and client supports elicitation, sends an elicitation request directly to gather clarification before completing.trigger-sampling-request-async(tools/trigger-sampling-request-async.ts): Demonstrates bidirectional tasks where the server sends a sampling request that the client executes as a background task. Server polls for status and retrieves the LLM result when complete. Requires client to supporttasks.requests.sampling.createMessage.trigger-elicitation-request-async(tools/trigger-elicitation-request-async.ts): Demonstrates bidirectional tasks where the server sends an elicitation request that the client executes as a background task. Server polls while waiting for user input. Requires client to supporttasks.requests.elicitation.create.
Prompts
simple-prompt(prompts/simple.ts): No-argument prompt that returns a static user message.args-prompt(prompts/args.ts): Two-argument prompt withcity(required) andstate(optional) used to compose a question.completable-prompt(prompts/completions.ts): Demonstrates argument auto-completions with the SDK’scompletablehelper;departmentcompletions drive context-awarenamesuggestions.resource-prompt(prompts/resource.ts): AcceptsresourceType("Text" or "Blob") andresourceId(string convertible to integer) and returns messages that include an embedded dynamic resource of the selected type generated viaresources/templates.ts.
Resources
- Dynamic Text:
demo://resource/dynamic/text/{index}(content generated on the fly) - Dynamic Blob:
demo://resource/dynamic/blob/{index}(base64 payload generated on the fly) - Static Documents:
demo://resource/static/document/<filename>(serves files fromsrc/everything/docs/as static file-based resources) - Session Scoped:
demo://resource/session/<name>(per-session resources registered dynamically; available only for the lifetime of the session)
Resource Subscriptions and Notifications
- Simulated update notifications are opt‑in and off by default.
- Clients may subscribe/unsubscribe to resource URIs using the MCP
resources/subscribeandresources/unsubscriberequests. - Use the
toggle-subscriber-updatestool to start/stop a per‑session interval that emitsnotifications/resources/updated { uri }only for URIs that session has subscribed to. - Multiple concurrent clients are supported; each client’s subscriptions are tracked per session and notifications are delivered independently via the server instance associated with that session.
Simulated Logging
- Simulated logging is available but off by default.
- Use the
toggle-simulated-loggingtool to start/stop periodic log messages of varying levels (debug, info, notice, warning, error, critical, alert, emergency) per session. - Clients can control the minimum level they receive via the standard MCP
logging/setLevelrequest.
Tasks (SEP-1686)
The server advertises support for MCP Tasks, enabling long-running operations with status tracking:
- Capabilities advertised:
tasks.list,tasks.cancel,tasks.requests.tools.call - Task Store: Uses
InMemoryTaskStorefrom SDK experimental for task lifecycle management - Message Queue: Uses
InMemoryTaskMessageQueuefor task-related messaging
Task Lifecycle
- Client calls
tools/callwithtask: trueparameter - Server returns
CreateTaskResultwithtaskIdinstead of immediate result - Client polls
tasks/getto check status and receivestatusMessageupdates - When status is
completed, client callstasks/resultto retrieve the final result
Task Statuses
working: Task is actively processinginput_required: Task needs additional input (server sends elicitation request directly)completed: Task finished successfullyfailed: Task encountered an errorcancelled: Task was cancelled by client
Demo Tools
Server-side tasks (client calls server):
Use the simulate-research-query tool to exercise the full task lifecycle. Set ambiguous: true to trigger elicitation - the server will send an elicitation/create request directly and await the response before completing.
Client-side tasks (server calls client):
Use trigger-sampling-request-async or trigger-elicitation-request-async to demonstrate bidirectional tasks where the server sends requests that the client executes as background tasks. These require the client to advertise tasks.requests.sampling.createMessage or tasks.requests.elicitation.create capabilities respectively.
Bidirectional Task Flow
MCP Tasks are bidirectional - both server and client can be task executors:
| Direction | Request Type | Task Executor | Demo Tool |
|---|---|---|---|
| Client -> Server | tools/call |
Server | simulate-research-query |
| Server -> Client | sampling/createMessage |
Client | trigger-sampling-request-async |
| Server -> Client | elicitation/create |
Client | trigger-elicitation-request-async |
For client-side tasks:
- Server sends request with task metadata (e.g.,
params.task.ttl) - Client creates task and returns
CreateTaskResultwithtaskId - Server polls
tasks/getfor status updates - When complete, server calls
tasks/resultto retrieve the result