Add pyright strict mode on the whole project (#1254)

This commit is contained in:
Marcelo Trylesinski 2025-08-11 19:56:37 +02:00 • committed by GitHub
commit c7671e470c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
import contextlib
import logging
from collections.abc import AsyncIterator
from typing import Any
import anyio
import click
@ -41,7 +42,7 @@ def main(
app = Server("mcp-streamable-http-stateless-demo")
@app.call_tool()
async def call_tool(name: str, arguments: dict) -> list[types.ContentBlock]:
async def call_tool(name: str, arguments: dict[str, Any]) -> list[types.ContentBlock]:
ctx = app.request_context
interval = arguments.get("interval", 1.0)
count = arguments.get("count", 5)
@ -61,10 +62,7 @@ def main(
return [
types.TextContent(
type="text",
text=(
f"Sent {count} notifications with {interval}s interval"
f" for caller: {caller}"
),
text=(f"Sent {count} notifications with {interval}s interval for caller: {caller}"),
)
]
@ -73,10 +71,7 @@ def main(
return [
types.Tool(
name="start-notification-stream",
description=(
"Sends a stream of notifications with configurable count"
" and interval"
),
description=("Sends a stream of notifications with configurable count and interval"),
inputSchema={
"type": "object",
"required": ["interval", "count", "caller"],
@ -91,9 +86,7 @@ def main(
},
"caller": {
"type": "string",
"description": (
"Identifier of the caller to include in notifications"
),
"description": ("Identifier of the caller to include in notifications"),
},
},
},
@ -108,9 +101,7 @@ def main(
stateless=True,
)
async def handle_streamable_http(
scope: Scope, receive: Receive, send: Send
) -> None:
async def handle_streamable_http(scope: Scope, receive: Receive, send: Send) -> None:
await session_manager.handle_request(scope, receive, send)
@contextlib.asynccontextmanager