refactor: use __future__.annotations (#1832)
This commit is contained in:
parent
adcc17b968
commit
201de920a0
1 changed files with 17 additions and 37 deletions
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations as _annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from datetime import datetime
|
||||
from typing import Annotated, Any, Final, Generic, Literal, TypeAlias, TypeVar
|
||||
|
|
@ -6,24 +8,6 @@ from pydantic import BaseModel, ConfigDict, Field, FileUrl, RootModel
|
|||
from pydantic.networks import AnyUrl, UrlConstraints
|
||||
from typing_extensions import deprecated
|
||||
|
||||
"""
|
||||
Model Context Protocol bindings for Python
|
||||
|
||||
These bindings were generated from https://github.com/modelcontextprotocol/specification,
|
||||
using Claude, with a prompt something like the following:
|
||||
|
||||
Generate idiomatic Python bindings for this schema for MCP, or the "Model Context
|
||||
Protocol." The schema is defined in TypeScript, but there's also a JSON Schema version
|
||||
for reference.
|
||||
|
||||
* For the bindings, let's use Pydantic V2 models.
|
||||
* Each model should allow extra fields everywhere, by specifying `model_config =
|
||||
ConfigDict(extra='allow')`. Do this in every case, instead of a custom base class.
|
||||
* Union types should be represented with a Pydantic `RootModel`.
|
||||
* Define additional model classes instead of using dictionaries. Do this even if they're
|
||||
not separate types in the schema.
|
||||
"""
|
||||
|
||||
LATEST_PROTOCOL_VERSION = "2025-11-25"
|
||||
|
||||
"""
|
||||
|
|
@ -557,7 +541,7 @@ class Task(BaseModel):
|
|||
"""Current task state."""
|
||||
|
||||
statusMessage: str | None = None
|
||||
"""
|
||||
"""
|
||||
Optional human-readable message describing the current task state.
|
||||
This can provide context for any status, including:
|
||||
- Reasons for "cancelled" status
|
||||
|
|
@ -1121,7 +1105,7 @@ class ToolResultContent(BaseModel):
|
|||
toolUseId: str
|
||||
"""The unique identifier that corresponds to the tool call's id field."""
|
||||
|
||||
content: list["ContentBlock"] = []
|
||||
content: list[ContentBlock] = []
|
||||
"""
|
||||
A list of content objects representing the tool result.
|
||||
Defaults to empty list if not provided.
|
||||
|
|
@ -1523,7 +1507,7 @@ class CreateMessageRequestParams(RequestParams):
|
|||
stopSequences: list[str] | None = None
|
||||
metadata: dict[str, Any] | None = None
|
||||
"""Optional metadata to pass through to the LLM provider."""
|
||||
tools: list["Tool"] | None = None
|
||||
tools: list[Tool] | None = None
|
||||
"""
|
||||
Tool definitions for the LLM to use during sampling.
|
||||
Requires clientCapabilities.sampling.tools to be present.
|
||||
|
|
|
|||
Loading…
Reference in a new issue