File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,8 @@ async def fetch_weather(city: str) -> str:
241241Prompts are reusable templates that help LLMs interact with your server effectively:
242242
243243``` python
244- from mcp.server.fastmcp import FastMCP, types
244+ from mcp.server.fastmcp import FastMCP
245+ from mcp.server.fastmcp.prompts import base
245246
246247mcp = FastMCP(" My App" )
247248
@@ -252,11 +253,11 @@ def review_code(code: str) -> str:
252253
253254
254255@mcp.prompt ()
255- def debug_error (error : str ) -> list[types .Message]:
256+ def debug_error (error : str ) -> list[base .Message]:
256257 return [
257- types .UserMessage(" I'm seeing this error:" ),
258- types .UserMessage(error),
259- types .AssistantMessage(" I'll help debug that. What have you tried so far?" ),
258+ base .UserMessage(" I'm seeing this error:" ),
259+ base .UserMessage(error),
260+ base .AssistantMessage(" I'll help debug that. What have you tried so far?" ),
260261 ]
261262```
262263
Original file line number Diff line number Diff line change 11import os
22import sys
33from contextlib import asynccontextmanager
4+ from pathlib import Path
45from typing import Literal
56
67import anyio
@@ -66,6 +67,9 @@ class StdioServerParameters(BaseModel):
6667 If not specified, the result of get_default_environment() will be used.
6768 """
6869
70+ cwd : str | Path | None = None
71+ """The working directory to use when spawning the process."""
72+
6973 encoding : str = "utf-8"
7074 """
7175 The text encoding used when sending/receiving messages to the server
@@ -101,6 +105,7 @@ async def stdio_client(server: StdioServerParameters):
101105 [server .command , * server .args ],
102106 env = server .env if server .env is not None else get_default_environment (),
103107 stderr = sys .stderr ,
108+ cwd = server .cwd ,
104109 )
105110
106111 async def stdout_reader ():
You can’t perform that action at this time.
0 commit comments