Skip to main content

Module elicit

Module elicit 

Source
Expand description

Elicitation → ask_human: letting an MCP server ask the operator.

MCP servers may send the client an elicitation/create request — “I need a value from the person before I can continue”. agentd is unusually well placed to answer one: ask_human already suspends the asker, renders the question as an answerable row in every attached display client, survives a daemon restart, and has a configured fallback for when nobody is watching. Elicitation is that machinery with a different caller.

The wiring problem is where the two live. MCP connections are held by the turn worker child (the supervisor makes no model or MCP calls), while ask_human runs on the supervisor, which owns the tasks and the gates. The child already has a round-trip for exactly this — AgentMsg::ToolRequest out, a reply slot back — and both halves of it are shareable (Arc<Mutex<_>> writer, Arc<Replies>), so the handler runs on the MCP event thread and blocks there rather than on the agent’s own thread. A server waiting on an elicitation therefore does not stall the turn that is talking to it.

What we can honestly promise about the schema. The spec wants the response content to match the server’s requestedSchema. A human answers in prose. So: a reply that parses as a JSON object is passed through; a single-property schema binds the text (coerced to the declared primitive); anything else cannot be guaranteed to conform, and we return cancel rather than hand a server data that violates the contract it asked for.

Structs§

ElicitationBridge
Bridges an MCP server’s elicitation to the supervisor’s ask_human.