docs: fix docstrings across public API surface (#2095)

This commit is contained in:
Jonathan Hefner 2026-02-18 23:45:59 -06:00 • committed by GitHub
commit c0328540c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 177 additions and 163 deletions

View file

@ -33,9 +33,8 @@ class InvalidRedirectUriError(Exception):
class OAuthClientMetadata(BaseModel):
"""RFC 7591 OAuth 2.0 Dynamic Client Registration metadata.
"""RFC 7591 OAuth 2.0 Dynamic Client Registration Metadata.
See https://datatracker.ietf.org/doc/html/rfc7591#section-2
for the full specification.
"""
redirect_uris: list[AnyUrl] | None = Field(..., min_length=1)
@ -145,9 +144,9 @@ class ProtectedResourceMetadata(BaseModel):
resource_documentation: AnyHttpUrl | None = None
resource_policy_uri: AnyHttpUrl | None = None
resource_tos_uri: AnyHttpUrl | None = None
# tls_client_certificate_bound_access_tokens default is False, but ommited here for clarity
# tls_client_certificate_bound_access_tokens default is False, but omitted here for clarity
tls_client_certificate_bound_access_tokens: bool | None = None
authorization_details_types_supported: list[str] | None = None
dpop_signing_alg_values_supported: list[str] | None = None
# dpop_bound_access_tokens_required default is False, but ommited here for clarity
# dpop_bound_access_tokens_required default is False, but omitted here for clarity
dpop_bound_access_tokens_required: bool | None = None

View file

@ -17,7 +17,7 @@ MessageStream = tuple[MemoryObjectReceiveStream[SessionMessage | Exception], Mem
async def create_client_server_memory_streams() -> AsyncGenerator[tuple[MessageStream, MessageStream], None]:
"""Creates a pair of bidirectional memory streams for client-server communication.
Returns:
Yields:
A tuple of (client_streams, server_streams) where each is a tuple of
(read_stream, write_stream)
"""

View file

@ -1,7 +1,7 @@
"""Utility functions for working with metadata in MCP types.
These utilities are primarily intended for client-side usage to properly display
human-readable names in user interfaces in a spec compliant way.
human-readable names in user interfaces in a spec-compliant way.
"""
from mcp.types import Implementation, Prompt, Resource, ResourceTemplate, Tool

View file

@ -115,6 +115,7 @@ class RequestResponder(Generic[ReceiveRequestT, SendResultT]):
"""Send a response for this request.
Must be called within a context manager block.
Raises:
RuntimeError: If not used within a context manager
AssertionError: If request was already responded to
@ -235,7 +236,7 @@ class BaseSession(
metadata: MessageMetadata = None,
progress_callback: ProgressFnT | None = None,
) -> ReceiveResultT:
"""Sends a request and wait for a response.
"""Sends a request and waits for a response.
Raises an MCPError if the response contains an error. If a request read timeout is provided, it will take
precedence over the session read timeout.
@ -512,4 +513,4 @@ class BaseSession(
async def _handle_incoming(
self, req: RequestResponder[ReceiveRequestT, SendResultT] | ReceiveNotificationT | Exception
) -> None:
"""A generic handler for incoming messages. Overwritten by subclasses."""
"""A generic handler for incoming messages. Overridden by subclasses."""