Servers, tools, and the protocol — how AI agents plug into your stack — step 9 of 9
Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final drill. Build a tiny MCP client that lists tools, then calls one by name. Write two functions:
list_tool_names(server)— callsserver({"method": "tools/list"})and returns a list of every tool name it advertises.run_tool(server, name, arguments)— callsserver({"method": "tools/call", "params": {"name": name, "arguments": arguments}})and returns the text atresult["content"][0]["text"], OR returns"error"ifisErroris True.
The script will exercise both. Expected output:
['add', 'echo']
5
hi
error
⌘↵ runs the editor.read, then continue.
Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final drill. Build a tiny MCP client that lists tools, then calls one by name. Write two functions:
list_tool_names(server)— callsserver({"method": "tools/list"})and returns a list of every tool name it advertises.run_tool(server, name, arguments)— callsserver({"method": "tools/call", "params": {"name": name, "arguments": arguments}})and returns the text atresult["content"][0]["text"], OR returns"error"ifisErroris True.
The script will exercise both. Expected output:
['add', 'echo']
5
hi
error
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.