langchain-mcp-tools 0.1.7__tar.gz → 0.1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: langchain-mcp-tools
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Model Context Protocol (MCP) To LangChain Tools Conversion Utility
5
5
  Project-URL: Bug Tracker, https://github.com/hideya/langchain-mcp-tools-py/issues
6
6
  Project-URL: Source Code, https://github.com/hideya/langchain-mcp-tools-py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "langchain-mcp-tools"
3
- version = "0.1.7"
3
+ version = "0.1.8"
4
4
  description = "Model Context Protocol (MCP) To LangChain Tools Conversion Utility"
5
5
  keywords = [
6
6
  "modelcontextprotocol",
@@ -35,6 +35,17 @@ except ImportError as e:
35
35
  sys.exit(1)
36
36
 
37
37
 
38
+ def fix_schema(schema: dict) -> dict:
39
+ """Converts JSON Schema 'type': ['string', 'null'] to 'anyOf' format"""
40
+ if isinstance(schema, dict):
41
+ if 'type' in schema and isinstance(schema['type'], list):
42
+ schema['anyOf'] = [{'type': t} for t in schema['type']]
43
+ del schema['type'] # Remove 'type' and standardize to 'anyOf'
44
+ for key, value in schema.items():
45
+ schema[key] = fix_schema(value) # Apply recursively
46
+ return schema
47
+
48
+
38
49
  # Type alias for the bidirectional communication channels with the MCP server
39
50
  # FIXME: not defined in mcp.types, really?
40
51
  StdioTransport: TypeAlias = tuple[
@@ -151,7 +162,7 @@ async def get_mcp_server_tools(
151
162
  description: str = tool.description or ''
152
163
  # Convert JSON schema to Pydantic model for argument validation
153
164
  args_schema: Type[BaseModel] = jsonschema_to_pydantic(
154
- tool.inputSchema
165
+ fix_schema(tool.inputSchema) # Apply schema conversion
155
166
  )
156
167
  session: Optional[ClientSession] = None
157
168
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: langchain-mcp-tools
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Model Context Protocol (MCP) To LangChain Tools Conversion Utility
5
5
  Project-URL: Bug Tracker, https://github.com/hideya/langchain-mcp-tools-py/issues
6
6
  Project-URL: Source Code, https://github.com/hideya/langchain-mcp-tools-py