langchain-mcp-tools 0.1.5__py3-none-any.whl → 0.1.6__py3-none-any.whl

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.
@@ -28,7 +28,7 @@ try:
28
28
  from mcp.client.stdio import stdio_client
29
29
  import mcp.types as mcp_types
30
30
  from pydantic import BaseModel
31
- from pympler import asizeof
31
+ # from pydantic_core import to_json
32
32
  except ImportError as e:
33
33
  print(f'\nError: Required package not found: {e}')
34
34
  print('Please ensure all required packages are installed\n')
@@ -165,8 +165,8 @@ async def get_mcp_server_tools(
165
165
  Asynchronously executes the tool with given arguments.
166
166
  Logs input/output and handles errors.
167
167
  """
168
- logger.info(f'MCP tool "{server_name}"/"{tool.name}"'
169
- f' received input: {kwargs}')
168
+ logger.info(f'MCP tool "{server_name}"/"{tool.name}" '
169
+ f'received input: {kwargs}')
170
170
 
171
171
  try:
172
172
  result = await session.call_tool(self.name, kwargs)
@@ -186,7 +186,12 @@ async def get_mcp_server_tools(
186
186
  for item in result.content
187
187
  if isinstance(item, mcp_types.TextContent)
188
188
  )
189
- result_content_text = result_content_text or ''
189
+ # text_items = [
190
+ # item
191
+ # for item in result.content
192
+ # if isinstance(item, mcp_types.TextContent)
193
+ # ]
194
+ # result_content_text =to_json(text_items).decode()
190
195
 
191
196
  except KeyError as e:
192
197
  result_content_text = (
@@ -194,14 +199,25 @@ async def get_mcp_server_tools(
194
199
  f'contents: {repr(result.content)}'
195
200
  )
196
201
 
197
- # Log result size for monitoring
198
- size = asizeof.asizeof(result_content_text)
202
+ # Log rough result size for monitoring
203
+ size = len(result_content_text.encode())
199
204
  logger.info(f'MCP tool "{server_name}"/"{tool.name}" '
200
205
  f'received result (size: {size})')
201
206
 
207
+ # If no text content, return a clear message
208
+ # describing the situation.
209
+ result_content_text = (
210
+ result_content_text or
211
+ 'No text content available in response'
212
+ )
213
+
202
214
  return result_content_text
203
215
 
204
216
  except Exception as e:
217
+ logger.warn(
218
+ f'MCP tool "{server_name}"/"{tool.name}" '
219
+ f'caused error: {str(e)}'
220
+ )
205
221
  if self.handle_tool_error:
206
222
  return f'Error executing MCP tool: {str(e)}'
207
223
  raise
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: langchain-mcp-tools
3
- Version: 0.1.5
3
+ Version: 0.1.6
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
@@ -16,7 +16,6 @@ Requires-Dist: langchain-openai>=0.3.0
16
16
  Requires-Dist: langgraph>=0.2.62
17
17
  Requires-Dist: mcp>=1.2.0
18
18
  Requires-Dist: pyjson5>=1.6.8
19
- Requires-Dist: pympler>=1.1
20
19
  Requires-Dist: python-dotenv>=1.0.1
21
20
  Provides-Extra: dev
22
21
  Requires-Dist: pytest>=8.3.4; extra == "dev"
@@ -0,0 +1,8 @@
1
+ langchain_mcp_tools/__init__.py,sha256=Xtv2VphhrWB_KlxTIofHZqtCIGtNEl0MxugnrNXTERA,94
2
+ langchain_mcp_tools/langchain_mcp_tools.py,sha256=WY1ckLyIMbRIVhsECEFdAY6DnZB2Q3BLH-Nrb727M-o,11699
3
+ langchain_mcp_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ langchain_mcp_tools-0.1.6.dist-info/LICENSE,sha256=CRC91e8v116gCpnp7h49oIa6_zjhxqnHFTREeoZFJwA,1072
5
+ langchain_mcp_tools-0.1.6.dist-info/METADATA,sha256=yUpYI9tc-JYxN15UzHGTpe9KeQbVT9NhRhUy6MJIqaY,4926
6
+ langchain_mcp_tools-0.1.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ langchain_mcp_tools-0.1.6.dist-info/top_level.txt,sha256=aR_9V2A1Yt-Bca60KmndmGLUWb2wiM5IOG-Gkaf1dxY,20
8
+ langchain_mcp_tools-0.1.6.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- langchain_mcp_tools/__init__.py,sha256=Xtv2VphhrWB_KlxTIofHZqtCIGtNEl0MxugnrNXTERA,94
2
- langchain_mcp_tools/langchain_mcp_tools.py,sha256=UNvQSkj2MPV4aF1HFVLjE5AncXqw6eRLwqMuIQgefoc,10926
3
- langchain_mcp_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- langchain_mcp_tools-0.1.5.dist-info/LICENSE,sha256=CRC91e8v116gCpnp7h49oIa6_zjhxqnHFTREeoZFJwA,1072
5
- langchain_mcp_tools-0.1.5.dist-info/METADATA,sha256=mlv50j7vIG3dtlmwP7qX2giU4G_T-PA5RYBWUitF-80,4954
6
- langchain_mcp_tools-0.1.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- langchain_mcp_tools-0.1.5.dist-info/top_level.txt,sha256=aR_9V2A1Yt-Bca60KmndmGLUWb2wiM5IOG-Gkaf1dxY,20
8
- langchain_mcp_tools-0.1.5.dist-info/RECORD,,