mbxai 1.5.0__py3-none-any.whl → 1.6.0__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.
mbxai/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
2
  MBX AI package.
3
3
  """
4
4
 
5
- __version__ = "1.5.0"
5
+ __version__ = "1.6.0"
mbxai/mcp/server.py CHANGED
@@ -31,7 +31,7 @@ class MCPServer:
31
31
  self.app = FastAPI(
32
32
  title=self.name,
33
33
  description=self.description,
34
- version="1.5.0",
34
+ version="1.6.0",
35
35
  )
36
36
 
37
37
  # Initialize MCP server
mbxai/tools/types.py CHANGED
@@ -18,7 +18,7 @@ def _resolve_ref(schema: dict[str, Any], ref: str, root_schema: dict[str, Any])
18
18
  root_schema: The root schema containing $defs
19
19
 
20
20
  Returns:
21
- The resolved schema definition
21
+ The resolved schema definition with all nested $refs also resolved
22
22
  """
23
23
  if ref.startswith("#/"):
24
24
  # Remove the "#/" prefix and split the path
@@ -33,7 +33,11 @@ def _resolve_ref(schema: dict[str, Any], ref: str, root_schema: dict[str, Any])
33
33
  logger.warning(f"Could not resolve $ref: {ref}")
34
34
  return {"type": "object", "additionalProperties": False}
35
35
 
36
- return current if isinstance(current, dict) else {"type": "object", "additionalProperties": False}
36
+ if isinstance(current, dict):
37
+ # Recursively process the resolved schema to handle nested $refs
38
+ return _convert_property_to_strict(current, root_schema)
39
+ else:
40
+ return {"type": "object", "additionalProperties": False}
37
41
  else:
38
42
  logger.warning(f"Unsupported $ref format: {ref}")
39
43
  return {"type": "object", "additionalProperties": False}
