mirascope 1.24.1__py3-none-any.whl → 1.24.2__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.
mirascope/mcp/_utils.py CHANGED
@@ -22,6 +22,8 @@ from pydantic import BaseModel, ConfigDict, Field, create_model
22
22
  from ..core import BaseMessageParam, BaseTool
23
23
  from ..core.base import AudioPart, DocumentPart, ImagePart
24
24
 
25
+ _UNSET = object()
26
+
25
27
 
26
28
  def create_tool_call(
27
29
  name: str,
@@ -38,7 +40,8 @@ def create_tool_call(
38
40
  """
39
41
 
40
42
  async def call(self: BaseTool) -> list[str | ImageContent | EmbeddedResource]:
41
- result = await call_tool(name, self.args) # pyright: ignore [reportOptionalCall]
43
+ args = {key: value for key, value in self.args.items() if value is not _UNSET}
44
+ result = await call_tool(name, args if args else None)
42
45
  if result.isError:
43
46
  raise RuntimeError(f"MCP Server returned error: {self._name()}")
44
47
  return [
@@ -225,15 +228,18 @@ def create_tool_from_mcp_tool(tool: MCPTool) -> type[BaseTool]:
225
228
  fields = {}
226
229
  for field_name, field_schema in properties.items():
227
230
  field_type = json_schema_to_python_type(field_schema)
231
+ if field_schema.get("nullable", False):
232
+ field_type = field_type | None
228
233
 
229
- if field_name in required_fields:
230
- default = Field(..., description=field_schema.get("description"))
231
- annotation = field_type
232
- else:
233
- default = Field(None, description=field_schema.get("description"))
234
- annotation = field_type | None
234
+ field_info = {
235
+ "default": field_schema.get(
236
+ "default", ... if field_name in required_fields else _UNSET
237
+ )
238
+ }
239
+ if description := field_schema.get("description", ""):
240
+ field_info["description"] = description
235
241
 
236
- fields[field_name] = (annotation, default)
242
+ fields[field_name] = (field_type, Field(**field_info))
237
243
 
238
244
  return create_model(snake_to_pascal(tool.name), __base__=BaseTool, **fields)
239
245
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mirascope
3
- Version: 1.24.1
3
+ Version: 1.24.2
4
4
  Summary: LLM abstractions that aren't obstructions
5
5
  Project-URL: Homepage, https://mirascope.com
6
6
  Project-URL: Documentation, https://mirascope.com/WELCOME
@@ -344,7 +344,7 @@ mirascope/llm/call_response_chunk.py,sha256=bZwO43ipc6PO1VLgGSaAPRqCIUyZD_Ty5oxd
344
344
  mirascope/llm/stream.py,sha256=GtUKyLBlKqqZTOKjdL9FLInCXJ0ZOEAe6nymbjKwyTQ,5293
345
345
  mirascope/llm/tool.py,sha256=MQRJBPhP1d-OyOz3PE_VsKmSXca0chySyYO1U9OW8ck,1824
346
346
  mirascope/mcp/__init__.py,sha256=1tvG-fRD-_mr2vF3M49OgTLR7Vw8zdT6LucxnY4prF8,282
347
- mirascope/mcp/_utils.py,sha256=jyuE28W9Gy6sF17dRNZnqXRBhD_dmJBxIXq99UWmpHk,9221
347
+ mirascope/mcp/_utils.py,sha256=OYb1nmVTUsm3SI1YEdP80eL0i8-oJ1JUhJIP6RtS6yg,9390
348
348
  mirascope/mcp/client.py,sha256=ZK88o4UelR9htFWAWDbw084ZTrRL8tONdxlIX62adnM,5608
349
349
  mirascope/mcp/server.py,sha256=weXBk9ZmUcfZ5SZcR-dGRxvVXRMpn5UsE6ancnK1HZk,12402
350
350
  mirascope/mcp/tools.py,sha256=IT7CEqbBBiFc7mkaRpWIepUpuy_oSdcEa4cwGopEYWc,3079
@@ -371,7 +371,7 @@ mirascope/v0/base/ops_utils.py,sha256=1Qq-VIwgHBaYutiZsS2MUQ4OgPC3APyywI5bTiTAmA
371
371
  mirascope/v0/base/prompts.py,sha256=FM2Yz98cSnDceYogiwPrp4BALf3_F3d4fIOCGAkd-SE,1298
372
372
  mirascope/v0/base/types.py,sha256=ZfatJoX0Yl0e3jhv0D_MhiSVHLYUeJsdN3um3iE10zY,352
373
373
  mirascope/v0/base/utils.py,sha256=XREPENRQTu8gpMhHU8RC8qH_am3FfGUvY-dJ6x8i-mw,681
374
- mirascope-1.24.1.dist-info/METADATA,sha256=CF6YrOzpQRtxq7M0Pz_cl5d3m2dyjy2rO08z64sEzN8,8542
375
- mirascope-1.24.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
376
- mirascope-1.24.1.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
377
- mirascope-1.24.1.dist-info/RECORD,,
374
+ mirascope-1.24.2.dist-info/METADATA,sha256=Q3ljkU5ZnGDTLtmg_AcFwR3kdGnzDqxFMrB-7xG6ygU,8542
375
+ mirascope-1.24.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
376
+ mirascope-1.24.2.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
377
+ mirascope-1.24.2.dist-info/RECORD,,