mcp-mesh 0.6.0__py3-none-any.whl → 0.6.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.
- _mcp_mesh/__init__.py +1 -1
- _mcp_mesh/engine/decorator_registry.py +26 -2
- _mcp_mesh/engine/dependency_injector.py +14 -1
- _mcp_mesh/engine/llm_config.py +11 -7
- _mcp_mesh/engine/mesh_llm_agent.py +247 -61
- _mcp_mesh/engine/mesh_llm_agent_injector.py +174 -0
- _mcp_mesh/engine/provider_handlers/__init__.py +20 -0
- _mcp_mesh/engine/provider_handlers/base_provider_handler.py +122 -0
- _mcp_mesh/engine/provider_handlers/claude_handler.py +138 -0
- _mcp_mesh/engine/provider_handlers/generic_handler.py +156 -0
- _mcp_mesh/engine/provider_handlers/openai_handler.py +163 -0
- _mcp_mesh/engine/provider_handlers/provider_handler_registry.py +167 -0
- _mcp_mesh/engine/response_parser.py +3 -38
- _mcp_mesh/engine/tool_schema_builder.py +3 -2
- _mcp_mesh/generated/.openapi-generator/FILES +3 -0
- _mcp_mesh/generated/.openapi-generator-ignore +0 -1
- _mcp_mesh/generated/mcp_mesh_registry_client/__init__.py +51 -97
- _mcp_mesh/generated/mcp_mesh_registry_client/models/__init__.py +42 -72
- _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_info.py +11 -1
- _mcp_mesh/generated/mcp_mesh_registry_client/models/dependency_resolution_info.py +108 -0
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_provider.py +95 -0
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter.py +37 -58
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter_filter_inner.py +32 -63
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter_filter_inner_one_of.py +30 -29
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_info.py +41 -59
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_agent_registration.py +51 -98
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_registration_response.py +70 -85
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_registration.py +51 -84
- _mcp_mesh/generated/mcp_mesh_registry_client/models/resolved_llm_provider.py +112 -0
- _mcp_mesh/pipeline/api_heartbeat/api_dependency_resolution.py +54 -21
- _mcp_mesh/pipeline/mcp_heartbeat/dependency_resolution.py +43 -26
- _mcp_mesh/pipeline/mcp_heartbeat/fast_heartbeat_check.py +3 -3
- _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_orchestrator.py +35 -10
- _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_pipeline.py +1 -1
- _mcp_mesh/pipeline/mcp_heartbeat/llm_tools_resolution.py +77 -39
- _mcp_mesh/pipeline/mcp_startup/fastapiserver_setup.py +118 -35
- _mcp_mesh/pipeline/mcp_startup/fastmcpserver_discovery.py +1 -1
- _mcp_mesh/pipeline/mcp_startup/heartbeat_preparation.py +48 -3
- _mcp_mesh/pipeline/mcp_startup/server_discovery.py +77 -48
- _mcp_mesh/pipeline/mcp_startup/startup_orchestrator.py +2 -2
- _mcp_mesh/shared/health_check_cache.py +246 -0
- _mcp_mesh/shared/registry_client_wrapper.py +29 -2
- {mcp_mesh-0.6.0.dist-info → mcp_mesh-0.6.2.dist-info}/METADATA +1 -1
- {mcp_mesh-0.6.0.dist-info → mcp_mesh-0.6.2.dist-info}/RECORD +50 -39
- mesh/__init__.py +12 -2
- mesh/decorators.py +105 -39
- mesh/helpers.py +259 -0
- mesh/types.py +53 -4
- {mcp_mesh-0.6.0.dist-info → mcp_mesh-0.6.2.dist-info}/WHEEL +0 -0
- {mcp_mesh-0.6.0.dist-info → mcp_mesh-0.6.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,71 +1,58 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
1
3
|
"""
|
|
2
|
-
MCP Mesh Registry API
|
|
4
|
+
MCP Mesh Registry API
|
|
3
5
|
|
|
4
|
-
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
|
|
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
|
|
5
7
|
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
Contact: dhyanraj@gmail.com
|
|
8
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: dhyanraj@gmail.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
11
|
|
|
10
|
-
Do not edit the class manually.
|
|
12
|
+
Do not edit the class manually.
|
|
11
13
|
""" # noqa: E501
|
|
12
14
|
|
|
13
|
-
from __future__ import annotations
|
|
14
15
|
|
|
16
|
+
from __future__ import annotations
|
|
15
17
|
import json
|
|
16
18
|
import pprint
|
|
17
|
-
from
|
|
18
|
-
|
|
19
|
-
from
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
StrictStr,
|
|
24
|
-
ValidationError,
|
|
25
|
-
field_validator,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter_filter_inner_one_of import (
|
|
29
|
-
LLMToolFilterFilterInnerOneOf,
|
|
30
|
-
)
|
|
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
|
|
31
25
|
|
|
32
26
|
LLMTOOLFILTERFILTERINNER_ONE_OF_SCHEMAS = ["LLMToolFilterFilterInnerOneOf", "str"]
|
|
33
27
|
|
|
34
|
-
|
|
35
28
|
class LLMToolFilterFilterInner(BaseModel):
|
|
36
29
|
"""
|
|
37
30
|
LLMToolFilterFilterInner
|
|
38
31
|
"""
|
|
39
|
-
|
|
40
32
|
# data type: str
|
|
41
|
-
oneof_schema_1_validator: Optional[StrictStr] = Field(
|
|
42
|
-
default=None, description="Simple capability name filter"
|
|
43
|
-
)
|
|
33
|
+
oneof_schema_1_validator: Optional[StrictStr] = Field(default=None, description="Simple capability name filter")
|
|
44
34
|
# data type: LLMToolFilterFilterInnerOneOf
|
|
45
35
|
oneof_schema_2_validator: Optional[LLMToolFilterFilterInnerOneOf] = None
|
|
46
36
|
actual_instance: Optional[Union[LLMToolFilterFilterInnerOneOf, str]] = None
|
|
47
|
-
one_of_schemas:
|
|
37
|
+
one_of_schemas: Set[str] = { "LLMToolFilterFilterInnerOneOf", "str" }
|
|
48
38
|
|
|
49
39
|
model_config = ConfigDict(
|
|
50
40
|
validate_assignment=True,
|
|
51
41
|
protected_namespaces=(),
|
|
52
42
|
)
|
|
53
43
|
|
|
44
|
+
|
|
54
45
|
def __init__(self, *args, **kwargs) -> None:
|
|
55
46
|
if args:
|
|
56
47
|
if len(args) > 1:
|
|
57
|
-
raise ValueError(
|
|
58
|
-
"If a position argument is used, only 1 is allowed to set `actual_instance`"
|
|
59
|
-
)
|
|
48
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
60
49
|
if kwargs:
|
|
61
|
-
raise ValueError(
|
|
62
|
-
"If a position argument is used, keyword arguments cannot be used."
|
|
63
|
-
)
|
|
50
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
64
51
|
super().__init__(actual_instance=args[0])
|
|
65
52
|
else:
|
|
66
53
|
super().__init__(**kwargs)
|
|
67
54
|
|
|
68
|
-
@field_validator(
|
|
55
|
+
@field_validator('actual_instance')
|
|
69
56
|
def actual_instance_must_validate_oneof(cls, v):
|
|
70
57
|
instance = LLMToolFilterFilterInner.model_construct()
|
|
71
58
|
error_messages = []
|
|
@@ -78,28 +65,20 @@ class LLMToolFilterFilterInner(BaseModel):
|
|
|
78
65
|
error_messages.append(str(e))
|
|
79
66
|
# validate data type: LLMToolFilterFilterInnerOneOf
|
|
80
67
|
if not isinstance(v, LLMToolFilterFilterInnerOneOf):
|
|
81
|
-
error_messages.append(
|
|
82
|
-
f"Error! Input type `{type(v)}` is not `LLMToolFilterFilterInnerOneOf`"
|
|
83
|
-
)
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LLMToolFilterFilterInnerOneOf`")
|
|
84
69
|
else:
|
|
85
70
|
match += 1
|
|
86
71
|
if match > 1:
|
|
87
72
|
# more than 1 match
|
|
88
|
-
raise ValueError(
|
|
89
|
-
"Multiple matches found when setting `actual_instance` in LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: "
|
|
90
|
-
+ ", ".join(error_messages)
|
|
91
|
-
)
|
|
73
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: " + ", ".join(error_messages))
|
|
92
74
|
elif match == 0:
|
|
93
75
|
# no match
|
|
94
|
-
raise ValueError(
|
|
95
|
-
"No match found when setting `actual_instance` in LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: "
|
|
96
|
-
+ ", ".join(error_messages)
|
|
97
|
-
)
|
|
76
|
+
raise ValueError("No match found when setting `actual_instance` in LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: " + ", ".join(error_messages))
|
|
98
77
|
else:
|
|
99
78
|
return v
|
|
100
79
|
|
|
101
80
|
@classmethod
|
|
102
|
-
def from_dict(cls, obj: Union[str,
|
|
81
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
103
82
|
return cls.from_json(json.dumps(obj))
|
|
104
83
|
|
|
105
84
|
@classmethod
|
|
@@ -127,16 +106,10 @@ class LLMToolFilterFilterInner(BaseModel):
|
|
|
127
106
|
|
|
128
107
|
if match > 1:
|
|
129
108
|
# more than 1 match
|
|
130
|
-
raise ValueError(
|
|
131
|
-
"Multiple matches found when deserializing the JSON string into LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: "
|
|
132
|
-
+ ", ".join(error_messages)
|
|
133
|
-
)
|
|
109
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: " + ", ".join(error_messages))
|
|
134
110
|
elif match == 0:
|
|
135
111
|
# no match
|
|
136
|
-
raise ValueError(
|
|
137
|
-
"No match found when deserializing the JSON string into LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: "
|
|
138
|
-
+ ", ".join(error_messages)
|
|
139
|
-
)
|
|
112
|
+
raise ValueError("No match found when deserializing the JSON string into LLMToolFilterFilterInner with oneOf schemas: LLMToolFilterFilterInnerOneOf, str. Details: " + ", ".join(error_messages))
|
|
140
113
|
else:
|
|
141
114
|
return instance
|
|
142
115
|
|
|
@@ -145,23 +118,17 @@ class LLMToolFilterFilterInner(BaseModel):
|
|
|
145
118
|
if self.actual_instance is None:
|
|
146
119
|
return "null"
|
|
147
120
|
|
|
148
|
-
if hasattr(self.actual_instance, "to_json") and callable(
|
|
149
|
-
self.actual_instance.to_json
|
|
150
|
-
):
|
|
121
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
151
122
|
return self.actual_instance.to_json()
|
|
152
123
|
else:
|
|
153
124
|
return json.dumps(self.actual_instance)
|
|
154
125
|
|
|
155
|
-
def to_dict(
|
|
156
|
-
self,
|
|
157
|
-
) -> Optional[Union[dict[str, Any], LLMToolFilterFilterInnerOneOf, str]]:
|
|
126
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], LLMToolFilterFilterInnerOneOf, str]]:
|
|
158
127
|
"""Returns the dict representation of the actual instance"""
|
|
159
128
|
if self.actual_instance is None:
|
|
160
129
|
return None
|
|
161
130
|
|
|
162
|
-
if hasattr(self.actual_instance, "to_dict") and callable(
|
|
163
|
-
self.actual_instance.to_dict
|
|
164
|
-
):
|
|
131
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
165
132
|
return self.actual_instance.to_dict()
|
|
166
133
|
else:
|
|
167
134
|
# primitive type
|
|
@@ -170,3 +137,5 @@ class LLMToolFilterFilterInner(BaseModel):
|
|
|
170
137
|
def to_str(self) -> str:
|
|
171
138
|
"""Returns the string representation of the actual instance"""
|
|
172
139
|
return pprint.pformat(self.model_dump())
|
|
140
|
+
|
|
141
|
+
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
1
3
|
"""
|
|
2
|
-
MCP Mesh Registry API
|
|
4
|
+
MCP Mesh Registry API
|
|
3
5
|
|
|
4
|
-
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
|
|
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
|
|
5
7
|
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
Contact: dhyanraj@gmail.com
|
|
8
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: dhyanraj@gmail.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
11
|
|
|
10
|
-
Do not edit the class manually.
|
|
12
|
+
Do not edit the class manually.
|
|
11
13
|
""" # noqa: E501
|
|
12
14
|
|
|
13
|
-
from __future__ import annotations
|
|
14
15
|
|
|
15
|
-
import
|
|
16
|
+
from __future__ import annotations
|
|
16
17
|
import pprint
|
|
17
18
|
import re # noqa: F401
|
|
18
|
-
|
|
19
|
+
import json
|
|
19
20
|
|
|
20
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
-
|
|
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
|
|
22
26
|
|
|
23
27
|
class LLMToolFilterFilterInnerOneOf(BaseModel):
|
|
24
28
|
"""
|
|
25
29
|
Rich filter with capability, tags, and version
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
description="Capability name to match"
|
|
30
|
-
)
|
|
31
|
-
tags: Optional[list[StrictStr]] = Field(
|
|
32
|
-
default=None, description="Tags for tag-based filtering (subset matching)"
|
|
33
|
-
)
|
|
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)")
|
|
34
33
|
version: Optional[StrictStr] = Field(default=None, description="Version constraint")
|
|
35
|
-
__properties: ClassVar[
|
|
34
|
+
__properties: ClassVar[List[str]] = ["capability", "tags", "version"]
|
|
36
35
|
|
|
37
36
|
model_config = ConfigDict(
|
|
38
37
|
populate_by_name=True,
|
|
@@ -40,6 +39,7 @@ class LLMToolFilterFilterInnerOneOf(BaseModel):
|
|
|
40
39
|
protected_namespaces=(),
|
|
41
40
|
)
|
|
42
41
|
|
|
42
|
+
|
|
43
43
|
def to_str(self) -> str:
|
|
44
44
|
"""Returns the string representation of the model using alias"""
|
|
45
45
|
return pprint.pformat(self.model_dump(by_alias=True))
|
|
@@ -54,7 +54,7 @@ class LLMToolFilterFilterInnerOneOf(BaseModel):
|
|
|
54
54
|
"""Create an instance of LLMToolFilterFilterInnerOneOf from a JSON string"""
|
|
55
55
|
return cls.from_dict(json.loads(json_str))
|
|
56
56
|
|
|
57
|
-
def to_dict(self) ->
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
58
|
"""Return the dictionary representation of the model using alias.
|
|
59
59
|
|
|
60
60
|
This has the following differences from calling pydantic's
|
|
@@ -64,7 +64,8 @@ class LLMToolFilterFilterInnerOneOf(BaseModel):
|
|
|
64
64
|
were set at model initialization. Other fields with value `None`
|
|
65
65
|
are ignored.
|
|
66
66
|
"""
|
|
67
|
-
excluded_fields:
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
68
69
|
|
|
69
70
|
_dict = self.model_dump(
|
|
70
71
|
by_alias=True,
|
|
@@ -74,7 +75,7 @@ class LLMToolFilterFilterInnerOneOf(BaseModel):
|
|
|
74
75
|
return _dict
|
|
75
76
|
|
|
76
77
|
@classmethod
|
|
77
|
-
def from_dict(cls, obj: Optional[
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
79
|
"""Create an instance of LLMToolFilterFilterInnerOneOf from a dict"""
|
|
79
80
|
if obj is None:
|
|
80
81
|
return None
|
|
@@ -82,11 +83,11 @@ class LLMToolFilterFilterInnerOneOf(BaseModel):
|
|
|
82
83
|
if not isinstance(obj, dict):
|
|
83
84
|
return cls.model_validate(obj)
|
|
84
85
|
|
|
85
|
-
_obj = cls.model_validate(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
)
|
|
86
|
+
_obj = cls.model_validate({
|
|
87
|
+
"capability": obj.get("capability"),
|
|
88
|
+
"tags": obj.get("tags"),
|
|
89
|
+
"version": obj.get("version")
|
|
90
|
+
})
|
|
92
91
|
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -1,60 +1,42 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
1
3
|
"""
|
|
2
|
-
MCP Mesh Registry API
|
|
4
|
+
MCP Mesh Registry API
|
|
3
5
|
|
|
4
|
-
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
|
|
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
|
|
5
7
|
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
Contact: dhyanraj@gmail.com
|
|
8
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: dhyanraj@gmail.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
11
|
|
|
10
|
-
Do not edit the class manually.
|
|
12
|
+
Do not edit the class manually.
|
|
11
13
|
""" # noqa: E501
|
|
12
14
|
|
|
13
|
-
from __future__ import annotations
|
|
14
15
|
|
|
15
|
-
import
|
|
16
|
+
from __future__ import annotations
|
|
16
17
|
import pprint
|
|
17
18
|
import re # noqa: F401
|
|
18
|
-
|
|
19
|
+
import json
|
|
19
20
|
|
|
20
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
-
|
|
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
|
|
22
26
|
|
|
23
27
|
class LLMToolInfo(BaseModel):
|
|
24
28
|
"""
|
|
25
|
-
Complete tool information for LLM consumption. Includes everything an LLM needs to understand and call the tool via MCP protocol.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
-
description: StrictStr = Field(
|
|
35
|
-
description="Human-readable tool description for LLM context"
|
|
36
|
-
)
|
|
37
|
-
input_schema: dict[str, Any] = Field(
|
|
38
|
-
description="JSON Schema for tool parameters (MCP format). LLM uses this to understand required and optional parameters. ",
|
|
39
|
-
alias="inputSchema",
|
|
40
|
-
)
|
|
41
|
-
tags: Optional[list[StrictStr]] = Field(default=None, description="Capability tags")
|
|
42
|
-
version: Optional[StrictStr] = Field(default="1.0.0", description="Tool version")
|
|
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")
|
|
43
37
|
endpoint: StrictStr = Field(description="Agent endpoint for MCP protocol calls")
|
|
44
|
-
kwargs: Optional[
|
|
45
|
-
|
|
46
|
-
description="Proxy configuration for tool execution (timeout, retry, streaming, etc.). Passed to UnifiedMCPProxy for enhanced client behavior. ",
|
|
47
|
-
)
|
|
48
|
-
__properties: ClassVar[list[str]] = [
|
|
49
|
-
"name",
|
|
50
|
-
"capability",
|
|
51
|
-
"description",
|
|
52
|
-
"inputSchema",
|
|
53
|
-
"tags",
|
|
54
|
-
"version",
|
|
55
|
-
"endpoint",
|
|
56
|
-
"kwargs",
|
|
57
|
-
]
|
|
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"]
|
|
58
40
|
|
|
59
41
|
model_config = ConfigDict(
|
|
60
42
|
populate_by_name=True,
|
|
@@ -62,6 +44,7 @@ class LLMToolInfo(BaseModel):
|
|
|
62
44
|
protected_namespaces=(),
|
|
63
45
|
)
|
|
64
46
|
|
|
47
|
+
|
|
65
48
|
def to_str(self) -> str:
|
|
66
49
|
"""Returns the string representation of the model using alias"""
|
|
67
50
|
return pprint.pformat(self.model_dump(by_alias=True))
|
|
@@ -76,7 +59,7 @@ class LLMToolInfo(BaseModel):
|
|
|
76
59
|
"""Create an instance of LLMToolInfo from a JSON string"""
|
|
77
60
|
return cls.from_dict(json.loads(json_str))
|
|
78
61
|
|
|
79
|
-
def to_dict(self) ->
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
80
63
|
"""Return the dictionary representation of the model using alias.
|
|
81
64
|
|
|
82
65
|
This has the following differences from calling pydantic's
|
|
@@ -86,7 +69,8 @@ class LLMToolInfo(BaseModel):
|
|
|
86
69
|
were set at model initialization. Other fields with value `None`
|
|
87
70
|
are ignored.
|
|
88
71
|
"""
|
|
89
|
-
excluded_fields:
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
90
74
|
|
|
91
75
|
_dict = self.model_dump(
|
|
92
76
|
by_alias=True,
|
|
@@ -96,7 +80,7 @@ class LLMToolInfo(BaseModel):
|
|
|
96
80
|
return _dict
|
|
97
81
|
|
|
98
82
|
@classmethod
|
|
99
|
-
def from_dict(cls, obj: Optional[
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
100
84
|
"""Create an instance of LLMToolInfo from a dict"""
|
|
101
85
|
if obj is None:
|
|
102
86
|
return None
|
|
@@ -104,18 +88,16 @@ class LLMToolInfo(BaseModel):
|
|
|
104
88
|
if not isinstance(obj, dict):
|
|
105
89
|
return cls.model_validate(obj)
|
|
106
90
|
|
|
107
|
-
_obj = cls.model_validate(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"endpoint": obj.get("endpoint"),
|
|
118
|
-
"kwargs": obj.get("kwargs"),
|
|
119
|
-
}
|
|
120
|
-
)
|
|
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
|
+
})
|
|
121
101
|
return _obj
|
|
102
|
+
|
|
103
|
+
|
|
@@ -1,89 +1,60 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
1
3
|
"""
|
|
2
|
-
MCP Mesh Registry API
|
|
4
|
+
MCP Mesh Registry API
|
|
3
5
|
|
|
4
|
-
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
|
|
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
|
|
5
7
|
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
Contact: dhyanraj@gmail.com
|
|
8
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: dhyanraj@gmail.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
11
|
|
|
10
|
-
Do not edit the class manually.
|
|
12
|
+
Do not edit the class manually.
|
|
11
13
|
""" # noqa: E501
|
|
12
14
|
|
|
13
|
-
from __future__ import annotations
|
|
14
15
|
|
|
15
|
-
import
|
|
16
|
+
from __future__ import annotations
|
|
16
17
|
import pprint
|
|
17
18
|
import re # noqa: F401
|
|
18
|
-
|
|
19
|
-
from typing import Annotated, Any, ClassVar, Dict, List, Optional, Self, Set
|
|
19
|
+
import json
|
|
20
20
|
|
|
21
|
+
from datetime import datetime
|
|
21
22
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
|
22
|
-
|
|
23
|
-
from
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
24
|
+
from typing_extensions import Annotated
|
|
25
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_tool_registration import MeshToolRegistration
|
|
26
|
+
from typing import Optional, Set
|
|
27
|
+
from typing_extensions import Self
|
|
27
28
|
|
|
28
29
|
class MeshAgentRegistration(BaseModel):
|
|
29
30
|
"""
|
|
30
|
-
Service registration request with flattened structure. Used by both /agents/register and /heartbeat endpoints. Supports both agents (agent_type=mcp_agent) and API services (agent_type=api).
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
version: Optional[StrictStr] = Field(default="1.0.0", description="Agent version")
|
|
46
|
-
http_host: Optional[StrictStr] = Field(
|
|
47
|
-
default="0.0.0.0", description="HTTP host for agent endpoint"
|
|
48
|
-
)
|
|
49
|
-
http_port: Optional[StrictInt] = Field(
|
|
50
|
-
default=0, description="HTTP port for agent endpoint (0 for stdio)"
|
|
51
|
-
)
|
|
52
|
-
timestamp: Optional[datetime] = Field(
|
|
53
|
-
default=None, description="Registration/heartbeat timestamp"
|
|
54
|
-
)
|
|
55
|
-
namespace: Optional[StrictStr] = Field(
|
|
56
|
-
default="default", description="Agent namespace for organization"
|
|
57
|
-
)
|
|
58
|
-
tools: Annotated[list[MeshToolRegistration], Field(min_length=1)] = Field(
|
|
59
|
-
description="Array of tools provided by this agent (@mesh.tool functions). Tools can optionally include llm_filter if decorated with @mesh.llm. "
|
|
60
|
-
)
|
|
61
|
-
__properties: ClassVar[list[str]] = [
|
|
62
|
-
"agent_id",
|
|
63
|
-
"agent_type",
|
|
64
|
-
"name",
|
|
65
|
-
"version",
|
|
66
|
-
"http_host",
|
|
67
|
-
"http_port",
|
|
68
|
-
"timestamp",
|
|
69
|
-
"namespace",
|
|
70
|
-
"tools",
|
|
71
|
-
]
|
|
72
|
-
|
|
73
|
-
@field_validator("agent_id")
|
|
31
|
+
Service registration request with flattened structure. Used by both /agents/register and /heartbeat endpoints. Supports both agents (agent_type=mcp_agent) and API services (agent_type=api).
|
|
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
|
+
agent_type: Optional[StrictStr] = Field(default='mcp_agent', description="Type of service - mcp_agent provides capabilities, api consumes them")
|
|
35
|
+
name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=64)]] = Field(default=None, description="Human-readable agent name (defaults to agent_id)")
|
|
36
|
+
version: Optional[StrictStr] = Field(default='1.0.0', description="Agent version")
|
|
37
|
+
http_host: Optional[StrictStr] = Field(default='0.0.0.0', description="HTTP host for agent endpoint")
|
|
38
|
+
http_port: Optional[StrictInt] = Field(default=0, description="HTTP port for agent endpoint (0 for stdio)")
|
|
39
|
+
timestamp: Optional[datetime] = Field(default=None, description="Registration/heartbeat timestamp")
|
|
40
|
+
namespace: Optional[StrictStr] = Field(default='default', description="Agent namespace for organization")
|
|
41
|
+
tools: Annotated[List[MeshToolRegistration], Field(min_length=1)] = Field(description="Array of tools provided by this agent (@mesh.tool functions). Tools can optionally include llm_filter if decorated with @mesh.llm. ")
|
|
42
|
+
__properties: ClassVar[List[str]] = ["agent_id", "agent_type", "name", "version", "http_host", "http_port", "timestamp", "namespace", "tools"]
|
|
43
|
+
|
|
44
|
+
@field_validator('agent_id')
|
|
74
45
|
def agent_id_validate_regular_expression(cls, value):
|
|
75
46
|
"""Validates the regular expression"""
|
|
76
47
|
if not re.match(r"^[a-zA-Z0-9_-]+$", value):
|
|
77
48
|
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9_-]+$/")
|
|
78
49
|
return value
|
|
79
50
|
|
|
80
|
-
@field_validator(
|
|
51
|
+
@field_validator('agent_type')
|
|
81
52
|
def agent_type_validate_enum(cls, value):
|
|
82
53
|
"""Validates the enum"""
|
|
83
54
|
if value is None:
|
|
84
55
|
return value
|
|
85
56
|
|
|
86
|
-
if value not in set([
|
|
57
|
+
if value not in set(['mcp_agent', 'api']):
|
|
87
58
|
raise ValueError("must be one of enum values ('mcp_agent', 'api')")
|
|
88
59
|
return value
|
|
89
60
|
|
|
@@ -93,6 +64,7 @@ class MeshAgentRegistration(BaseModel):
|
|
|
93
64
|
protected_namespaces=(),
|
|
94
65
|
)
|
|
95
66
|
|
|
67
|
+
|
|
96
68
|
def to_str(self) -> str:
|
|
97
69
|
"""Returns the string representation of the model using alias"""
|
|
98
70
|
return pprint.pformat(self.model_dump(by_alias=True))
|
|
@@ -107,7 +79,7 @@ class MeshAgentRegistration(BaseModel):
|
|
|
107
79
|
"""Create an instance of MeshAgentRegistration from a JSON string"""
|
|
108
80
|
return cls.from_dict(json.loads(json_str))
|
|
109
81
|
|
|
110
|
-
def to_dict(self) ->
|
|
82
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
111
83
|
"""Return the dictionary representation of the model using alias.
|
|
112
84
|
|
|
113
85
|
This has the following differences from calling pydantic's
|
|
@@ -117,7 +89,8 @@ class MeshAgentRegistration(BaseModel):
|
|
|
117
89
|
were set at model initialization. Other fields with value `None`
|
|
118
90
|
are ignored.
|
|
119
91
|
"""
|
|
120
|
-
excluded_fields:
|
|
92
|
+
excluded_fields: Set[str] = set([
|
|
93
|
+
])
|
|
121
94
|
|
|
122
95
|
_dict = self.model_dump(
|
|
123
96
|
by_alias=True,
|
|
@@ -130,11 +103,11 @@ class MeshAgentRegistration(BaseModel):
|
|
|
130
103
|
for _item_tools in self.tools:
|
|
131
104
|
if _item_tools:
|
|
132
105
|
_items.append(_item_tools.to_dict())
|
|
133
|
-
_dict[
|
|
106
|
+
_dict['tools'] = _items
|
|
134
107
|
return _dict
|
|
135
108
|
|
|
136
109
|
@classmethod
|
|
137
|
-
def from_dict(cls, obj: Optional[
|
|
110
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
138
111
|
"""Create an instance of MeshAgentRegistration from a dict"""
|
|
139
112
|
if obj is None:
|
|
140
113
|
return None
|
|
@@ -142,37 +115,17 @@ class MeshAgentRegistration(BaseModel):
|
|
|
142
115
|
if not isinstance(obj, dict):
|
|
143
116
|
return cls.model_validate(obj)
|
|
144
117
|
|
|
145
|
-
_obj = cls.model_validate(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
),
|
|
157
|
-
"http_host": (
|
|
158
|
-
obj.get("http_host")
|
|
159
|
-
if obj.get("http_host") is not None
|
|
160
|
-
else "0.0.0.0"
|
|
161
|
-
),
|
|
162
|
-
"http_port": (
|
|
163
|
-
obj.get("http_port") if obj.get("http_port") is not None else 0
|
|
164
|
-
),
|
|
165
|
-
"timestamp": obj.get("timestamp"),
|
|
166
|
-
"namespace": (
|
|
167
|
-
obj.get("namespace")
|
|
168
|
-
if obj.get("namespace") is not None
|
|
169
|
-
else "default"
|
|
170
|
-
),
|
|
171
|
-
"tools": (
|
|
172
|
-
[MeshToolRegistration.from_dict(_item) for _item in obj["tools"]]
|
|
173
|
-
if obj.get("tools") is not None
|
|
174
|
-
else None
|
|
175
|
-
),
|
|
176
|
-
}
|
|
177
|
-
)
|
|
118
|
+
_obj = cls.model_validate({
|
|
119
|
+
"agent_id": obj.get("agent_id"),
|
|
120
|
+
"agent_type": obj.get("agent_type") if obj.get("agent_type") is not None else 'mcp_agent',
|
|
121
|
+
"name": obj.get("name"),
|
|
122
|
+
"version": obj.get("version") if obj.get("version") is not None else '1.0.0',
|
|
123
|
+
"http_host": obj.get("http_host") if obj.get("http_host") is not None else '0.0.0.0',
|
|
124
|
+
"http_port": obj.get("http_port") if obj.get("http_port") is not None else 0,
|
|
125
|
+
"timestamp": obj.get("timestamp"),
|
|
126
|
+
"namespace": obj.get("namespace") if obj.get("namespace") is not None else 'default',
|
|
127
|
+
"tools": [MeshToolRegistration.from_dict(_item) for _item in obj["tools"]] if obj.get("tools") is not None else None
|
|
128
|
+
})
|
|
178
129
|
return _obj
|
|
130
|
+
|
|
131
|
+
|