@@ -46,12 +50,32 @@ def _convert_property_to_strict(prop: dict[str, Any], root_schema: dict[str, Any
46
50
  root_schema: The root schema containing $defs
47
51
 
48
52
  Returns:
49
- A strict format property definition
53
+ A strict format property definition with all $refs resolved
50
54
  """
51
- # Handle $ref resolution
55
+ # Handle $ref resolution first - this may return a completely different schema
52
56
  if "$ref" in prop:
53
- resolved = _resolve_ref(prop, prop["$ref"], root_schema)
54
- return _convert_property_to_strict(resolved, root_schema)
57
+ # Get the referenced schema path
58
+ ref = prop["$ref"]
59
+ if ref.startswith("#/"):
60
+ path_parts = ref[2:].split("/")
61
+ current = root_schema
62
+
63
+ # Navigate through the path to get the referenced schema
64
+ for part in path_parts:
65
+ if isinstance(current, dict) and part in current:
66
+ current = current[part]
67
+ else:
68
+ logger.warning(f"Could not resolve $ref: {ref}")
69
+ return {"type": "object", "additionalProperties": False}
70
+
71
+ if isinstance(current, dict):
72
+ # Recursively process the resolved schema
73
+ return _convert_property_to_strict(current, root_schema)
74
+ else:
75
+ return {"type": "object", "additionalProperties": False}
76
+ else:
77
+ logger.warning(f"Unsupported $ref format: {ref}")
78
+ return {"type": "object", "additionalProperties": False}
55
79
 
56
80
  # Get the property type, defaulting to string
57
81
  prop_type = prop.get("type", "string")
@@ -69,7 +93,7 @@ def _convert_property_to_strict(prop: dict[str, Any], root_schema: dict[str, Any
69
93
  new_prop["properties"] = {}
70
94
  new_prop["required"] = []
71
95
 
72
- # Process nested properties
96
+ # Process nested properties recursively
73
97
  if "properties" in prop:
74
98
  for nested_name, nested_prop in prop["properties"].items():
75
99
  new_prop["properties"][nested_name] = _convert_property_to_strict(nested_prop, root_schema)
@@ -81,6 +105,7 @@ def _convert_property_to_strict(prop: dict[str, Any], root_schema: dict[str, Any
81
105
  elif prop_type == "array":
82
106
  # Arrays must have items definition
83
107
  if "items" in prop:
108
+ # Recursively process items schema (this could also have $refs)
84
109
  new_prop["items"] = _convert_property_to_strict(prop["items"], root_schema)
85
110
  else:
86
111
  # Default items schema if missing
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mbxai
3
- Version: 1.5.0
3
+ Version: 1.6.0
4
4
  Summary: MBX AI SDK
5
5
  Project-URL: Homepage, https://www.mibexx.de
6
6
  Project-URL: Documentation, https://www.mibexx.de
@@ -1,4 +1,4 @@
1
- mbxai/__init__.py,sha256=mTVWACpiOVn0-b8RkDKds5fidOixUuIoeSMF4yk9_ug,47
1
+ mbxai/__init__.py,sha256=k9FHAi4YDTkuiAHKU5ktijzvf4s2I3EFN1s7jqJPA0o,47
2
2
  mbxai/core.py,sha256=WMvmU9TTa7M_m-qWsUew4xH8Ul6xseCZ2iBCXJTW-Bs,196
3
3
  mbxai/examples/openrouter_example.py,sha256=-grXHKMmFLoh-yUIEMc31n8Gg1S7uSazBWCIOWxgbyQ,1317
4
4
  mbxai/examples/parse_example.py,sha256=eCKMJoOl6qwo8sDP6Trc6ncgjPlgTqi5tPE2kB5_P0k,3821
@@ -12,7 +12,7 @@ mbxai/examples/mcp/mcp_server_example.py,sha256=nFfg22Jnc6HMW_ezLO3So1xwDdx2_rIt
12
12
  mbxai/mcp/__init__.py,sha256=_ek9iYdYqW5saKetj4qDci11jxesQDiHPJRpHMKkxgU,175
13
13
  mbxai/mcp/client.py,sha256=QRzId6o4_WRWVv3rtm8cfZZGaoY_UlaOO-oqNjY-tmw,5219
14
14
  mbxai/mcp/example.py,sha256=oaol7AvvZnX86JWNz64KvPjab5gg1VjVN3G8eFSzuaE,2350
15
- mbxai/mcp/server.py,sha256=-dzINI4cqzGuGyenXK1Jm9Tq5KS1l59x36Pe0KYgWVc,3332
15
+ mbxai/mcp/server.py,sha256=tSc05RxhXpRdXSpu-noJmK0V48uru0v1JpcUr0P5fmA,3332
16
16
  mbxai/openrouter/__init__.py,sha256=Ito9Qp_B6q-RLGAQcYyTJVWwR2YAZvNqE-HIYXxhtD8,298
17
17
  mbxai/openrouter/client.py,sha256=3LD6WDJ8wjo_nefH5d1NJCsrWPvBc_KBf2NsItUoSt8,18302
18
18
  mbxai/openrouter/config.py,sha256=Ia93s-auim9Sq71eunVDbn9ET5xX2zusXpV4JBdHAzs,3251
@@ -21,8 +21,8 @@ mbxai/openrouter/schema.py,sha256=H_77ZrA9zmbX155bWpCJj1jehUyJPS0QybEW1IVAoe0,54
21
21
  mbxai/tools/__init__.py,sha256=ogxrHvgJ7OR62Lmd5x9Eh5d2C0jqWyQis7Zy3yKpZ78,218
22
22
  mbxai/tools/client.py,sha256=j6yB2hYxvWbaQ5SqN1Fs_YFdPtwettdcMoXcdeV-520,14930
23
23
  mbxai/tools/example.py,sha256=1HgKK39zzUuwFbnp3f0ThyWVfA_8P28PZcTwaUw5K78,2232
24
- mbxai/tools/types.py,sha256=AIYaX7onY6eRcCEUjrymtiSYFYXi4hpVXLYbj-i9qqo,8277
25
- mbxai-1.5.0.dist-info/METADATA,sha256=d55xUlW3m4tMaz6Fs2dKIWc4TnGcqfuI0jdWe9GkBOY,4147
26
- mbxai-1.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
- mbxai-1.5.0.dist-info/licenses/LICENSE,sha256=hEyhc4FxwYo3NQ40yNgZ7STqwVk-1_XcTXOnAPbGJAw,1069
28
- mbxai-1.5.0.dist-info/RECORD,,
24
+ mbxai/tools/types.py,sha256=OFfM7scDGTm4FOcJA2ecj-fxL1MEBkqPsT3hqCL1Jto,9505
25
+ mbxai-1.6.0.dist-info/METADATA,sha256=8xzN7T2h5j8XyFMaq2CpXi3zMoe7tyM1RvjzYCpJz6U,4147
26
+ mbxai-1.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
+ mbxai-1.6.0.dist-info/licenses/LICENSE,sha256=hEyhc4FxwYo3NQ40yNgZ7STqwVk-1_XcTXOnAPbGJAw,1069
28
+ mbxai-1.6.0.dist-info/RECORD,,
File without changes