TaskRequests

Builder for the nested tasks.requests capability object (spec 2025-11-25).

The spec structures tasks.requests by request category with presence-only sub-objects rather than flat slash-delimited method names. For example, a server advertises task-augmented tools/call as {"tools": {"call": {}}} (capability key tasks.requests.tools.call), and a client advertises task-augmented sampling/createMessage and elicitation/create as {"sampling": {"createMessage": {}}, "elicitation": {"create": {}}}.

Chain the convenience methods (or add) and call toJson to obtain the object to assign to TasksCapability.requests:

TasksCapability t;
t.requests = TaskRequests().tool().toJson();        // server
t.requests = TaskRequests()
    .samplingCreateMessage()
    .elicitationCreate()
    .toJson();                                       // client

Members

Functions

add
TaskRequests add(string category, string operation)

Mark category.operation (e.g. tools.call) as task-augmentable.

elicitationCreate
TaskRequests elicitationCreate()

Client: task-augmented elicitation/create (tasks.requests.elicitation.create).

samplingCreateMessage
TaskRequests samplingCreateMessage()

Client: task-augmented sampling/createMessage (tasks.requests.sampling.createMessage).

toJson
Json toJson()

The accumulated nested requests object. Returns an empty object when nothing was added.

tool
TaskRequests tool()

Server: task-augmented tools/call (tasks.requests.tools.call).