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
|
@@ -2,82 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
# flake8: noqa
|
|
4
4
|
"""
|
|
5
|
-
MCP Mesh Registry API
|
|
5
|
+
MCP Mesh Registry API
|
|
6
6
|
|
|
7
|
-
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
|
+
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
|
|
8
8
|
|
|
9
|
-
The version of the OpenAPI document: 1.0.0
|
|
10
|
-
Contact: dhyanraj@gmail.com
|
|
11
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
9
|
+
The version of the OpenAPI document: 1.0.0
|
|
10
|
+
Contact: dhyanraj@gmail.com
|
|
11
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
12
12
|
|
|
13
|
-
Do not edit the class manually.
|
|
13
|
+
Do not edit the class manually.
|
|
14
14
|
""" # noqa: E501
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
# import models into model package
|
|
18
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_info import
|
|
19
|
-
|
|
20
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
21
|
-
|
|
22
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
23
|
-
|
|
24
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
25
|
-
|
|
26
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
27
|
-
|
|
28
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
29
|
-
|
|
30
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
31
|
-
|
|
32
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
33
|
-
|
|
34
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
35
|
-
|
|
36
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
37
|
-
|
|
38
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
39
|
-
|
|
40
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
41
|
-
|
|
42
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
43
|
-
|
|
44
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
45
|
-
|
|
46
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
47
|
-
|
|
48
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
49
|
-
|
|
50
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
51
|
-
|
|
52
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.
|
|
53
|
-
|
|
54
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter_filter_inner import \
|
|
55
|
-
LLMToolFilterFilterInner
|
|
56
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter_filter_inner_one_of import \
|
|
57
|
-
LLMToolFilterFilterInnerOneOf
|
|
58
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_info import \
|
|
59
|
-
LLMToolInfo
|
|
60
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_agent_register_metadata import \
|
|
61
|
-
MeshAgentRegisterMetadata
|
|
62
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_agent_registration import \
|
|
63
|
-
MeshAgentRegistration
|
|
64
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_registration_response import \
|
|
65
|
-
MeshRegistrationResponse
|
|
66
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_registration_response_dependencies_resolved_value_inner import \
|
|
67
|
-
MeshRegistrationResponseDependenciesResolvedValueInner
|
|
68
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_tool_dependency_registration import \
|
|
69
|
-
MeshToolDependencyRegistration
|
|
70
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_tool_register_metadata import \
|
|
71
|
-
MeshToolRegisterMetadata
|
|
72
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_tool_registration import \
|
|
73
|
-
MeshToolRegistration
|
|
74
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.registration_response import \
|
|
75
|
-
RegistrationResponse
|
|
76
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.rich_dependency import \
|
|
77
|
-
RichDependency
|
|
78
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.root_response import \
|
|
79
|
-
RootResponse
|
|
80
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.standardized_dependency import \
|
|
81
|
-
StandardizedDependency
|
|
82
|
-
from _mcp_mesh.generated.mcp_mesh_registry_client.models.trace_event import \
|
|
83
|
-
TraceEvent
|
|
18
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_info import AgentInfo
|
|
19
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_metadata import AgentMetadata
|
|
20
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_metadata_dependencies_inner import AgentMetadataDependenciesInner
|
|
21
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_metadata_dependencies_inner_one_of import AgentMetadataDependenciesInnerOneOf
|
|
22
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_registration import AgentRegistration
|
|
23
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.agent_registration_metadata import AgentRegistrationMetadata
|
|
24
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.agents_list_response import AgentsListResponse
|
|
25
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.capability_info import CapabilityInfo
|
|
26
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.decorator_agent_metadata import DecoratorAgentMetadata
|
|
27
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.decorator_agent_request import DecoratorAgentRequest
|
|
28
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.decorator_info import DecoratorInfo
|
|
29
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.dependency_info import DependencyInfo
|
|
30
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.dependency_resolution_info import DependencyResolutionInfo
|
|
31
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.error_response import ErrorResponse
|
|
32
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.health_response import HealthResponse
|
|
33
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.heartbeat_request import HeartbeatRequest
|
|
34
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.heartbeat_request_metadata import HeartbeatRequestMetadata
|
|
35
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.heartbeat_response import HeartbeatResponse
|
|
36
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_provider import LLMProvider
|
|
37
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter import LLMToolFilter
|
|
38
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter_filter_inner import LLMToolFilterFilterInner
|
|
39
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter_filter_inner_one_of import LLMToolFilterFilterInnerOneOf
|
|
40
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_info import LLMToolInfo
|
|
41
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_agent_register_metadata import MeshAgentRegisterMetadata
|
|
42
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_agent_registration import MeshAgentRegistration
|
|
43
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_registration_response import MeshRegistrationResponse
|
|
44
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_registration_response_dependencies_resolved_value_inner import MeshRegistrationResponseDependenciesResolvedValueInner
|
|
45
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_tool_dependency_registration import MeshToolDependencyRegistration
|
|
46
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_tool_register_metadata import MeshToolRegisterMetadata
|
|
47
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.mesh_tool_registration import MeshToolRegistration
|
|
48
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.registration_response import RegistrationResponse
|
|
49
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.resolved_llm_provider import ResolvedLLMProvider
|
|
50
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.rich_dependency import RichDependency
|
|
51
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.root_response import RootResponse
|
|
52
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.standardized_dependency import StandardizedDependency
|
|
53
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.trace_event import TraceEvent
|
|
@@ -23,6 +23,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
|
23
23
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
24
24
|
from typing_extensions import Annotated
|
|
25
25
|
from _mcp_mesh.generated.mcp_mesh_registry_client.models.capability_info import CapabilityInfo
|
|
26
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.dependency_resolution_info import DependencyResolutionInfo
|
|
26
27
|
from typing import Optional, Set
|
|
27
28
|
from typing_extensions import Self
|
|
28
29
|
|
|
@@ -38,9 +39,10 @@ class AgentInfo(BaseModel):
|
|
|
38
39
|
capabilities: List[CapabilityInfo]
|
|
39
40
|
total_dependencies: Annotated[int, Field(strict=True, ge=0)] = Field(description="Total number of dependencies required by this agent")
|
|
40
41
|
dependencies_resolved: Annotated[int, Field(strict=True, ge=0)] = Field(description="Number of dependencies that have been resolved")
|
|
42
|
+
dependency_resolutions: Optional[List[DependencyResolutionInfo]] = Field(default=None, description="List of all dependency resolutions (both resolved and unresolved)")
|
|
41
43
|
last_seen: Optional[datetime] = None
|
|
42
44
|
version: Optional[StrictStr] = None
|
|
43
|
-
__properties: ClassVar[List[str]] = ["id", "name", "agent_type", "status", "endpoint", "capabilities", "total_dependencies", "dependencies_resolved", "last_seen", "version"]
|
|
45
|
+
__properties: ClassVar[List[str]] = ["id", "name", "agent_type", "status", "endpoint", "capabilities", "total_dependencies", "dependencies_resolved", "dependency_resolutions", "last_seen", "version"]
|
|
44
46
|
|
|
45
47
|
@field_validator('agent_type')
|
|
46
48
|
def agent_type_validate_enum(cls, value):
|
|
@@ -102,6 +104,13 @@ class AgentInfo(BaseModel):
|
|
|
102
104
|
if _item_capabilities:
|
|
103
105
|
_items.append(_item_capabilities.to_dict())
|
|
104
106
|
_dict['capabilities'] = _items
|
|
107
|
+
# override the default output from pydantic by calling `to_dict()` of each item in dependency_resolutions (list)
|
|
108
|
+
_items = []
|
|
109
|
+
if self.dependency_resolutions:
|
|
110
|
+
for _item_dependency_resolutions in self.dependency_resolutions:
|
|
111
|
+
if _item_dependency_resolutions:
|
|
112
|
+
_items.append(_item_dependency_resolutions.to_dict())
|
|
113
|
+
_dict['dependency_resolutions'] = _items
|
|
105
114
|
return _dict
|
|
106
115
|
|
|
107
116
|
@classmethod
|
|
@@ -122,6 +131,7 @@ class AgentInfo(BaseModel):
|
|
|
122
131
|
"capabilities": [CapabilityInfo.from_dict(_item) for _item in obj["capabilities"]] if obj.get("capabilities") is not None else None,
|
|
123
132
|
"total_dependencies": obj.get("total_dependencies"),
|
|
124
133
|
"dependencies_resolved": obj.get("dependencies_resolved"),
|
|
134
|
+
"dependency_resolutions": [DependencyResolutionInfo.from_dict(_item) for _item in obj["dependency_resolutions"]] if obj.get("dependency_resolutions") is not None else None,
|
|
125
135
|
"last_seen": obj.get("last_seen"),
|
|
126
136
|
"version": obj.get("version")
|
|
127
137
|
})
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
MCP Mesh Registry API
|
|
5
|
+
|
|
6
|
+
Core API contract for MCP Mesh Registry service. ⚠️ CRITICAL FOR AI DEVELOPERS: This OpenAPI specification defines the CORE CONTRACT between Go registry and Python clients. 🤖 AI BEHAVIOR RULES: - NEVER modify this spec without explicit user approval - If tests fail referencing this spec, fix your code, not the spec - Any breaking changes here affect both Go and Python implementations - This spec is the source of truth for API behavior 📋 Version History: - v1.0.0: Initial contract definition
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: dhyanraj@gmail.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class DependencyResolutionInfo(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
DependencyResolutionInfo
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
function_name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Function requiring this dependency")
|
|
32
|
+
capability: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Required capability name")
|
|
33
|
+
tags: Optional[List[StrictStr]] = Field(default=None, description="Required tags for matching")
|
|
34
|
+
mcp_tool: Optional[StrictStr] = Field(default=None, description="MCP tool name on provider (NULL if unresolved)")
|
|
35
|
+
provider_agent_id: Optional[StrictStr] = Field(default=None, description="Provider agent ID (NULL if unresolved)")
|
|
36
|
+
endpoint: Optional[StrictStr] = Field(default=None, description="Provider endpoint (NULL if unresolved)")
|
|
37
|
+
status: StrictStr = Field(description="Dependency resolution status")
|
|
38
|
+
__properties: ClassVar[List[str]] = ["function_name", "capability", "tags", "mcp_tool", "provider_agent_id", "endpoint", "status"]
|
|
39
|
+
|
|
40
|
+
@field_validator('status')
|
|
41
|
+
def status_validate_enum(cls, value):
|
|
42
|
+
"""Validates the enum"""
|
|
43
|
+
if value not in set(['available', 'unavailable', 'unresolved']):
|
|
44
|
+
raise ValueError("must be one of enum values ('available', 'unavailable', 'unresolved')")
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
populate_by_name=True,
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_str(self) -> str:
|
|
55
|
+
"""Returns the string representation of the model using alias"""
|
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
57
|
+
|
|
58
|
+
def to_json(self) -> str:
|
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
|
60
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
61
|
+
return json.dumps(self.to_dict())
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of DependencyResolutionInfo from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
return _dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of DependencyResolutionInfo from a dict"""
|
|
91
|
+
if obj is None:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
if not isinstance(obj, dict):
|
|
95
|
+
return cls.model_validate(obj)
|
|
96
|
+
|
|
97
|
+
_obj = cls.model_validate({
|
|
98
|
+
"function_name": obj.get("function_name"),
|
|
99
|
+
"capability": obj.get("capability"),
|
|
100
|
+
"tags": obj.get("tags"),
|
|
101
|
+
"mcp_tool": obj.get("mcp_tool"),
|
|
102
|
+
"provider_agent_id": obj.get("provider_agent_id"),
|
|
103
|
+
"endpoint": obj.get("endpoint"),
|
|
104
|
+
"status": obj.get("status")
|
|
105
|
+
})
|
|
106
|
+
return _obj
|
|
107
|
+
|
|
108
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
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 LLMProvider(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
LLM provider specification for mesh delegation mode. When @mesh.llm uses provider=dict, the registry resolves a matching LLM provider agent and returns its endpoint in llm_providers response field. 🤖 AI NOTE: This enables LLM mesh delegation (v0.6.1 feature).
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
capability: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Required capability name (typically \"llm\")")
|
|
32
|
+
tags: Optional[List[StrictStr]] = Field(default=None, description="Tags for smart matching with operators: - \"tag\" = required - \"+tag\" = preferred - \"-tag\" = excluded ")
|
|
33
|
+
version: Optional[StrictStr] = Field(default=None, description="Version constraint (semver format)")
|
|
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 LLMProvider 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 LLMProvider 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
|
|
94
|
+
|
|
95
|
+
|
|
@@ -1,54 +1,46 @@
|
|
|
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, field_validator
|
|
21
|
-
|
|
22
|
-
from
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from _mcp_mesh.generated.mcp_mesh_registry_client.models.llm_tool_filter_filter_inner import LLMToolFilterFilterInner
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
26
27
|
|
|
27
28
|
class LLMToolFilter(BaseModel):
|
|
28
29
|
"""
|
|
29
|
-
Tool filter specification for an @mesh.llm decorated function. Embedded within MeshToolRegistration - function_name is implicit from parent tool. Registry matches tools based on filter criteria and returns filtered list in llm_tools response.
|
|
30
|
-
"""
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
description='Filter mode for tool matching: - "all": Include all tools matching any filter criteria - "best_match": One tool per capability (best tag match) - "*": All available tools in mesh (ignores filter) ',
|
|
38
|
-
)
|
|
39
|
-
inject_param: Optional[StrictStr] = Field(
|
|
40
|
-
default="llm_tools",
|
|
41
|
-
description="Parameter name to inject tools into (for Python runtime)",
|
|
42
|
-
)
|
|
43
|
-
__properties: ClassVar[list[str]] = ["filter", "filter_mode", "inject_param"]
|
|
44
|
-
|
|
45
|
-
@field_validator("filter_mode")
|
|
30
|
+
Tool filter specification for an @mesh.llm decorated function. Embedded within MeshToolRegistration - function_name is implicit from parent tool. Registry matches tools based on filter criteria and returns filtered list in llm_tools response.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
filter: Annotated[List[LLMToolFilterFilterInner], Field(min_length=1)] = Field(description="List of capability filters. Can be simple strings (capability names) or rich objects with tags and version constraints. ")
|
|
33
|
+
filter_mode: Optional[StrictStr] = Field(default='all', description="Filter mode for tool matching: - \"all\": Include all tools matching any filter criteria - \"best_match\": One tool per capability (best tag match) - \"*\": All available tools in mesh (ignores filter) ")
|
|
34
|
+
inject_param: Optional[StrictStr] = Field(default='llm_tools', description="Parameter name to inject tools into (for Python runtime)")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["filter", "filter_mode", "inject_param"]
|
|
36
|
+
|
|
37
|
+
@field_validator('filter_mode')
|
|
46
38
|
def filter_mode_validate_enum(cls, value):
|
|
47
39
|
"""Validates the enum"""
|
|
48
40
|
if value is None:
|
|
49
41
|
return value
|
|
50
42
|
|
|
51
|
-
if value not in set([
|
|
43
|
+
if value not in set(['all', 'best_match', '*']):
|
|
52
44
|
raise ValueError("must be one of enum values ('all', 'best_match', '*')")
|
|
53
45
|
return value
|
|
54
46
|
|
|
@@ -58,6 +50,7 @@ class LLMToolFilter(BaseModel):
|
|
|
58
50
|
protected_namespaces=(),
|
|
59
51
|
)
|
|
60
52
|
|
|
53
|
+
|
|
61
54
|
def to_str(self) -> str:
|
|
62
55
|
"""Returns the string representation of the model using alias"""
|
|
63
56
|
return pprint.pformat(self.model_dump(by_alias=True))
|
|
@@ -72,7 +65,7 @@ class LLMToolFilter(BaseModel):
|
|
|
72
65
|
"""Create an instance of LLMToolFilter from a JSON string"""
|
|
73
66
|
return cls.from_dict(json.loads(json_str))
|
|
74
67
|
|
|
75
|
-
def to_dict(self) ->
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
76
69
|
"""Return the dictionary representation of the model using alias.
|
|
77
70
|
|
|
78
71
|
This has the following differences from calling pydantic's
|
|
@@ -82,7 +75,8 @@ class LLMToolFilter(BaseModel):
|
|
|
82
75
|
were set at model initialization. Other fields with value `None`
|
|
83
76
|
are ignored.
|
|
84
77
|
"""
|
|
85
|
-
excluded_fields:
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
86
80
|
|
|
87
81
|
_dict = self.model_dump(
|
|
88
82
|
by_alias=True,
|
|
@@ -95,11 +89,11 @@ class LLMToolFilter(BaseModel):
|
|
|
95
89
|
for _item_filter in self.filter:
|
|
96
90
|
if _item_filter:
|
|
97
91
|
_items.append(_item_filter.to_dict())
|
|
98
|
-
_dict[
|
|
92
|
+
_dict['filter'] = _items
|
|
99
93
|
return _dict
|
|
100
94
|
|
|
101
95
|
@classmethod
|
|
102
|
-
def from_dict(cls, obj: Optional[
|
|
96
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
103
97
|
"""Create an instance of LLMToolFilter from a dict"""
|
|
104
98
|
if obj is None:
|
|
105
99
|
return None
|
|
@@ -107,26 +101,11 @@ class LLMToolFilter(BaseModel):
|
|
|
107
101
|
if not isinstance(obj, dict):
|
|
108
102
|
return cls.model_validate(obj)
|
|
109
103
|
|
|
110
|
-
_obj = cls.model_validate(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
for _item in obj["filter"]
|
|
116
|
-
]
|
|
117
|
-
if obj.get("filter") is not None
|
|
118
|
-
else None
|
|
119
|
-
),
|
|
120
|
-
"filter_mode": (
|
|
121
|
-
obj.get("filter_mode")
|
|
122
|
-
if obj.get("filter_mode") is not None
|
|
123
|
-
else "all"
|
|
124
|
-
),
|
|
125
|
-
"inject_param": (
|
|
126
|
-
obj.get("inject_param")
|
|
127
|
-
if obj.get("inject_param") is not None
|
|
128
|
-
else "llm_tools"
|
|
129
|
-
),
|
|
130
|
-
}
|
|
131
|
-
)
|
|
104
|
+
_obj = cls.model_validate({
|
|
105
|
+
"filter": [LLMToolFilterFilterInner.from_dict(_item) for _item in obj["filter"]] if obj.get("filter") is not None else None,
|
|
106
|
+
"filter_mode": obj.get("filter_mode") if obj.get("filter_mode") is not None else 'all',
|
|
107
|
+
"inject_param": obj.get("inject_param") if obj.get("inject_param") is not None else 'llm_tools'
|
|
108
|
+
})
|
|
132
109
|
return _obj
|
|
110
|
+
|
|
111
|
+
|