Files
microsoft--mcp-for-beginners/03-GettingStarted/03-llm-client/solution/python/README.md
T
2026-07-13 13:31:35 +08:00

1.2 KiB

Running this sample

You're recommended to install uv but it's not a must, see instructions

-0- Create a virtual environment

python -m venv venv

-1- Activate the virtual environment

venv\Scrips\activate

-2- Install the dependencies

pip install "mcp[cli]"
pip install openai
pip install azure-ai-inference

-3- Run the sample

python client.py

You should see an output similar to:

LISTING RESOURCES
Resource:  ('meta', None)
Resource:  ('nextCursor', None)
Resource:  ('resources', [])
                    INFO     Processing request of type ListToolsRequest                                                                               server.py:534
LISTING TOOLS
Tool:  add
Tool {'a': {'title': 'A', 'type': 'integer'}, 'b': {'title': 'B', 'type': 'integer'}}
CALLING LLM
TOOL:  {'function': {'arguments': '{"a":2,"b":20}', 'name': 'add'}, 'id': 'call_BCbyoCcMgq0jDwR8AuAF9QY3', 'type': 'function'}
[05/08/25 21:04:55] INFO     Processing request of type CallToolRequest                                                                                server.py:534
TOOLS result:  [TextContent(type='text', text='22', annotations=None)]