mcp — the model context protocol8 / 9
servers, tools, and the protocol — how ai agents plug into your stack
Build the client side of a tools/call. Write call_tool(name, arguments)
that:
- Builds a request dict
{"name": name, "arguments": arguments}. - Passes it to the provided
fake_server(request)(a stand-in for an MCP server). - Reads the response. If
isErroris True, return the string"error". Otherwise return the text atresponse["content"][0]["text"].
Then call call_tool("greet", {"name": "alex"}) and print the result.
Expected output:
hello alex
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _