Skip to content

Commit

Permalink
mypy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rectalogic committed Jan 4, 2025
1 parent 44f421d commit a9e9d40
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/langchain_mcp/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_tools(self) -> list[BaseTool]:
}


def configure_field(name: str, type_: dict[str, t.Any], required: list[str]) -> t.Tuple[type, t.Any]:
def configure_field(name: str, type_: dict[str, t.Any], required: list[str]) -> tuple[type, t.Any]:
field_type = TYPEMAP[type_["type"]]
default_ = FIELD_DEFAULTS.get(field_type) if name not in required else ...
return field_type, default_
Expand All @@ -90,7 +90,9 @@ def __get_pydantic_json_schema__(
# Since this langchain patch, we need to synthesize pydantic fields from the schema
# https://github.com/langchain-ai/langchain/commit/033ac417609297369eb0525794d8b48a425b8b33
required = schema.get("required", [])
fields = {name: configure_field(name, type_, required) for name, type_ in schema["properties"].items()}
fields: dict[str, t.Any] = {
name: configure_field(name, type_, required) for name, type_ in schema["properties"].items()
}

return pydantic.create_model("Schema", __base__=SchemaBase, **fields)

Expand Down

0 comments on commit a9e9d40

Please sign in to comment.