Add MCP tool for setting session token

This commit is contained in:
Tim
2025-10-28 01:47:16 +08:00
parent d4b3400c5f
commit 9dadaad5ba

View File

@@ -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.",