mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-06 23:21:16 +08:00
Add MCP tool for setting session token
This commit is contained in:
@@ -139,6 +139,25 @@ app = FastMCP(
|
||||
)
|
||||
|
||||
|
||||
@app.tool(
|
||||
name="set_token",
|
||||
description=(
|
||||
"Set JWT token for the current session to be reused by other tools."
|
||||
),
|
||||
)
|
||||
async def set_token(
|
||||
token: Annotated[
|
||||
str,
|
||||
PydanticField(description="JWT token string."),
|
||||
],
|
||||
ctx: Context | None = None,
|
||||
) -> str:
|
||||
"""Persist a JWT token for the active MCP session."""
|
||||
|
||||
session_token_manager.resolve(ctx, token)
|
||||
return "Token stored successfully."
|
||||
|
||||
|
||||
@app.tool(
|
||||
name="search",
|
||||
description="Perform a global search across OpenIsle resources.",
|
||||
|
||||
Reference in New Issue
Block a user