Skip to content

Commit 3ebc112

Browse files
committed
add outputs to mcp server examples
1 parent d1316b4 commit 3ebc112

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

units/en/unit1/mcp-clients.mdx

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,18 @@ with ToolCollection.from_mcp(
236236

237237
```
238238

239+
<details>
240+
<summary>
241+
Output
242+
</summary>
243+
244+
```sh
245+
Weather API: Get the weather in a specific location
246+
247+
```
248+
249+
</details>
250+
239251
We can also connect to an MCP server that is hosted on a remote machine. In this case, we need to pass the `SSEServerParameters` to the `ToolCollection.from_mcp` method.
240252

241253
```python
@@ -248,6 +260,20 @@ with MCPClient(
248260
print("\n".join(f"{t.name}: {t.description}" for t in tools))
249261
```
250262

263+
<details>
264+
<summary>
265+
Output
266+
</summary>
267+
268+
```sh
269+
prime_factors: Compute the prime factorization of a positive integer.
270+
generate_cheetah_image: Generate a cheetah image.
271+
image_orientation: Returns whether image is portrait or landscape.
272+
sepia: Apply a sepia filter to the input image.
273+
```
274+
275+
</details>
276+
251277
Now, let's see how we can use the MCP Client in a code agent.
252278

253279
```python
@@ -267,6 +293,17 @@ with ToolCollection.from_mcp(
267293

268294
```
269295

296+
<details>
297+
<summary>
298+
Output
299+
</summary>
300+
301+
```sh
302+
The weather in Tokyo is sunny with a temperature of 20 degrees Celsius.
303+
```
304+
305+
</details>
306+
270307
We can also connect to an MCP packages. Here's an example of connecting to the `pubmedmcp` package.
271308

272309
```python
@@ -281,9 +318,20 @@ server_parameters = StdioServerParameters(
281318

282319
with ToolCollection.from_mcp(server_parameters, trust_remote_code=True) as tool_collection:
283320
agent = CodeAgent(tools=[*tool_collection.tools], add_base_tools=True)
284-
agent.run("Please find a remedy for hangover.")u
321+
agent.run("Please find a remedy for hangover.")
285322
```
286323

324+
<details>
325+
<summary>
326+
Output
327+
</summary>
328+
329+
```sh
330+
The remedy for hangover is to drink water.
331+
```
332+
333+
</details>
334+
287335
## Next Steps
288336

289337
Now that you understand MCP Clients, you're ready to:

0 commit comments

Comments
 (0)