mcp-mesh 0.7.21__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.21.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 -243
  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.21.dist-info/RECORD +0 -152
  123. {mcp_mesh-0.7.21.dist-info → mcp_mesh-0.8.0.dist-info}/WHEEL +0 -0
  124. {mcp_mesh-0.7.21.dist-info → mcp_mesh-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -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.agent_metadata_dependencies_inner_one_of import AgentMetadataDependenciesInnerOneOf
22
- from pydantic import StrictStr, Field
23
- from typing import Union, List, Set, Optional, Dict
24
- from typing_extensions import Literal, Self
25
-
26
- AGENTMETADATADEPENDENCIESINNER_ONE_OF_SCHEMAS = ["AgentMetadataDependenciesInnerOneOf", "str"]
27
-
28
- class AgentMetadataDependenciesInner(BaseModel):
29
- """
30
- AgentMetadataDependenciesInner
31
- """
32
- # data type: str
33
- oneof_schema_1_validator: Optional[StrictStr] = Field(default=None, description="Simple dependency by capability name")
34
- # data type: AgentMetadataDependenciesInnerOneOf
35
- oneof_schema_2_validator: Optional[AgentMetadataDependenciesInnerOneOf] = None
36
- actual_instance: Optional[Union[AgentMetadataDependenciesInnerOneOf, str]] = None
37
- one_of_schemas: Set[str] = { "AgentMetadataDependenciesInnerOneOf", "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 = AgentMetadataDependenciesInner.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: AgentMetadataDependenciesInnerOneOf
67
- if not isinstance(v, AgentMetadataDependenciesInnerOneOf):
68
- error_messages.append(f"Error! Input type `{type(v)}` is not `AgentMetadataDependenciesInnerOneOf`")
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 AgentMetadataDependenciesInner with oneOf schemas: AgentMetadataDependenciesInnerOneOf, str. Details: " + ", ".join(error_messages))
74
- elif match == 0:
75
- # no match
76
- raise ValueError("No match found when setting `actual_instance` in AgentMetadataDependenciesInner with oneOf schemas: AgentMetadataDependenciesInnerOneOf, 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 AgentMetadataDependenciesInnerOneOf
101
- try:
102
- instance.actual_instance = AgentMetadataDependenciesInnerOneOf.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 AgentMetadataDependenciesInner with oneOf schemas: AgentMetadataDependenciesInnerOneOf, str. Details: " + ", ".join(error_messages))
110
- elif match == 0:
111
- # no match
112
- raise ValueError("No match found when deserializing the JSON string into AgentMetadataDependenciesInner with oneOf schemas: AgentMetadataDependenciesInnerOneOf, 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], AgentMetadataDependenciesInnerOneOf, 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,92 +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 import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class AgentMetadataDependenciesInnerOneOf(BaseModel):
27
- """
28
- Rich dependency with tags and metadata
29
- """ # noqa: E501
30
- capability: StrictStr = Field(description="Required capability name")
31
- tags: Optional[List[StrictStr]] = Field(default=None, description="Optional tags for smart matching")
32
- version: Optional[StrictStr] = Field(default=None, description="Optional version constraint")
33
- namespace: Optional[StrictStr] = Field(default='default', description="Optional namespace filter")
34
- __properties: ClassVar[List[str]] = ["capability", "tags", "version", "namespace"]
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 AgentMetadataDependenciesInnerOneOf 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 AgentMetadataDependenciesInnerOneOf 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
- "namespace": obj.get("namespace") if obj.get("namespace") is not None else 'default'
91
- })
92
- return _obj
@@ -1,103 +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 datetime import datetime
22
- from pydantic import BaseModel, ConfigDict, Field, field_validator
23
- from typing import Any, ClassVar, Dict, List
24
- from typing_extensions import Annotated
25
- from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_registration_metadata import AgentRegistrationMetadata
26
- from typing import Optional, Set
27
- from typing_extensions import Self
28
-
29
- class AgentRegistration(BaseModel):
30
- """
31
- AgentRegistration
32
- """ # noqa: E501
33
- agent_id: Annotated[str, Field(min_length=1, strict=True, max_length=64)] = Field(description="Unique identifier for the agent")
34
- metadata: AgentRegistrationMetadata
35
- timestamp: datetime = Field(description="Registration timestamp")
36
- __properties: ClassVar[List[str]] = ["agent_id", "metadata", "timestamp"]
37
-
38
- @field_validator('agent_id')
39
- def agent_id_validate_regular_expression(cls, value):
40
- """Validates the regular expression"""
41
- if not re.match(r"^[a-zA-Z0-9_-]+$", value):
42
- raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9_-]+$/")
43
- return value
44
-
45
- model_config = ConfigDict(
46
- populate_by_name=True,
47
- validate_assignment=True,
48
- protected_namespaces=(),
49
- )
50
-
51
-
52
- def to_str(self) -> str:
53
- """Returns the string representation of the model using alias"""
54
- return pprint.pformat(self.model_dump(by_alias=True))
55
-
56
- def to_json(self) -> str:
57
- """Returns the JSON representation of the model using alias"""
58
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
- return json.dumps(self.to_dict())
60
-
61
- @classmethod
62
- def from_json(cls, json_str: str) -> Optional[Self]:
63
- """Create an instance of AgentRegistration from a JSON string"""
64
- return cls.from_dict(json.loads(json_str))
65
-
66
- def to_dict(self) -> Dict[str, Any]:
67
- """Return the dictionary representation of the model using alias.
68
-
69
- This has the following differences from calling pydantic's
70
- `self.model_dump(by_alias=True)`:
71
-
72
- * `None` is only added to the output dict for nullable fields that
73
- were set at model initialization. Other fields with value `None`
74
- are ignored.
75
- """
76
- excluded_fields: Set[str] = set([
77
- ])
78
-
79
- _dict = self.model_dump(
80
- by_alias=True,
81
- exclude=excluded_fields,
82
- exclude_none=True,
83
- )
84
- # override the default output from pydantic by calling `to_dict()` of metadata
85
- if self.metadata:
86
- _dict['metadata'] = self.metadata.to_dict()
87
- return _dict
88
-
89
- @classmethod
90
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
- """Create an instance of AgentRegistration from a dict"""
92
- if obj is None:
93
- return None
94
-
95
- if not isinstance(obj, dict):
96
- return cls.model_validate(obj)
97
-
98
- _obj = cls.model_validate({
99
- "agent_id": obj.get("agent_id"),
100
- "metadata": AgentRegistrationMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None,
101
- "timestamp": obj.get("timestamp")
102
- })
103
- return _obj
@@ -1,136 +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.agent_metadata import AgentMetadata
22
- from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_agent_register_metadata import MeshAgentRegisterMetadata
23
- from pydantic import StrictStr, Field
24
- from typing import Union, List, Set, Optional, Dict
25
- from typing_extensions import Literal, Self
26
-
27
- AGENTREGISTRATIONMETADATA_ONE_OF_SCHEMAS = ["AgentMetadata", "MeshAgentRegisterMetadata"]
28
-
29
- class AgentRegistrationMetadata(BaseModel):
30
- """
31
- Agent metadata (legacy format or new mesh format)
32
- """
33
- # data type: AgentMetadata
34
- oneof_schema_1_validator: Optional[AgentMetadata] = None
35
- # data type: MeshAgentRegisterMetadata
36
- oneof_schema_2_validator: Optional[MeshAgentRegisterMetadata] = None
37
- actual_instance: Optional[Union[AgentMetadata, MeshAgentRegisterMetadata]] = None
38
- one_of_schemas: Set[str] = { "AgentMetadata", "MeshAgentRegisterMetadata" }
39
-
40
- model_config = ConfigDict(
41
- validate_assignment=True,
42
- protected_namespaces=(),
43
- )
44
-
45
-
46
- def __init__(self, *args, **kwargs) -> None:
47
- if args:
48
- if len(args) > 1:
49
- raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
50
- if kwargs:
51
- raise ValueError("If a position argument is used, keyword arguments cannot be used.")
52
- super().__init__(actual_instance=args[0])
53
- else:
54
- super().__init__(**kwargs)
55
-
56
- @field_validator('actual_instance')
57
- def actual_instance_must_validate_oneof(cls, v):
58
- instance = AgentRegistrationMetadata.model_construct()
59
- error_messages = []
60
- match = 0
61
- # validate data type: AgentMetadata
62
- if not isinstance(v, AgentMetadata):
63
- error_messages.append(f"Error! Input type `{type(v)}` is not `AgentMetadata`")
64
- else:
65
- match += 1
66
- # validate data type: MeshAgentRegisterMetadata
67
- if not isinstance(v, MeshAgentRegisterMetadata):
68
- error_messages.append(f"Error! Input type `{type(v)}` is not `MeshAgentRegisterMetadata`")
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 AgentRegistrationMetadata with oneOf schemas: AgentMetadata, MeshAgentRegisterMetadata. Details: " + ", ".join(error_messages))
74
- elif match == 0:
75
- # no match
76
- raise ValueError("No match found when setting `actual_instance` in AgentRegistrationMetadata with oneOf schemas: AgentMetadata, MeshAgentRegisterMetadata. 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 AgentMetadata
92
- try:
93
- instance.actual_instance = AgentMetadata.from_json(json_str)
94
- match += 1
95
- except (ValidationError, ValueError) as e:
96
- error_messages.append(str(e))
97
- # deserialize data into MeshAgentRegisterMetadata
98
- try:
99
- instance.actual_instance = MeshAgentRegisterMetadata.from_json(json_str)
100
- match += 1
101
- except (ValidationError, ValueError) as e:
102
- error_messages.append(str(e))
103
-
104
- if match > 1:
105
- # more than 1 match
106
- raise ValueError("Multiple matches found when deserializing the JSON string into AgentRegistrationMetadata with oneOf schemas: AgentMetadata, MeshAgentRegisterMetadata. Details: " + ", ".join(error_messages))
107
- elif match == 0:
108
- # no match
109
- raise ValueError("No match found when deserializing the JSON string into AgentRegistrationMetadata with oneOf schemas: AgentMetadata, MeshAgentRegisterMetadata. Details: " + ", ".join(error_messages))
110
- else:
111
- return instance
112
-
113
- def to_json(self) -> str:
114
- """Returns the JSON representation of the actual instance"""
115
- if self.actual_instance is None:
116
- return "null"
117
-
118
- if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
119
- return self.actual_instance.to_json()
120
- else:
121
- return json.dumps(self.actual_instance)
122
-
123
- def to_dict(self) -> Optional[Union[Dict[str, Any], AgentMetadata, MeshAgentRegisterMetadata]]:
124
- """Returns the dict representation of the actual instance"""
125
- if self.actual_instance is None:
126
- return None
127
-
128
- if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
129
- return self.actual_instance.to_dict()
130
- else:
131
- # primitive type
132
- return self.actual_instance
133
-
134
- def to_str(self) -> str:
135
- """Returns the string representation of the actual instance"""
136
- return pprint.pformat(self.model_dump())
@@ -1,100 +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 datetime import datetime
22
- from pydantic import BaseModel, ConfigDict, Field
23
- from typing import Any, ClassVar, Dict, List
24
- from typing_extensions import Annotated
25
- from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_info import AgentInfo
26
- from typing import Optional, Set
27
- from typing_extensions import Self
28
-
29
- class AgentsListResponse(BaseModel):
30
- """
31
- AgentsListResponse
32
- """ # noqa: E501
33
- agents: List[AgentInfo] = Field(description="List of registered agents")
34
- count: Annotated[int, Field(strict=True, ge=0)] = Field(description="Total number of agents")
35
- timestamp: datetime
36
- __properties: ClassVar[List[str]] = ["agents", "count", "timestamp"]
37
-
38
- model_config = ConfigDict(
39
- populate_by_name=True,
40
- validate_assignment=True,
41
- protected_namespaces=(),
42
- )
43
-
44
-
45
- def to_str(self) -> str:
46
- """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.model_dump(by_alias=True))
48
-
49
- def to_json(self) -> str:
50
- """Returns the JSON representation of the model using alias"""
51
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
- return json.dumps(self.to_dict())
53
-
54
- @classmethod
55
- def from_json(cls, json_str: str) -> Optional[Self]:
56
- """Create an instance of AgentsListResponse from a JSON string"""
57
- return cls.from_dict(json.loads(json_str))
58
-
59
- def to_dict(self) -> Dict[str, Any]:
60
- """Return the dictionary representation of the model using alias.
61
-
62
- This has the following differences from calling pydantic's
63
- `self.model_dump(by_alias=True)`:
64
-
65
- * `None` is only added to the output dict for nullable fields that
66
- were set at model initialization. Other fields with value `None`
67
- are ignored.
68
- """
69
- excluded_fields: Set[str] = set([
70
- ])
71
-
72
- _dict = self.model_dump(
73
- by_alias=True,
74
- exclude=excluded_fields,
75
- exclude_none=True,
76
- )
77
- # override the default output from pydantic by calling `to_dict()` of each item in agents (list)
78
- _items = []
79
- if self.agents:
80
- for _item_agents in self.agents:
81
- if _item_agents:
82
- _items.append(_item_agents.to_dict())
83
- _dict['agents'] = _items
84
- return _dict
85
-
86
- @classmethod
87
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
- """Create an instance of AgentsListResponse from a dict"""
89
- if obj is None:
90
- return None
91
-
92
- if not isinstance(obj, dict):
93
- return cls.model_validate(obj)
94
-
95
- _obj = cls.model_validate({
96
- "agents": [AgentInfo.from_dict(_item) for _item in obj["agents"]] if obj.get("agents") is not None else None,
97
- "count": obj.get("count"),
98
- "timestamp": obj.get("timestamp")
99
- })
100
- return _obj
@@ -1,107 +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 _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_provider import LLMProvider
25
- from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter import LLMToolFilter
26
- from typing import Optional, Set
27
- from typing_extensions import Self
28
-
29
- class CapabilityInfo(BaseModel):
30
- """
31
- CapabilityInfo
32
- """ # noqa: E501
33
- name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Capability name")
34
- version: StrictStr = Field(description="Capability version")
35
- function_name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Name of the function that provides this capability")
36
- tags: Optional[List[StrictStr]] = Field(default=None, description="Tags associated with this capability")
37
- description: Optional[StrictStr] = Field(default=None, description="Human-readable description of the capability")
38
- llm_filter: Optional[LLMToolFilter] = None
39
- llm_provider: Optional[LLMProvider] = None
40
- __properties: ClassVar[List[str]] = ["name", "version", "function_name", "tags", "description", "llm_filter", "llm_provider"]
41
-
42
- model_config = ConfigDict(
43
- populate_by_name=True,
44
- validate_assignment=True,
45
- protected_namespaces=(),
46
- )
47
-
48
-
49
- def to_str(self) -> str:
50
- """Returns the string representation of the model using alias"""
51
- return pprint.pformat(self.model_dump(by_alias=True))
52
-
53
- def to_json(self) -> str:
54
- """Returns the JSON representation of the model using alias"""
55
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
- return json.dumps(self.to_dict())
57
-
58
- @classmethod
59
- def from_json(cls, json_str: str) -> Optional[Self]:
60
- """Create an instance of CapabilityInfo from a JSON string"""
61
- return cls.from_dict(json.loads(json_str))
62
-
63
- def to_dict(self) -> Dict[str, Any]:
64
- """Return the dictionary representation of the model using alias.
65
-
66
- This has the following differences from calling pydantic's
67
- `self.model_dump(by_alias=True)`:
68
-
69
- * `None` is only added to the output dict for nullable fields that
70
- were set at model initialization. Other fields with value `None`
71
- are ignored.
72
- """
73
- excluded_fields: Set[str] = set([
74
- ])
75
-
76
- _dict = self.model_dump(
77
- by_alias=True,
78
- exclude=excluded_fields,
79
- exclude_none=True,
80
- )
81
- # override the default output from pydantic by calling `to_dict()` of llm_filter
82
- if self.llm_filter:
83
- _dict['llm_filter'] = self.llm_filter.to_dict()
84
- # override the default output from pydantic by calling `to_dict()` of llm_provider
85
- if self.llm_provider:
86
- _dict['llm_provider'] = self.llm_provider.to_dict()
87
- return _dict
88
-
89
- @classmethod
90
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
- """Create an instance of CapabilityInfo from a dict"""
92
- if obj is None:
93
- return None
94
-
95
- if not isinstance(obj, dict):
96
- return cls.model_validate(obj)
97
-
98
- _obj = cls.model_validate({
99
- "name": obj.get("name"),
100
- "version": obj.get("version") if obj.get("version") is not None else '1.0.0',
101
- "function_name": obj.get("function_name"),
102
- "tags": obj.get("tags"),
103
- "description": obj.get("description"),
104
- "llm_filter": LLMToolFilter.from_dict(obj["llm_filter"]) if obj.get("llm_filter") is not None else None,
105
- "llm_provider": LLMProvider.from_dict(obj["llm_provider"]) if obj.get("llm_provider") is not None else None
106
- })
107
- return _obj