mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-19 23:04:25 +01:00
Add instructions field to ServerSession and FastMCP
This commit is contained in:
@@ -86,9 +86,11 @@ class Settings(BaseSettings):
|
||||
|
||||
|
||||
class FastMCP:
|
||||
def __init__(self, name: str | None = None, **settings: Any):
|
||||
def __init__(
|
||||
self, name: str | None = None, instructions: str | None = None, **settings: Any
|
||||
):
|
||||
self.settings = Settings(**settings)
|
||||
self._mcp_server = MCPServer(name=name or "FastMCP")
|
||||
self._mcp_server = MCPServer(name=name or "FastMCP", instructions=instructions)
|
||||
self._tool_manager = ToolManager(
|
||||
warn_on_duplicate_tools=self.settings.warn_on_duplicate_tools
|
||||
)
|
||||
@@ -110,6 +112,10 @@ class FastMCP:
|
||||
def name(self) -> str:
|
||||
return self._mcp_server.name
|
||||
|
||||
@property
|
||||
def instructions(self) -> str | None:
|
||||
return self._mcp_server.instructions
|
||||
|
||||
def run(self, transport: Literal["stdio", "sse"] = "stdio") -> None:
|
||||
"""Run the FastMCP server. Note this is a synchronous function.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user