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.
- _mcp_mesh/__init__.py +1 -1
- _mcp_mesh/engine/dependency_injector.py +13 -15
- _mcp_mesh/engine/http_wrapper.py +69 -10
- _mcp_mesh/engine/mesh_llm_agent.py +29 -10
- _mcp_mesh/engine/mesh_llm_agent_injector.py +77 -41
- _mcp_mesh/engine/provider_handlers/__init__.py +14 -1
- _mcp_mesh/engine/provider_handlers/base_provider_handler.py +114 -8
- _mcp_mesh/engine/provider_handlers/claude_handler.py +15 -57
- _mcp_mesh/engine/provider_handlers/gemini_handler.py +181 -0
- _mcp_mesh/engine/provider_handlers/openai_handler.py +8 -63
- _mcp_mesh/engine/provider_handlers/provider_handler_registry.py +16 -10
- _mcp_mesh/engine/response_parser.py +61 -15
- _mcp_mesh/engine/signature_analyzer.py +58 -68
- _mcp_mesh/engine/unified_mcp_proxy.py +19 -35
- _mcp_mesh/pipeline/__init__.py +9 -20
- _mcp_mesh/pipeline/api_heartbeat/__init__.py +12 -7
- _mcp_mesh/pipeline/api_heartbeat/api_lifespan_integration.py +23 -49
- _mcp_mesh/pipeline/api_heartbeat/rust_api_heartbeat.py +429 -0
- _mcp_mesh/pipeline/api_startup/api_pipeline.py +7 -9
- _mcp_mesh/pipeline/api_startup/api_server_setup.py +91 -70
- _mcp_mesh/pipeline/api_startup/fastapi_discovery.py +22 -23
- _mcp_mesh/pipeline/api_startup/middleware_integration.py +32 -24
- _mcp_mesh/pipeline/api_startup/route_collection.py +2 -4
- _mcp_mesh/pipeline/mcp_heartbeat/__init__.py +5 -17
- _mcp_mesh/pipeline/mcp_heartbeat/rust_heartbeat.py +710 -0
- _mcp_mesh/pipeline/mcp_startup/__init__.py +2 -5
- _mcp_mesh/pipeline/mcp_startup/configuration.py +1 -1
- _mcp_mesh/pipeline/mcp_startup/fastapiserver_setup.py +31 -8
- _mcp_mesh/pipeline/mcp_startup/heartbeat_loop.py +6 -7
- _mcp_mesh/pipeline/mcp_startup/startup_orchestrator.py +23 -11
- _mcp_mesh/pipeline/mcp_startup/startup_pipeline.py +3 -8
- _mcp_mesh/pipeline/shared/mesh_pipeline.py +0 -2
- _mcp_mesh/reload.py +1 -3
- _mcp_mesh/shared/__init__.py +2 -8
- _mcp_mesh/shared/config_resolver.py +124 -80
- _mcp_mesh/shared/defaults.py +89 -14
- _mcp_mesh/shared/fastapi_middleware_manager.py +149 -91
- _mcp_mesh/shared/host_resolver.py +8 -46
- _mcp_mesh/shared/server_discovery.py +115 -86
- _mcp_mesh/shared/simple_shutdown.py +44 -86
- _mcp_mesh/tracing/execution_tracer.py +2 -6
- _mcp_mesh/tracing/redis_metadata_publisher.py +24 -79
- _mcp_mesh/tracing/trace_context_helper.py +3 -13
- _mcp_mesh/tracing/utils.py +29 -15
- _mcp_mesh/utils/fastmcp_schema_extractor.py +5 -4
- {mcp_mesh-0.7.20.dist-info → mcp_mesh-0.8.0.dist-info}/METADATA +7 -5
- mcp_mesh-0.8.0.dist-info/RECORD +85 -0
- mesh/__init__.py +12 -1
- mesh/decorators.py +248 -33
- mesh/helpers.py +52 -0
- mesh/types.py +40 -13
- _mcp_mesh/generated/.openapi-generator/FILES +0 -50
- _mcp_mesh/generated/.openapi-generator/VERSION +0 -1
- _mcp_mesh/generated/.openapi-generator-ignore +0 -15
- _mcp_mesh/generated/mcp_mesh_registry_client/__init__.py +0 -90
- _mcp_mesh/generated/mcp_mesh_registry_client/api/__init__.py +0 -6
- _mcp_mesh/generated/mcp_mesh_registry_client/api/agents_api.py +0 -1088
- _mcp_mesh/generated/mcp_mesh_registry_client/api/health_api.py +0 -764
- _mcp_mesh/generated/mcp_mesh_registry_client/api/tracing_api.py +0 -303
- _mcp_mesh/generated/mcp_mesh_registry_client/api_client.py +0 -798
- _mcp_mesh/generated/mcp_mesh_registry_client/api_response.py +0 -21
- _mcp_mesh/generated/mcp_mesh_registry_client/configuration.py +0 -577
- _mcp_mesh/generated/mcp_mesh_registry_client/exceptions.py +0 -217
- _mcp_mesh/generated/mcp_mesh_registry_client/models/__init__.py +0 -55
- _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_info.py +0 -158
- _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata.py +0 -126
- _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata_dependencies_inner.py +0 -139
- _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_metadata_dependencies_inner_one_of.py +0 -92
- _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_registration.py +0 -103
- _mcp_mesh/generated/mcp_mesh_registry_client/models/agent_registration_metadata.py +0 -136
- _mcp_mesh/generated/mcp_mesh_registry_client/models/agents_list_response.py +0 -100
- _mcp_mesh/generated/mcp_mesh_registry_client/models/capability_info.py +0 -107
- _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_agent_metadata.py +0 -112
- _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_agent_request.py +0 -103
- _mcp_mesh/generated/mcp_mesh_registry_client/models/decorator_info.py +0 -105
- _mcp_mesh/generated/mcp_mesh_registry_client/models/dependency_info.py +0 -103
- _mcp_mesh/generated/mcp_mesh_registry_client/models/dependency_resolution_info.py +0 -106
- _mcp_mesh/generated/mcp_mesh_registry_client/models/error_response.py +0 -91
- _mcp_mesh/generated/mcp_mesh_registry_client/models/health_response.py +0 -103
- _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_request.py +0 -101
- _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_request_metadata.py +0 -111
- _mcp_mesh/generated/mcp_mesh_registry_client/models/heartbeat_response.py +0 -117
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_provider.py +0 -93
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_provider_resolution_info.py +0 -106
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter.py +0 -109
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter_filter_inner.py +0 -139
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_filter_filter_inner_one_of.py +0 -91
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_info.py +0 -101
- _mcp_mesh/generated/mcp_mesh_registry_client/models/llm_tool_resolution_info.py +0 -120
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_agent_register_metadata.py +0 -112
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_agent_registration.py +0 -129
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_registration_response.py +0 -153
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_registration_response_dependencies_resolved_value_inner.py +0 -101
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_dependency_registration.py +0 -93
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_register_metadata.py +0 -107
- _mcp_mesh/generated/mcp_mesh_registry_client/models/mesh_tool_registration.py +0 -117
- _mcp_mesh/generated/mcp_mesh_registry_client/models/registration_response.py +0 -119
- _mcp_mesh/generated/mcp_mesh_registry_client/models/resolved_llm_provider.py +0 -110
- _mcp_mesh/generated/mcp_mesh_registry_client/models/rich_dependency.py +0 -93
- _mcp_mesh/generated/mcp_mesh_registry_client/models/root_response.py +0 -92
- _mcp_mesh/generated/mcp_mesh_registry_client/models/standardized_dependency.py +0 -93
- _mcp_mesh/generated/mcp_mesh_registry_client/models/trace_event.py +0 -106
- _mcp_mesh/generated/mcp_mesh_registry_client/py.typed +0 -0
- _mcp_mesh/generated/mcp_mesh_registry_client/rest.py +0 -259
- _mcp_mesh/pipeline/api_heartbeat/api_dependency_resolution.py +0 -418
- _mcp_mesh/pipeline/api_heartbeat/api_fast_heartbeat_check.py +0 -117
- _mcp_mesh/pipeline/api_heartbeat/api_health_check.py +0 -140
- _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_orchestrator.py +0 -247
- _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_pipeline.py +0 -311
- _mcp_mesh/pipeline/api_heartbeat/api_heartbeat_send.py +0 -386
- _mcp_mesh/pipeline/api_heartbeat/api_registry_connection.py +0 -104
- _mcp_mesh/pipeline/mcp_heartbeat/dependency_resolution.py +0 -396
- _mcp_mesh/pipeline/mcp_heartbeat/fast_heartbeat_check.py +0 -116
- _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_orchestrator.py +0 -311
- _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_pipeline.py +0 -282
- _mcp_mesh/pipeline/mcp_heartbeat/heartbeat_send.py +0 -98
- _mcp_mesh/pipeline/mcp_heartbeat/lifespan_integration.py +0 -84
- _mcp_mesh/pipeline/mcp_heartbeat/llm_tools_resolution.py +0 -264
- _mcp_mesh/pipeline/mcp_heartbeat/registry_connection.py +0 -79
- _mcp_mesh/pipeline/shared/registry_connection.py +0 -80
- _mcp_mesh/shared/registry_client_wrapper.py +0 -515
- mcp_mesh-0.7.20.dist-info/RECORD +0 -152
- {mcp_mesh-0.7.20.dist-info → mcp_mesh-0.8.0.dist-info}/WHEEL +0 -0
- {mcp_mesh-0.7.20.dist-info → mcp_mesh-0.8.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,129 +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, StrictInt, StrictStr, field_validator
|
|
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
|
|
28
|
-
|
|
29
|
-
class MeshAgentRegistration(BaseModel):
|
|
30
|
-
"""
|
|
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')
|
|
45
|
-
def agent_id_validate_regular_expression(cls, value):
|
|
46
|
-
"""Validates the regular expression"""
|
|
47
|
-
if not re.match(r"^[a-zA-Z0-9_-]+$", value):
|
|
48
|
-
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9_-]+$/")
|
|
49
|
-
return value
|
|
50
|
-
|
|
51
|
-
@field_validator('agent_type')
|
|
52
|
-
def agent_type_validate_enum(cls, value):
|
|
53
|
-
"""Validates the enum"""
|
|
54
|
-
if value is None:
|
|
55
|
-
return value
|
|
56
|
-
|
|
57
|
-
if value not in set(['mcp_agent', 'api']):
|
|
58
|
-
raise ValueError("must be one of enum values ('mcp_agent', 'api')")
|
|
59
|
-
return value
|
|
60
|
-
|
|
61
|
-
model_config = ConfigDict(
|
|
62
|
-
populate_by_name=True,
|
|
63
|
-
validate_assignment=True,
|
|
64
|
-
protected_namespaces=(),
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def to_str(self) -> str:
|
|
69
|
-
"""Returns the string representation of the model using alias"""
|
|
70
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
71
|
-
|
|
72
|
-
def to_json(self) -> str:
|
|
73
|
-
"""Returns the JSON representation of the model using alias"""
|
|
74
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
75
|
-
return json.dumps(self.to_dict())
|
|
76
|
-
|
|
77
|
-
@classmethod
|
|
78
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
79
|
-
"""Create an instance of MeshAgentRegistration from a JSON string"""
|
|
80
|
-
return cls.from_dict(json.loads(json_str))
|
|
81
|
-
|
|
82
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
83
|
-
"""Return the dictionary representation of the model using alias.
|
|
84
|
-
|
|
85
|
-
This has the following differences from calling pydantic's
|
|
86
|
-
`self.model_dump(by_alias=True)`:
|
|
87
|
-
|
|
88
|
-
* `None` is only added to the output dict for nullable fields that
|
|
89
|
-
were set at model initialization. Other fields with value `None`
|
|
90
|
-
are ignored.
|
|
91
|
-
"""
|
|
92
|
-
excluded_fields: Set[str] = set([
|
|
93
|
-
])
|
|
94
|
-
|
|
95
|
-
_dict = self.model_dump(
|
|
96
|
-
by_alias=True,
|
|
97
|
-
exclude=excluded_fields,
|
|
98
|
-
exclude_none=True,
|
|
99
|
-
)
|
|
100
|
-
# override the default output from pydantic by calling `to_dict()` of each item in tools (list)
|
|
101
|
-
_items = []
|
|
102
|
-
if self.tools:
|
|
103
|
-
for _item_tools in self.tools:
|
|
104
|
-
if _item_tools:
|
|
105
|
-
_items.append(_item_tools.to_dict())
|
|
106
|
-
_dict['tools'] = _items
|
|
107
|
-
return _dict
|
|
108
|
-
|
|
109
|
-
@classmethod
|
|
110
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
111
|
-
"""Create an instance of MeshAgentRegistration from a dict"""
|
|
112
|
-
if obj is None:
|
|
113
|
-
return None
|
|
114
|
-
|
|
115
|
-
if not isinstance(obj, dict):
|
|
116
|
-
return cls.model_validate(obj)
|
|
117
|
-
|
|
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
|
-
})
|
|
129
|
-
return _obj
|
|
@@ -1,153 +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, StrictStr, field_validator
|
|
23
|
-
from typing import Any, ClassVar, Dict, List, Optional
|
|
24
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_info import LLMToolInfo
|
|
25
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_registration_response_dependencies_resolved_value_inner import MeshRegistrationResponseDependenciesResolvedValueInner
|
|
26
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.resolved_llm_provider import ResolvedLLMProvider
|
|
27
|
-
from typing import Optional, Set
|
|
28
|
-
from typing_extensions import Self
|
|
29
|
-
|
|
30
|
-
class MeshRegistrationResponse(BaseModel):
|
|
31
|
-
"""
|
|
32
|
-
Response for both registration and heartbeat requests
|
|
33
|
-
""" # noqa: E501
|
|
34
|
-
status: StrictStr
|
|
35
|
-
timestamp: datetime
|
|
36
|
-
message: StrictStr
|
|
37
|
-
agent_id: StrictStr = Field(description="Confirmed agent ID")
|
|
38
|
-
dependencies_resolved: Optional[Dict[str, List[MeshRegistrationResponseDependenciesResolvedValueInner]]] = Field(default=None, description="Function name to array of resolved dependencies mapping. 🤖 AI NOTE: This enables immediate dependency injection setup. ")
|
|
39
|
-
llm_tools: Optional[Dict[str, List[LLMToolInfo]]] = Field(default=None, description="Map of function_name to filtered tool list for LLM agents. Enables LLM agents to receive auto-filtered, up-to-date tool lists based on llm_filter in tool registration. 🤖 AI NOTE: This is populated only when tool includes llm_filter. Registry applies filtering logic and returns matching tools with full schemas. ")
|
|
40
|
-
llm_providers: Optional[Dict[str, ResolvedLLMProvider]] = Field(default=None, description="Map of function_name to resolved LLM provider for mesh delegation. Populated only when tool includes llm_provider specification. Registry resolves matching LLM provider agent based on capability/tags/version. 🤖 AI NOTE: This enables LLM mesh delegation (v0.6.1 feature). ")
|
|
41
|
-
__properties: ClassVar[List[str]] = ["status", "timestamp", "message", "agent_id", "dependencies_resolved", "llm_tools", "llm_providers"]
|
|
42
|
-
|
|
43
|
-
@field_validator('status')
|
|
44
|
-
def status_validate_enum(cls, value):
|
|
45
|
-
"""Validates the enum"""
|
|
46
|
-
if value not in set(['success', 'error']):
|
|
47
|
-
raise ValueError("must be one of enum values ('success', 'error')")
|
|
48
|
-
return value
|
|
49
|
-
|
|
50
|
-
model_config = ConfigDict(
|
|
51
|
-
populate_by_name=True,
|
|
52
|
-
validate_assignment=True,
|
|
53
|
-
protected_namespaces=(),
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def to_str(self) -> str:
|
|
58
|
-
"""Returns the string representation of the model using alias"""
|
|
59
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
60
|
-
|
|
61
|
-
def to_json(self) -> str:
|
|
62
|
-
"""Returns the JSON representation of the model using alias"""
|
|
63
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
64
|
-
return json.dumps(self.to_dict())
|
|
65
|
-
|
|
66
|
-
@classmethod
|
|
67
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
68
|
-
"""Create an instance of MeshRegistrationResponse from a JSON string"""
|
|
69
|
-
return cls.from_dict(json.loads(json_str))
|
|
70
|
-
|
|
71
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
72
|
-
"""Return the dictionary representation of the model using alias.
|
|
73
|
-
|
|
74
|
-
This has the following differences from calling pydantic's
|
|
75
|
-
`self.model_dump(by_alias=True)`:
|
|
76
|
-
|
|
77
|
-
* `None` is only added to the output dict for nullable fields that
|
|
78
|
-
were set at model initialization. Other fields with value `None`
|
|
79
|
-
are ignored.
|
|
80
|
-
"""
|
|
81
|
-
excluded_fields: Set[str] = set([
|
|
82
|
-
])
|
|
83
|
-
|
|
84
|
-
_dict = self.model_dump(
|
|
85
|
-
by_alias=True,
|
|
86
|
-
exclude=excluded_fields,
|
|
87
|
-
exclude_none=True,
|
|
88
|
-
)
|
|
89
|
-
# override the default output from pydantic by calling `to_dict()` of each value in dependencies_resolved (dict of array)
|
|
90
|
-
_field_dict_of_array = {}
|
|
91
|
-
if self.dependencies_resolved:
|
|
92
|
-
for _key_dependencies_resolved in self.dependencies_resolved:
|
|
93
|
-
if self.dependencies_resolved[_key_dependencies_resolved] is not None:
|
|
94
|
-
_field_dict_of_array[_key_dependencies_resolved] = [
|
|
95
|
-
_item.to_dict() for _item in self.dependencies_resolved[_key_dependencies_resolved]
|
|
96
|
-
]
|
|
97
|
-
_dict['dependencies_resolved'] = _field_dict_of_array
|
|
98
|
-
# override the default output from pydantic by calling `to_dict()` of each value in llm_tools (dict of array)
|
|
99
|
-
_field_dict_of_array = {}
|
|
100
|
-
if self.llm_tools:
|
|
101
|
-
for _key_llm_tools in self.llm_tools:
|
|
102
|
-
if self.llm_tools[_key_llm_tools] is not None:
|
|
103
|
-
_field_dict_of_array[_key_llm_tools] = [
|
|
104
|
-
_item.to_dict() for _item in self.llm_tools[_key_llm_tools]
|
|
105
|
-
]
|
|
106
|
-
_dict['llm_tools'] = _field_dict_of_array
|
|
107
|
-
# override the default output from pydantic by calling `to_dict()` of each value in llm_providers (dict)
|
|
108
|
-
_field_dict = {}
|
|
109
|
-
if self.llm_providers:
|
|
110
|
-
for _key_llm_providers in self.llm_providers:
|
|
111
|
-
if self.llm_providers[_key_llm_providers]:
|
|
112
|
-
_field_dict[_key_llm_providers] = self.llm_providers[_key_llm_providers].to_dict()
|
|
113
|
-
_dict['llm_providers'] = _field_dict
|
|
114
|
-
return _dict
|
|
115
|
-
|
|
116
|
-
@classmethod
|
|
117
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
118
|
-
"""Create an instance of MeshRegistrationResponse from a dict"""
|
|
119
|
-
if obj is None:
|
|
120
|
-
return None
|
|
121
|
-
|
|
122
|
-
if not isinstance(obj, dict):
|
|
123
|
-
return cls.model_validate(obj)
|
|
124
|
-
|
|
125
|
-
_obj = cls.model_validate({
|
|
126
|
-
"status": obj.get("status"),
|
|
127
|
-
"timestamp": obj.get("timestamp"),
|
|
128
|
-
"message": obj.get("message"),
|
|
129
|
-
"agent_id": obj.get("agent_id"),
|
|
130
|
-
"dependencies_resolved": dict(
|
|
131
|
-
(_k,
|
|
132
|
-
[MeshRegistrationResponseDependenciesResolvedValueInner.from_dict(_item) for _item in _v]
|
|
133
|
-
if _v is not None
|
|
134
|
-
else None
|
|
135
|
-
)
|
|
136
|
-
for _k, _v in obj.get("dependencies_resolved", {}).items()
|
|
137
|
-
),
|
|
138
|
-
"llm_tools": dict(
|
|
139
|
-
(_k,
|
|
140
|
-
[LLMToolInfo.from_dict(_item) for _item in _v]
|
|
141
|
-
if _v is not None
|
|
142
|
-
else None
|
|
143
|
-
)
|
|
144
|
-
for _k, _v in obj.get("llm_tools", {}).items()
|
|
145
|
-
),
|
|
146
|
-
"llm_providers": dict(
|
|
147
|
-
(_k, ResolvedLLMProvider.from_dict(_v))
|
|
148
|
-
for _k, _v in obj["llm_providers"].items()
|
|
149
|
-
)
|
|
150
|
-
if obj.get("llm_providers") is not None
|
|
151
|
-
else None
|
|
152
|
-
})
|
|
153
|
-
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, field_validator
|
|
22
|
-
from typing import Any, ClassVar, Dict, List
|
|
23
|
-
from typing import Optional, Set
|
|
24
|
-
from typing_extensions import Self
|
|
25
|
-
|
|
26
|
-
class MeshRegistrationResponseDependenciesResolvedValueInner(BaseModel):
|
|
27
|
-
"""
|
|
28
|
-
MeshRegistrationResponseDependenciesResolvedValueInner
|
|
29
|
-
""" # noqa: E501
|
|
30
|
-
agent_id: StrictStr = Field(description="ID of the agent providing the dependency")
|
|
31
|
-
function_name: StrictStr = Field(description="Actual function name to call on provider")
|
|
32
|
-
endpoint: StrictStr = Field(description="Endpoint to connect to the provider")
|
|
33
|
-
capability: StrictStr = Field(description="Capability name for dependency matching")
|
|
34
|
-
status: StrictStr = Field(description="Current status of the dependency")
|
|
35
|
-
__properties: ClassVar[List[str]] = ["agent_id", "function_name", "endpoint", "capability", "status"]
|
|
36
|
-
|
|
37
|
-
@field_validator('status')
|
|
38
|
-
def status_validate_enum(cls, value):
|
|
39
|
-
"""Validates the enum"""
|
|
40
|
-
if value not in set(['available', 'unavailable', 'degraded']):
|
|
41
|
-
raise ValueError("must be one of enum values ('available', 'unavailable', 'degraded')")
|
|
42
|
-
return value
|
|
43
|
-
|
|
44
|
-
model_config = ConfigDict(
|
|
45
|
-
populate_by_name=True,
|
|
46
|
-
validate_assignment=True,
|
|
47
|
-
protected_namespaces=(),
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def to_str(self) -> str:
|
|
52
|
-
"""Returns the string representation of the model using alias"""
|
|
53
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
54
|
-
|
|
55
|
-
def to_json(self) -> str:
|
|
56
|
-
"""Returns the JSON representation of the model using alias"""
|
|
57
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
58
|
-
return json.dumps(self.to_dict())
|
|
59
|
-
|
|
60
|
-
@classmethod
|
|
61
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
-
"""Create an instance of MeshRegistrationResponseDependenciesResolvedValueInner from a JSON string"""
|
|
63
|
-
return cls.from_dict(json.loads(json_str))
|
|
64
|
-
|
|
65
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
-
"""Return the dictionary representation of the model using alias.
|
|
67
|
-
|
|
68
|
-
This has the following differences from calling pydantic's
|
|
69
|
-
`self.model_dump(by_alias=True)`:
|
|
70
|
-
|
|
71
|
-
* `None` is only added to the output dict for nullable fields that
|
|
72
|
-
were set at model initialization. Other fields with value `None`
|
|
73
|
-
are ignored.
|
|
74
|
-
"""
|
|
75
|
-
excluded_fields: Set[str] = set([
|
|
76
|
-
])
|
|
77
|
-
|
|
78
|
-
_dict = self.model_dump(
|
|
79
|
-
by_alias=True,
|
|
80
|
-
exclude=excluded_fields,
|
|
81
|
-
exclude_none=True,
|
|
82
|
-
)
|
|
83
|
-
return _dict
|
|
84
|
-
|
|
85
|
-
@classmethod
|
|
86
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
|
-
"""Create an instance of MeshRegistrationResponseDependenciesResolvedValueInner from a dict"""
|
|
88
|
-
if obj is None:
|
|
89
|
-
return None
|
|
90
|
-
|
|
91
|
-
if not isinstance(obj, dict):
|
|
92
|
-
return cls.model_validate(obj)
|
|
93
|
-
|
|
94
|
-
_obj = cls.model_validate({
|
|
95
|
-
"agent_id": obj.get("agent_id"),
|
|
96
|
-
"function_name": obj.get("function_name"),
|
|
97
|
-
"endpoint": obj.get("endpoint"),
|
|
98
|
-
"capability": obj.get("capability"),
|
|
99
|
-
"status": obj.get("status")
|
|
100
|
-
})
|
|
101
|
-
return _obj
|
|
@@ -1,93 +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 MeshToolDependencyRegistration(BaseModel):
|
|
28
|
-
"""
|
|
29
|
-
Dependency specification for a tool function
|
|
30
|
-
""" # noqa: E501
|
|
31
|
-
capability: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Required capability name")
|
|
32
|
-
tags: Optional[List[StrictStr]] = Field(default=None, description="Tags for smart matching")
|
|
33
|
-
version: Optional[StrictStr] = Field(default=None, description="Version constraint")
|
|
34
|
-
namespace: Optional[StrictStr] = Field(default='default', description="Namespace filter")
|
|
35
|
-
__properties: ClassVar[List[str]] = ["capability", "tags", "version", "namespace"]
|
|
36
|
-
|
|
37
|
-
model_config = ConfigDict(
|
|
38
|
-
populate_by_name=True,
|
|
39
|
-
validate_assignment=True,
|
|
40
|
-
protected_namespaces=(),
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def to_str(self) -> str:
|
|
45
|
-
"""Returns the string representation of the model using alias"""
|
|
46
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
-
|
|
48
|
-
def to_json(self) -> str:
|
|
49
|
-
"""Returns the JSON representation of the model using alias"""
|
|
50
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
51
|
-
return json.dumps(self.to_dict())
|
|
52
|
-
|
|
53
|
-
@classmethod
|
|
54
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
-
"""Create an instance of MeshToolDependencyRegistration from a JSON string"""
|
|
56
|
-
return cls.from_dict(json.loads(json_str))
|
|
57
|
-
|
|
58
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
-
"""Return the dictionary representation of the model using alias.
|
|
60
|
-
|
|
61
|
-
This has the following differences from calling pydantic's
|
|
62
|
-
`self.model_dump(by_alias=True)`:
|
|
63
|
-
|
|
64
|
-
* `None` is only added to the output dict for nullable fields that
|
|
65
|
-
were set at model initialization. Other fields with value `None`
|
|
66
|
-
are ignored.
|
|
67
|
-
"""
|
|
68
|
-
excluded_fields: Set[str] = set([
|
|
69
|
-
])
|
|
70
|
-
|
|
71
|
-
_dict = self.model_dump(
|
|
72
|
-
by_alias=True,
|
|
73
|
-
exclude=excluded_fields,
|
|
74
|
-
exclude_none=True,
|
|
75
|
-
)
|
|
76
|
-
return _dict
|
|
77
|
-
|
|
78
|
-
@classmethod
|
|
79
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
-
"""Create an instance of MeshToolDependencyRegistration from a dict"""
|
|
81
|
-
if obj is None:
|
|
82
|
-
return None
|
|
83
|
-
|
|
84
|
-
if not isinstance(obj, dict):
|
|
85
|
-
return cls.model_validate(obj)
|
|
86
|
-
|
|
87
|
-
_obj = cls.model_validate({
|
|
88
|
-
"capability": obj.get("capability"),
|
|
89
|
-
"tags": obj.get("tags"),
|
|
90
|
-
"version": obj.get("version"),
|
|
91
|
-
"namespace": obj.get("namespace") if obj.get("namespace") is not None else 'default'
|
|
92
|
-
})
|
|
93
|
-
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.standardized_dependency import StandardizedDependency
|
|
25
|
-
from typing import Optional, Set
|
|
26
|
-
from typing_extensions import Self
|
|
27
|
-
|
|
28
|
-
class MeshToolRegisterMetadata(BaseModel):
|
|
29
|
-
"""
|
|
30
|
-
Metadata for a single @mesh.tool decorated function
|
|
31
|
-
""" # noqa: E501
|
|
32
|
-
function_name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Name of the decorated function")
|
|
33
|
-
capability: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Capability provided by this function")
|
|
34
|
-
version: Optional[StrictStr] = Field(default='1.0.0', description="Function/capability version")
|
|
35
|
-
tags: Optional[List[StrictStr]] = Field(default=None, description="Tags for this capability")
|
|
36
|
-
dependencies: Optional[List[StandardizedDependency]] = Field(default=None, description="Dependencies required by this function")
|
|
37
|
-
description: Optional[StrictStr] = Field(default=None, description="Function description")
|
|
38
|
-
kwargs: Optional[Dict[str, Any]] = Field(default=None, description="Additional kwargs from @mesh.tool decorator for enhanced client proxy configuration. Supports timeout, retry_count, custom_headers, streaming, auth_required, etc. ")
|
|
39
|
-
__properties: ClassVar[List[str]] = ["function_name", "capability", "version", "tags", "dependencies", "description", "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 MeshToolRegisterMetadata 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
|
-
# override the default output from pydantic by calling `to_dict()` of each item in dependencies (list)
|
|
81
|
-
_items = []
|
|
82
|
-
if self.dependencies:
|
|
83
|
-
for _item_dependencies in self.dependencies:
|
|
84
|
-
if _item_dependencies:
|
|
85
|
-
_items.append(_item_dependencies.to_dict())
|
|
86
|
-
_dict['dependencies'] = _items
|
|
87
|
-
return _dict
|
|
88
|
-
|
|
89
|
-
@classmethod
|
|
90
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
91
|
-
"""Create an instance of MeshToolRegisterMetadata 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
|
-
"function_name": obj.get("function_name"),
|
|
100
|
-
"capability": obj.get("capability"),
|
|
101
|
-
"version": obj.get("version") if obj.get("version") is not None else '1.0.0',
|
|
102
|
-
"tags": obj.get("tags"),
|
|
103
|
-
"dependencies": [StandardizedDependency.from_dict(_item) for _item in obj["dependencies"]] if obj.get("dependencies") is not None else None,
|
|
104
|
-
"description": obj.get("description"),
|
|
105
|
-
"kwargs": obj.get("kwargs")
|
|
106
|
-
})
|
|
107
|
-
return _obj
|