McpClient¶
Methods¶
call¶
Call the tool named name with args (a table of arguments), returning
{ content = <string>, is_error = <bool> }. A tool that reports failure
comes back with is_error = true rather than raising, so the model sees
it; only a transport or protocol failure raises.
Parameters
name:stringargs:any
Returns
any
close¶
Tear the session down explicitly. Rarely needed, since releasing the handle does the same: the session is cancelled and a stdio child is killed on drop.
connected¶
Whether the session is still live. Turns false once the server exits (a
stdio child dying closes its transport), so a config can gate the
server's tools on it or warn the user to /reload.
Returns
boolean
list_tools¶
The tools the server advertises, each a table shaped for registry:add:
{ name, description, parameters }. parameters is the server's raw JSON
argument schema, named to match the field registry:add expects so a
config can pass it straight through.
Returns
any
Metamethods¶
__tostring¶
Returns
...any