Builds the capabilities object a server advertises to MCP clients.
The base set comes from the server module's __capabilities__/0 when it
defines one (typically generated by ConduitMcp.Endpoint); otherwise it is
the plain tools/resources/prompts set with listChanged: false.
Flags for optional features are then overlaid according to which callbacks the server module exports:
resources.subscribe: true(legacy) —handle_subscribe_resource/2, and only when the base set advertisesresourcesat all.completions: %{}—handle_complete/3.logging: %{}—handle_set_log_level/2(legacy); always on the modern era, where any tool can emitnotifications/messagethroughConduitMcp.Logon a request that sets alogLevel, and the 2026-07-28 spec requires a server that emits them to declarelogging.extensions: %{"io.modelcontextprotocol/tasks" => %{}}— modern era only, whileConduitMcp.Ext.Tasksis enabled.
Used for both the legacy initialize reply and the modern
server/discover result (ConduitMcp.Discover). The two eras differ in
change notifications:
- legacy advertises the base set as is: this library has no
legacy delivery path for list-changed notifications, and
resources.subscribemeans the server implementsresources/subscribe. - modern sets
listChanged: trueon each oftools,promptsandresourcesit advertises, andsubscribe: trueonresources: every modern server answerssubscriptions/listen(ConduitMcp.Subscriptions, always running), whosetoolsListChanged/promptsListChanged/resourcesListChanged/resourceSubscriptionsfilters deliver whatever the server pushes withConduitMcp.notify_tools_changed/0and friends.
The tasks extension is advertised on the modern era only.
Summary
Functions
Returns the capabilities map advertised for server_module.
Functions
Returns the capabilities map advertised for server_module.
Options:
:era—:legacy(default) or:modern; see the moduledoc. Modern may add the tasks extension.
Examples
ConduitMcp.Capabilities.build(MyServer)
#=> %{
# "tools" => %{"listChanged" => false},
# "resources" => %{"listChanged" => false},
# "prompts" => %{"listChanged" => false}
# }
ConduitMcp.Capabilities.build(MyServer, era: :modern)
#=> %{
# "tools" => %{"listChanged" => true},
# "resources" => %{"listChanged" => true, "subscribe" => true},
# "prompts" => %{"listChanged" => true}
# }