mcp-mesh 0.7.20__py3-none-any.whl → 0.8.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.
Files changed (124) hide show
  1. _mcp_mesh/__init__.py +1 -1
  2. _mcp_mesh/engine/dependency_injector.py +13 -15
  3. _mcp_mesh/engine/http_wrapper.py +69 -10
  4. _mcp_mesh/engine/mesh_llm_agent.py +29 -10
  5. _mcp_mesh/engine/mesh_llm_agent_injector.py +77 -41
  6. _mcp_mesh/engine/provider_handlers/__init__.py +14 -1
  7. _mcp_mesh/engine/provider_handlers/base_provider_handler.py +114 -8
  8. _mcp_mesh/engine/provider_handlers/claude_handler.py +15 -57
  9. _mcp_mesh/engine/provider_handlers/gemini_handler.py +181 -0
  10. _mcp_mesh/engine/provider_handlers/openai_handler.py +8 -63
  11. _mcp_mesh/engine/provider_handlers/provider_handler_registry.py +16 -10
  12. _mcp_mesh/engine/response_parser.py +61 -15
  13. _mcp_mesh/engine/signature_analyzer.py +58 -68
  14. _mcp_mesh/engine/unified_mcp_proxy.py +19 -35
  15. _mcp_mesh/pipeline/__init__.py +9 -20
  16. _mcp_mesh/pipeline/api_heartbeat/__init__.py +12 -7
  17. _mcp_mesh/pipeline/api_heartbeat/api_lifespan_integration.py +23 -49
  18. _mcp_mesh/pipeline/api_heartbeat/rust_api_heartbeat.py +429 -0
  19. _mcp_mesh/pipeline/api_startup/api_pipeline.py +7 -9
  20. _mcp_mesh/pipeline/api_startup/api_server_setup.py +91 -70
  21. _mcp_mesh/pipeline/api_startup/fastapi_discovery.py +22 -23
  22. _mcp_mesh/pipeline/api_startup/middleware_integration.py +32 -24
  23. _mcp_mesh/pipeline/api_startup/route_collection.py +2 -4
  24. _mcp_mesh/pipeline/mcp_heartbeat/__init__.py +5 -17
  25. _mcp_mesh/pipeline/mcp_heartbeat/rust_heartbeat.py +710 -0
  26. _mcp_mesh/pipeline/mcp_startup/__init__.py +2 -5
  27. _mcp_mesh/pipeline/mcp_startup/configuration.py +1 -1
  28. _mcp_mesh/pipeline/mcp_startup/fastapiserver_setup.py +31 -8
  29. _mcp_mesh/pipeline/mcp_startup/heartbeat_loop.py +6 -7
  30. _mcp_mesh/pipeline/mcp_startup/startup_orchestrator.py +23 -11
  31. _mcp_mesh/pipeline/mcp_startup/startup_pipeline.py +3 -8
  32. _mcp_mesh/pipeline/shared/mesh_pipeline.py +0 -2
  33. _mcp_mesh/reload.py +1 -3
  34. _mcp_mesh/shared/__init__.py +2 -8
  35. _mcp_mesh/shared/config_resolver.py +124 -80
  36. _mcp_mesh/shared/defaults.py +89 -14
  37. _mcp_mesh/shared/fastapi_middleware_manager.py +149 -91
  38. _mcp_mesh/shared/host_resolver.py +8 -46
  39. _mcp_mesh/shared/server_discovery.py +115 -86
  40. _mcp_mesh/shared/simple_shutdown.py +44 -86
  41. _mcp_mesh/tracing/execution_tracer.py +2 -6
  42. _mcp_mesh/tracing/redis_metadata_publisher.py +24 -79
  43. _mcp_mesh/tracing/trace_context_helper.py +3 -13
  44. _mcp_mesh/tracing/utils.py +29 -15
  45. _mcp_mesh/utils/fastmcp_schema_extractor.py +5 -4
  46. {mcp_mesh-0.7.20.dist-info → mcp_mesh-0.8.0.dist-info}/METADATA +7 -5
  47. mcp_mesh-0.8.0.dist-info/RECORD +85 -0
  48. mesh/__init__.py +12 -1
  49. mesh/decorators.py +248 -33
  50. mesh/helpers.py +52 -0
  51. mesh/types.py +40 -13
  52. _mcp_mesh/generated/.openapi-generator/FILES +0 -50
  53. _mcp_mesh/generated/.openapi-generator/VERSION +0 -1
  54. _mcp_mesh/generated/.openapi-generator-ignore +0 -15
  55. _mcp_mesh/generated/mcp_mesh_registry_client/__init__.py +0 -90
  56. _mcp_mesh/generated/mcp_mesh_registry_client/api/__init__.py +0 -6
  57. _mcp_mesh/generated/mcp_mesh_registry_client/api/agents_api.py +0 -1088
  58. _mcp_mesh/generated/mcp_mesh_registry_client/api/health_api.py +0 -764
  59. _mcp_mesh/generated/mcp_mesh_registry_client/api/tracing_api.py +0 -303
  60. _mcp_mesh/generated/mcp_mesh_registry_client/api_client.py +0 -798
  61. _mcp_mesh/generated/mcp_mesh_registry_client/api_response.py +0 -21
  62. _mcp_mesh/generated/mcp_mesh_registry_client/configuration.py +0 -577
  63. _mcp_mesh/generated/mcp_mesh_registry_client/exceptions.py +0 -217
  64. _mcp_mesh/generated/mcp_mesh_registry_client/models/__init__.py +0 -55
  65. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_info.py +0 -158
  66. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata.py +0 -126
  67. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata_dependencies_inner.py +0 -139
  68. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata_dependencies_inner_one_of.py +0 -92
  69. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_registration.py +0 -103
  70. _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_registration_metadata.py +0 -136
  71. _mcp_mesh/generated/mcp_mesh_registry_client/models/agents_list_response.py +0 -100
  72. _mcp_mesh/generated/mcp_mesh_registry_client/models/capability_info.py +0 -107
  73. _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_agent_metadata.py +0 -112
  74. _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_agent_request.py +0 -103
  75. _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_info.py +0 -105
  76. _mcp_mesh/generated/mcp_mesh_registry_client/models/dependency_info.py +0 -103
  77. _mcp_mesh/generated/mcp_mesh_registry_client/models/dependency_resolution_info.py +0 -106
  78. _mcp_mesh/generated/mcp_mesh_registry_client/models/error_response.py +0 -91
  79. _mcp_mesh/generated/mcp_mesh_registry_client/models/health_response.py +0 -103
  80. _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_request.py +0 -101
  81. _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_request_metadata.py +0 -111
  82. _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_response.py +0 -117
  83. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_provider.py +0 -93
  84. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_provider_resolution_info.py +0 -106
  85. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter.py +0 -109
  86. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter_filter_inner.py +0 -139
  87. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter_filter_inner_one_of.py +0 -91
  88. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_info.py +0 -101
  89. _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_resolution_info.py +0 -120
  90. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_agent_register_metadata.py +0 -112
  91. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_agent_registration.py +0 -129
  92. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_registration_response.py +0 -153
  93. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_registration_response_dependencies_resolved_value_inner.py +0 -101
  94. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_dependency_registration.py +0 -93
  95. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_register_metadata.py +0 -107
  96. _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_registration.py +0 -117
  97. _mcp_mesh/generated/mcp_mesh_registry_client/models/registration_response.py +0 -119
  98. _mcp_mesh/generated/mcp_mesh_registry_client/models/resolved_llm_provider.py +0 -110
  99. _mcp_mesh/generated/mcp_mesh_registry_client/models/rich_dependency.py +0 -93
  100. _mcp_mesh/generated/mcp_mesh_registry_client/models/root_response.py +0 -92
  101. _mcp_mesh/generated/mcp_mesh_registry_client/models/standardized_dependency.py +0 -93
  102. _mcp_mesh/generated/mcp_mesh_registry_client/models/trace_event.py +0 -106
  103. _mcp_mesh/generated/mcp_mesh_registry_client/py.typed +0 -0
  104. _mcp_mesh/generated/mcp_mesh_registry_client/rest.py +0 -259
  105. _mcp_mesh/pipeline/api_heartbeat/api_dependency_resolution.py +0 -418
  106. _mcp_mesh/pipeline/api_heartbeat/api_fast_heartbeat_check.py +0 -117
  107. _mcp_mesh/pipeline/api_heartbeat/api_health_check.py +0 -140
  108. _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_orchestrator.py +0 -247
  109. _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_pipeline.py +0 -311
  110. _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_send.py +0 -386
  111. _mcp_mesh/pipeline/api_heartbeat/api_registry_connection.py +0 -104
  112. _mcp_mesh/pipeline/mcp_heartbeat/dependency_resolution.py +0 -396
  113. _mcp_mesh/pipeline/mcp_heartbeat/fast_heartbeat_check.py +0 -116
  114. _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_orchestrator.py +0 -311
  115. _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_pipeline.py +0 -282
  116. _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_send.py +0 -98
  117. _mcp_mesh/pipeline/mcp_heartbeat/lifespan_integration.py +0 -84
  118. _mcp_mesh/pipeline/mcp_heartbeat/llm_tools_resolution.py +0 -264
  119. _mcp_mesh/pipeline/mcp_heartbeat/registry_connection.py +0 -79
  120. _mcp_mesh/pipeline/shared/registry_connection.py +0 -80
  121. _mcp_mesh/shared/registry_client_wrapper.py +0 -515
  122. mcp_mesh-0.7.20.dist-info/RECORD +0 -152
  123. {mcp_mesh-0.7.20.dist-info → mcp_mesh-0.8.0.dist-info}/WHEEL +0 -0
  124. {mcp_mesh-0.7.20.dist-info → mcp_mesh-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,109 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- MCP Mesh Registry API
5
-
6
- Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Contact: dhyanraj@gmail.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from typing_extensions import Annotated
24
- from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter_filter_inner import LLMToolFilterFilterInner
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class LLMToolFilter(BaseModel):
29
- """
30
- Tool filter specification for an @mesh.llm decorated function. Embedded within MeshToolRegistration - function_name is implicit from parent tool. Registry matches tools based on filter criteria and returns filtered list in llm_tools response.
31
- """ # noqa: E501
32
- filter: Annotated[List[LLMToolFilterFilterInner], Field(min_length=1)] = Field(description="List of capability filters. Can be simple strings (capability names) or rich objects with tags and version constraints. ")
33
- filter_mode: Optional[StrictStr] = Field(default='all', description="Filter mode for tool matching: - \"all\": Include all tools matching any filter criteria - \"best_match\": One tool per capability (best tag match) - \"*\": All available tools in mesh (ignores filter) ")
34
- inject_param: Optional[StrictStr] = Field(default='llm_tools', description="Parameter name to inject tools into (for Python runtime)")
35
- __properties: ClassVar[List[str]] = ["filter", "filter_mode", "inject_param"]
36
-
37
- @field_validator('filter_mode')
38
- def filter_mode_validate_enum(cls, value):
39
- """Validates the enum"""
40
- if value is None:
41
- return value
42
-
43
- if value not in set(['all', 'best_match', '*']):
44
- raise ValueError("must be one of enum values ('all', 'best_match', '*')")
45
- return value
46
-
47
- model_config = ConfigDict(
48
- populate_by_name=True,
49
- validate_assignment=True,
50
- protected_namespaces=(),
51
- )
52
-
53
-
54
- def to_str(self) -> str:
55
- """Returns the string representation of the model using alias"""
56
- return pprint.pformat(self.model_dump(by_alias=True))
57
-
58
- def to_json(self) -> str:
59
- """Returns the JSON representation of the model using alias"""
60
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
- return json.dumps(self.to_dict())
62
-
63
- @classmethod
64
- def from_json(cls, json_str: str) -> Optional[Self]:
65
- """Create an instance of LLMToolFilter from a JSON string"""
66
- return cls.from_dict(json.loads(json_str))
67
-
68
- def to_dict(self) -> Dict[str, Any]:
69
- """Return the dictionary representation of the model using alias.
70
-
71
- This has the following differences from calling pydantic's
72
- `self.model_dump(by_alias=True)`:
73
-
74
- * `None` is only added to the output dict for nullable fields that
75
- were set at model initialization. Other fields with value `None`
76
- are ignored.
77
- """
78
- excluded_fields: Set[str] = set([
79
- ])
80
-
81
- _dict = self.model_dump(
82
- by_alias=True,
83
- exclude=excluded_fields,
84
- exclude_none=True,
85
- )
86
- # override the default output from pydantic by calling `to_dict()` of each item in filter (list)
87
- _items = []
88
- if self.filter:
89
- for _item_filter in self.filter:
90
- if _item_filter:
91
- _items.append(_item_filter.to_dict())
92
- _dict['filter'] = _items
93
- return _dict
94
-
95
- @classmethod
96
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
- """Create an instance of LLMToolFilter from a dict"""
98
- if obj is None:
99
- return None
100
-
101
- if not isinstance(obj, dict):
102
- return cls.model_validate(obj)
103
-
104
- _obj = cls.model_validate({
105
- "filter": [LLMToolFilterFilterInner.from_dict(_item) for _item in obj["filter"]] if obj.get("filter") is not None else None,
106
- "filter_mode": obj.get("filter_mode") if obj.get("filter_mode") is not None else 'all',
107
- "inject_param": obj.get("inject_param") if obj.get("inject_param") is not None else 'llm_tools'
108
- })
109
- return _obj
@@ -1,139 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- MCP Mesh Registry API
5
-
6
- Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Contact: dhyanraj@gmail.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import json
18
- import pprint
19
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
20
- from typing import Any, List, Optional
21
- from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter_filter_inner_one_of import LLMToolFilterFilterInnerOneOf
22
- from pydantic import StrictStr, Field
23
- from typing import Union, List, Set, Optional, Dict
24
- from typing_extensions import Literal, Self
25
-
26
- LLMTOOLFILTERFILTERINNER_ONE_OF_SCHEMAS = ["LLMToolFilterFilterInnerOneOf", "str"]
27
-
28
- class LLMToolFilterFilterInner(BaseModel):
29
- """
30
- LLMToolFilterFilterInner
31
- """
32
- # data type: str
33
- oneof_schema_1_validator: Optional[StrictStr] = Field(default=None, description="Simple capability name filter")
34
- # data type: LLMToolFilterFilterInnerOneOf
35
- oneof_schema_2_validator: Optional[LLMToolFilterFilterInnerOneOf] = None
36
- actual_instance: Optional[Union[LLMToolFilterFilterInnerOneOf, str]] = None
37
- one_of_schemas: Set[str] = { "LLMToolFilterFilterInnerOneOf", "str" }
38
-
39
- model_config = ConfigDict(
40
- validate_assignment=True,
41
- protected_namespaces=(),
42
- )
43
-
44
-
45
- def __init__(self, *args, **kwargs) -> None:
46
- if args:
47
- if len(args) > 1:
48
- raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
49
- if kwargs:
50
- raise ValueError("If a position argument is used, keyword arguments cannot be used.")
51
- super().__init__(actual_instance=args[0])
52
- else:
53
- super().__init__(**kwargs)
54
-
55
- @field_validator('actual_instance')
56
- def actual_instance_must_validate_oneof(cls, v):
57
- instance = LLMToolFilterFilterInner.model_construct()
58
- error_messages = []
59
- match = 0
60
- # validate data type: str
61
- try:
62
- instance.oneof_schema_1_validator = v
63
- match += 1
64
- except (ValidationError, ValueError) as e:
65
- error_messages.append(str(e))
66
- # validate data type: LLMToolFilterFilterInnerOneOf
67
- if not isinstance(v, LLMToolFilterFilterInnerOneOf):
68
- error_messages.append(f"Error! Input type `{type(v)}` is not `LLMToolFilterFilterInnerOneOf`")
69
- else:
70
- match += 1
71
- if match > 1:
72
- # more than 1 match
73
- raise ValueError("Multiple matches found when setting `actual_instance` in LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: " + ", ".join(error_messages))
74
- elif match == 0:
75
- # no match
76
- raise ValueError("No match found when setting `actual_instance` in LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: " + ", ".join(error_messages))
77
- else:
78
- return v
79
-
80
- @classmethod
81
- def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
82
- return cls.from_json(json.dumps(obj))
83
-
84
- @classmethod
85
- def from_json(cls, json_str: str) -> Self:
86
- """Returns the object represented by the json string"""
87
- instance = cls.model_construct()
88
- error_messages = []
89
- match = 0
90
-
91
- # deserialize data into str
92
- try:
93
- # validation
94
- instance.oneof_schema_1_validator = json.loads(json_str)
95
- # assign value to actual_instance
96
- instance.actual_instance = instance.oneof_schema_1_validator
97
- match += 1
98
- except (ValidationError, ValueError) as e:
99
- error_messages.append(str(e))
100
- # deserialize data into LLMToolFilterFilterInnerOneOf
101
- try:
102
- instance.actual_instance = LLMToolFilterFilterInnerOneOf.from_json(json_str)
103
- match += 1
104
- except (ValidationError, ValueError) as e:
105
- error_messages.append(str(e))
106
-
107
- if match > 1:
108
- # more than 1 match
109
- raise ValueError("Multiple matches found when deserializing the JSON string into LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: " + ", ".join(error_messages))
110
- elif match == 0:
111
- # no match
112
- raise ValueError("No match found when deserializing the JSON string into LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: " + ", ".join(error_messages))
113
- else:
114
- return instance
115
-
116
- def to_json(self) -> str:
117
- """Returns the JSON representation of the actual instance"""
118
- if self.actual_instance is None:
119
- return "null"
120
-
121
- if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
122
- return self.actual_instance.to_json()
123
- else:
124
- return json.dumps(self.actual_instance)
125
-
126
- def to_dict(self) -> Optional[Union[Dict[str, Any], LLMToolFilterFilterInnerOneOf, str]]:
127
- """Returns the dict representation of the actual instance"""
128
- if self.actual_instance is None:
129
- return None
130
-
131
- if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
132
- return self.actual_instance.to_dict()
133
- else:
134
- # primitive type
135
- return self.actual_instance
136
-
137
- def to_str(self) -> str:
138
- """Returns the string representation of the actual instance"""
139
- return pprint.pformat(self.model_dump())
@@ -1,91 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- MCP Mesh Registry API
5
-
6
- Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Contact: dhyanraj@gmail.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from typing_extensions import Annotated
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class LLMToolFilterFilterInnerOneOf(BaseModel):
28
- """
29
- Rich filter with capability, tags, and version
30
- """ # noqa: E501
31
- capability: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Capability name to match")
32
- tags: Optional[List[StrictStr]] = Field(default=None, description="Tags for tag-based filtering (subset matching)")
33
- version: Optional[StrictStr] = Field(default=None, description="Version constraint")
34
- __properties: ClassVar[List[str]] = ["capability", "tags", "version"]
35
-
36
- model_config = ConfigDict(
37
- populate_by_name=True,
38
- validate_assignment=True,
39
- protected_namespaces=(),
40
- )
41
-
42
-
43
- def to_str(self) -> str:
44
- """Returns the string representation of the model using alias"""
45
- return pprint.pformat(self.model_dump(by_alias=True))
46
-
47
- def to_json(self) -> str:
48
- """Returns the JSON representation of the model using alias"""
49
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
- return json.dumps(self.to_dict())
51
-
52
- @classmethod
53
- def from_json(cls, json_str: str) -> Optional[Self]:
54
- """Create an instance of LLMToolFilterFilterInnerOneOf from a JSON string"""
55
- return cls.from_dict(json.loads(json_str))
56
-
57
- def to_dict(self) -> Dict[str, Any]:
58
- """Return the dictionary representation of the model using alias.
59
-
60
- This has the following differences from calling pydantic's
61
- `self.model_dump(by_alias=True)`:
62
-
63
- * `None` is only added to the output dict for nullable fields that
64
- were set at model initialization. Other fields with value `None`
65
- are ignored.
66
- """
67
- excluded_fields: Set[str] = set([
68
- ])
69
-
70
- _dict = self.model_dump(
71
- by_alias=True,
72
- exclude=excluded_fields,
73
- exclude_none=True,
74
- )
75
- return _dict
76
-
77
- @classmethod
78
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
- """Create an instance of LLMToolFilterFilterInnerOneOf from a dict"""
80
- if obj is None:
81
- return None
82
-
83
- if not isinstance(obj, dict):
84
- return cls.model_validate(obj)
85
-
86
- _obj = cls.model_validate({
87
- "capability": obj.get("capability"),
88
- "tags": obj.get("tags"),
89
- "version": obj.get("version")
90
- })
91
- return _obj
@@ -1,101 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- MCP Mesh Registry API
5
-
6
- Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Contact: dhyanraj@gmail.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from typing_extensions import Annotated
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class LLMToolInfo(BaseModel):
28
- """
29
- Complete tool information for LLM consumption. Includes everything an LLM needs to understand and call the tool via MCP protocol.
30
- """ # noqa: E501
31
- name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Function name (MCP protocol level)")
32
- capability: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Capability name this tool provides")
33
- description: StrictStr = Field(description="Human-readable tool description for LLM context")
34
- input_schema: Dict[str, Any] = Field(description="JSON Schema for tool parameters (MCP format). LLM uses this to understand required and optional parameters. ", alias="inputSchema")
35
- tags: Optional[List[StrictStr]] = Field(default=None, description="Capability tags")
36
- version: Optional[StrictStr] = Field(default='1.0.0', description="Tool version")
37
- endpoint: StrictStr = Field(description="Agent endpoint for MCP protocol calls")
38
- kwargs: Optional[Dict[str, Any]] = Field(default=None, description="Proxy configuration for tool execution (timeout, retry, streaming, etc.). Passed to UnifiedMCPProxy for enhanced client behavior. ")
39
- __properties: ClassVar[List[str]] = ["name", "capability", "description", "inputSchema", "tags", "version", "endpoint", "kwargs"]
40
-
41
- model_config = ConfigDict(
42
- populate_by_name=True,
43
- validate_assignment=True,
44
- protected_namespaces=(),
45
- )
46
-
47
-
48
- def to_str(self) -> str:
49
- """Returns the string representation of the model using alias"""
50
- return pprint.pformat(self.model_dump(by_alias=True))
51
-
52
- def to_json(self) -> str:
53
- """Returns the JSON representation of the model using alias"""
54
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
- return json.dumps(self.to_dict())
56
-
57
- @classmethod
58
- def from_json(cls, json_str: str) -> Optional[Self]:
59
- """Create an instance of LLMToolInfo from a JSON string"""
60
- return cls.from_dict(json.loads(json_str))
61
-
62
- def to_dict(self) -> Dict[str, Any]:
63
- """Return the dictionary representation of the model using alias.
64
-
65
- This has the following differences from calling pydantic's
66
- `self.model_dump(by_alias=True)`:
67
-
68
- * `None` is only added to the output dict for nullable fields that
69
- were set at model initialization. Other fields with value `None`
70
- are ignored.
71
- """
72
- excluded_fields: Set[str] = set([
73
- ])
74
-
75
- _dict = self.model_dump(
76
- by_alias=True,
77
- exclude=excluded_fields,
78
- exclude_none=True,
79
- )
80
- return _dict
81
-
82
- @classmethod
83
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
- """Create an instance of LLMToolInfo from a dict"""
85
- if obj is None:
86
- return None
87
-
88
- if not isinstance(obj, dict):
89
- return cls.model_validate(obj)
90
-
91
- _obj = cls.model_validate({
92
- "name": obj.get("name"),
93
- "capability": obj.get("capability"),
94
- "description": obj.get("description"),
95
- "inputSchema": obj.get("inputSchema"),
96
- "tags": obj.get("tags"),
97
- "version": obj.get("version") if obj.get("version") is not None else '1.0.0',
98
- "endpoint": obj.get("endpoint"),
99
- "kwargs": obj.get("kwargs")
100
- })
101
- return _obj
@@ -1,120 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- MCP Mesh Registry API
5
-
6
- Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Contact: dhyanraj@gmail.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from typing_extensions import Annotated
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class LLMToolResolutionInfo(BaseModel):
28
- """
29
- Resolution info for LLM tool filters (@mesh.llm filter). Shows which tools were resolved to match the filter specification.
30
- """ # noqa: E501
31
- function_name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Function with @mesh.llm decorator")
32
- filter_capability: Optional[StrictStr] = Field(default=None, description="Capability specified in the filter")
33
- filter_tags: Optional[List[StrictStr]] = Field(default=None, description="Tags specified in the filter")
34
- filter_mode: Optional[StrictStr] = Field(default='all', description="Filter mode used")
35
- mcp_tool: Optional[StrictStr] = Field(default=None, description="MCP tool name on provider (NULL if unresolved)")
36
- provider_capability: Optional[StrictStr] = Field(default=None, description="Capability of the resolved tool")
37
- provider_agent_id: Optional[StrictStr] = Field(default=None, description="Provider agent ID (NULL if unresolved)")
38
- endpoint: Optional[StrictStr] = Field(default=None, description="Provider endpoint (NULL if unresolved)")
39
- status: StrictStr = Field(description="Tool resolution status")
40
- __properties: ClassVar[List[str]] = ["function_name", "filter_capability", "filter_tags", "filter_mode", "mcp_tool", "provider_capability", "provider_agent_id", "endpoint", "status"]
41
-
42
- @field_validator('filter_mode')
43
- def filter_mode_validate_enum(cls, value):
44
- """Validates the enum"""
45
- if value is None:
46
- return value
47
-
48
- if value not in set(['all', 'best_match', '*']):
49
- raise ValueError("must be one of enum values ('all', 'best_match', '*')")
50
- return value
51
-
52
- @field_validator('status')
53
- def status_validate_enum(cls, value):
54
- """Validates the enum"""
55
- if value not in set(['available', 'unavailable', 'unresolved']):
56
- raise ValueError("must be one of enum values ('available', 'unavailable', 'unresolved')")
57
- return value
58
-
59
- model_config = ConfigDict(
60
- populate_by_name=True,
61
- validate_assignment=True,
62
- protected_namespaces=(),
63
- )
64
-
65
-
66
- def to_str(self) -> str:
67
- """Returns the string representation of the model using alias"""
68
- return pprint.pformat(self.model_dump(by_alias=True))
69
-
70
- def to_json(self) -> str:
71
- """Returns the JSON representation of the model using alias"""
72
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
73
- return json.dumps(self.to_dict())
74
-
75
- @classmethod
76
- def from_json(cls, json_str: str) -> Optional[Self]:
77
- """Create an instance of LLMToolResolutionInfo from a JSON string"""
78
- return cls.from_dict(json.loads(json_str))
79
-
80
- def to_dict(self) -> Dict[str, Any]:
81
- """Return the dictionary representation of the model using alias.
82
-
83
- This has the following differences from calling pydantic's
84
- `self.model_dump(by_alias=True)`:
85
-
86
- * `None` is only added to the output dict for nullable fields that
87
- were set at model initialization. Other fields with value `None`
88
- are ignored.
89
- """
90
- excluded_fields: Set[str] = set([
91
- ])
92
-
93
- _dict = self.model_dump(
94
- by_alias=True,
95
- exclude=excluded_fields,
96
- exclude_none=True,
97
- )
98
- return _dict
99
-
100
- @classmethod
101
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
- """Create an instance of LLMToolResolutionInfo from a dict"""
103
- if obj is None:
104
- return None
105
-
106
- if not isinstance(obj, dict):
107
- return cls.model_validate(obj)
108
-
109
- _obj = cls.model_validate({
110
- "function_name": obj.get("function_name"),
111
- "filter_capability": obj.get("filter_capability"),
112
- "filter_tags": obj.get("filter_tags"),
113
- "filter_mode": obj.get("filter_mode") if obj.get("filter_mode") is not None else 'all',
114
- "mcp_tool": obj.get("mcp_tool"),
115
- "provider_capability": obj.get("provider_capability"),
116
- "provider_agent_id": obj.get("provider_agent_id"),
117
- "endpoint": obj.get("endpoint"),
118
- "status": obj.get("status")
119
- })
120
- return _obj
@@ -1,112 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- MCP Mesh Registry API
5
-
6
- Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
7
-
8
- The version of the OpenAPI document: 1.0.0
9
- Contact: dhyanraj@gmail.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from typing_extensions import Annotated
24
- from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_tool_register_metadata import MeshToolRegisterMetadata
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class MeshAgentRegisterMetadata(BaseModel):
29
- """
30
- Agent registration metadata for @mesh.tool based agents
31
- """ # noqa: E501
32
- agent_type: StrictStr = Field(description="Type of agent (always mcp_agent for mesh tools)")
33
- name: Annotated[str, Field(min_length=1, strict=True, max_length=64)] = Field(description="Agent name")
34
- version: Optional[StrictStr] = Field(default='1.0.0', description="Agent version")
35
- namespace: Optional[StrictStr] = Field(default='default', description="Agent namespace")
36
- endpoint: Optional[StrictStr] = Field(default=None, description="Agent endpoint URL")
37
- tools: Annotated[List[MeshToolRegisterMetadata], Field(min_length=1)] = Field(description="Array of tools provided by this agent")
38
- __properties: ClassVar[List[str]] = ["agent_type", "name", "version", "namespace", "endpoint", "tools"]
39
-
40
- @field_validator('agent_type')
41
- def agent_type_validate_enum(cls, value):
42
- """Validates the enum"""
43
- if value not in set(['mcp_agent']):
44
- raise ValueError("must be one of enum values ('mcp_agent')")
45
- return value
46
-
47
- model_config = ConfigDict(
48
- populate_by_name=True,
49
- validate_assignment=True,
50
- protected_namespaces=(),
51
- )
52
-
53
-
54
- def to_str(self) -> str:
55
- """Returns the string representation of the model using alias"""
56
- return pprint.pformat(self.model_dump(by_alias=True))
57
-
58
- def to_json(self) -> str:
59
- """Returns the JSON representation of the model using alias"""
60
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
- return json.dumps(self.to_dict())
62
-
63
- @classmethod
64
- def from_json(cls, json_str: str) -> Optional[Self]:
65
- """Create an instance of MeshAgentRegisterMetadata from a JSON string"""
66
- return cls.from_dict(json.loads(json_str))
67
-
68
- def to_dict(self) -> Dict[str, Any]:
69
- """Return the dictionary representation of the model using alias.
70
-
71
- This has the following differences from calling pydantic's
72
- `self.model_dump(by_alias=True)`:
73
-
74
- * `None` is only added to the output dict for nullable fields that
75
- were set at model initialization. Other fields with value `None`
76
- are ignored.
77
- """
78
- excluded_fields: Set[str] = set([
79
- ])
80
-
81
- _dict = self.model_dump(
82
- by_alias=True,
83
- exclude=excluded_fields,
84
- exclude_none=True,
85
- )
86
- # override the default output from pydantic by calling `to_dict()` of each item in tools (list)
87
- _items = []
88
- if self.tools:
89
- for _item_tools in self.tools:
90
- if _item_tools:
91
- _items.append(_item_tools.to_dict())
92
- _dict['tools'] = _items
93
- return _dict
94
-
95
- @classmethod
96
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
- """Create an instance of MeshAgentRegisterMetadata from a dict"""
98
- if obj is None:
99
- return None
100
-
101
- if not isinstance(obj, dict):
102
- return cls.model_validate(obj)
103
-
104
- _obj = cls.model_validate({
105
- "agent_type": obj.get("agent_type"),
106
- "name": obj.get("name"),
107
- "version": obj.get("version") if obj.get("version") is not None else '1.0.0',
108
- "namespace": obj.get("namespace") if obj.get("namespace") is not None else 'default',
109
- "endpoint": obj.get("endpoint"),
110
- "tools": [MeshToolRegisterMetadata.from_dict(_item) for _item in obj["tools"]] if obj.get("tools") is not None else None
111
- })
112
- return _obj