mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-21 05:15:15 +02:00
switch pydantic type annotations to satisfy pyright
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
from typing_extensions import Annotated
|
||||||
from urllib.parse import urlparse, urlunparse
|
from urllib.parse import urlparse, urlunparse
|
||||||
|
|
||||||
import markdownify
|
import markdownify
|
||||||
@@ -17,7 +18,7 @@ from mcp.types import (
|
|||||||
INTERNAL_ERROR,
|
INTERNAL_ERROR,
|
||||||
)
|
)
|
||||||
from protego import Protego
|
from protego import Protego
|
||||||
from pydantic import BaseModel, Field, AnyUrl, conint
|
from pydantic import BaseModel, Field, AnyUrl
|
||||||
|
|
||||||
DEFAULT_USER_AGENT_AUTONOMOUS = "ModelContextProtocol/1.0 (Autonomous; +https://github.com/modelcontextprotocol/servers)"
|
DEFAULT_USER_AGENT_AUTONOMOUS = "ModelContextProtocol/1.0 (Autonomous; +https://github.com/modelcontextprotocol/servers)"
|
||||||
DEFAULT_USER_AGENT_MANUAL = "ModelContextProtocol/1.0 (User-Specified; +https://github.com/modelcontextprotocol/servers)"
|
DEFAULT_USER_AGENT_MANUAL = "ModelContextProtocol/1.0 (User-Specified; +https://github.com/modelcontextprotocol/servers)"
|
||||||
@@ -148,18 +149,31 @@ async def fetch_url(
|
|||||||
class Fetch(BaseModel):
|
class Fetch(BaseModel):
|
||||||
"""Parameters for fetching a URL."""
|
"""Parameters for fetching a URL."""
|
||||||
|
|
||||||
url: AnyUrl = Field(..., description="URL to fetch")
|
url: Annotated[AnyUrl, Field(description="URL to fetch")]
|
||||||
max_length: conint(gt=0, lt=1000000) = Field(
|
max_length: Annotated[
|
||||||
5000, description="Maximum number of characters to return."
|
int,
|
||||||
)
|
Field(
|
||||||
start_index: conint(ge=0) = Field(
|
default=5000,
|
||||||
0,
|
description="Maximum number of characters to return.",
|
||||||
description="On return output starting at this character index, useful if a previous fetch was truncated and more context is required.",
|
gt=0,
|
||||||
)
|
lt=1000000,
|
||||||
raw: bool = Field(
|
),
|
||||||
False,
|
]
|
||||||
description="Get the actual HTML content if the requested page, without simplification.",
|
start_index: Annotated[
|
||||||
)
|
int,
|
||||||
|
Field(
|
||||||
|
default=0,
|
||||||
|
description="On return output starting at this character index, useful if a previous fetch was truncated and more context is required.",
|
||||||
|
ge=0,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
raw: Annotated[
|
||||||
|
bool,
|
||||||
|
Field(
|
||||||
|
default=False,
|
||||||
|
description="Get the actual HTML content if the requested page, without simplification.",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
async def serve(
|
async def serve(
|
||||||
|
|||||||
Reference in New Issue
Block a user