letta-client 0.1.67__py3-none-any.whl → 0.1.69__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.
Potentially problematic release.
This version of letta-client might be problematic. Click here for more details.
- letta_client/__init__.py +11 -3
- letta_client/agents/client.py +26 -12
- letta_client/core/client_wrapper.py +1 -1
- letta_client/tools/__init__.py +12 -2
- letta_client/tools/client.py +270 -2
- letta_client/tools/types/__init__.py +9 -1
- letta_client/tools/types/add_mcp_server_request.py +7 -0
- letta_client/tools/types/add_mcp_server_response_item.py +7 -0
- letta_client/tools/types/delete_mcp_server_response_item.py +7 -0
- letta_client/tools/types/list_mcp_servers_response_value.py +2 -2
- letta_client/types/__init__.py +2 -2
- letta_client/types/mcp_server_type.py +1 -1
- letta_client/types/{local_server_config.py → stdio_server_config.py} +6 -1
- {letta_client-0.1.67.dist-info → letta_client-0.1.69.dist-info}/METADATA +1 -1
- {letta_client-0.1.67.dist-info → letta_client-0.1.69.dist-info}/RECORD +16 -13
- {letta_client-0.1.67.dist-info → letta_client-0.1.69.dist-info}/WHEEL +0 -0
letta_client/__init__.py
CHANGED
|
@@ -116,7 +116,6 @@ from .types import (
|
|
|
116
116
|
LlmConfig,
|
|
117
117
|
LlmConfigModelEndpointType,
|
|
118
118
|
LocalSandboxConfig,
|
|
119
|
-
LocalServerConfig,
|
|
120
119
|
ManagerType,
|
|
121
120
|
McpServerType,
|
|
122
121
|
McpTool,
|
|
@@ -153,6 +152,7 @@ from .types import (
|
|
|
153
152
|
SandboxType,
|
|
154
153
|
Source,
|
|
155
154
|
SseServerConfig,
|
|
155
|
+
StdioServerConfig,
|
|
156
156
|
Step,
|
|
157
157
|
SupervisorManager,
|
|
158
158
|
SystemMessage,
|
|
@@ -593,7 +593,12 @@ from .templates import (
|
|
|
593
593
|
TemplatesCreateAgentsResponseAgentsItemUpdatedAt,
|
|
594
594
|
TemplatesCreateAgentsResponseAgentsItemUpdatedAtItem,
|
|
595
595
|
)
|
|
596
|
-
from .tools import
|
|
596
|
+
from .tools import (
|
|
597
|
+
AddMcpServerRequest,
|
|
598
|
+
AddMcpServerResponseItem,
|
|
599
|
+
DeleteMcpServerResponseItem,
|
|
600
|
+
ListMcpServersResponseValue,
|
|
601
|
+
)
|
|
597
602
|
from .version import __version__
|
|
598
603
|
from .voice import CreateVoiceChatCompletionsRequest
|
|
599
604
|
|
|
@@ -601,6 +606,8 @@ __all__ = [
|
|
|
601
606
|
"ActionModel",
|
|
602
607
|
"ActionParametersModel",
|
|
603
608
|
"ActionResponseModel",
|
|
609
|
+
"AddMcpServerRequest",
|
|
610
|
+
"AddMcpServerResponseItem",
|
|
604
611
|
"AgentEnvironmentVariable",
|
|
605
612
|
"AgentState",
|
|
606
613
|
"AgentStateToolRulesItem",
|
|
@@ -866,6 +873,7 @@ __all__ = [
|
|
|
866
873
|
"CreateAgentRequestToolRulesItem",
|
|
867
874
|
"CreateBlock",
|
|
868
875
|
"CreateVoiceChatCompletionsRequest",
|
|
876
|
+
"DeleteMcpServerResponseItem",
|
|
869
877
|
"DynamicManager",
|
|
870
878
|
"E2BSandboxConfig",
|
|
871
879
|
"EmbeddingConfig",
|
|
@@ -912,7 +920,6 @@ __all__ = [
|
|
|
912
920
|
"LlmConfig",
|
|
913
921
|
"LlmConfigModelEndpointType",
|
|
914
922
|
"LocalSandboxConfig",
|
|
915
|
-
"LocalServerConfig",
|
|
916
923
|
"ManagerType",
|
|
917
924
|
"McpServerType",
|
|
918
925
|
"McpTool",
|
|
@@ -950,6 +957,7 @@ __all__ = [
|
|
|
950
957
|
"SandboxType",
|
|
951
958
|
"Source",
|
|
952
959
|
"SseServerConfig",
|
|
960
|
+
"StdioServerConfig",
|
|
953
961
|
"Step",
|
|
954
962
|
"SupervisorManager",
|
|
955
963
|
"SystemMessage",
|
letta_client/agents/client.py
CHANGED
|
@@ -75,11 +75,14 @@ class AgentsClient:
|
|
|
75
75
|
base_template_id: typing.Optional[str] = None,
|
|
76
76
|
identity_id: typing.Optional[str] = None,
|
|
77
77
|
identifier_keys: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
78
|
+
include_relationships: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
78
79
|
request_options: typing.Optional[RequestOptions] = None,
|
|
79
80
|
) -> typing.List[AgentState]:
|
|
80
81
|
"""
|
|
81
82
|
List all agents associated with a given user.
|
|
82
|
-
|
|
83
|
+
|
|
84
|
+
This endpoint retrieves a list of all agents and their configurations
|
|
85
|
+
associated with the specified user ID.
|
|
83
86
|
|
|
84
87
|
Parameters
|
|
85
88
|
----------
|
|
@@ -90,7 +93,7 @@ class AgentsClient:
|
|
|
90
93
|
List of tags to filter agents by
|
|
91
94
|
|
|
92
95
|
match_all_tags : typing.Optional[bool]
|
|
93
|
-
If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed
|
|
96
|
+
If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed-in tags.
|
|
94
97
|
|
|
95
98
|
before : typing.Optional[str]
|
|
96
99
|
Cursor for pagination
|
|
@@ -105,20 +108,23 @@ class AgentsClient:
|
|
|
105
108
|
Search agents by name
|
|
106
109
|
|
|
107
110
|
project_id : typing.Optional[str]
|
|
108
|
-
Search agents by project
|
|
111
|
+
Search agents by project ID
|
|
109
112
|
|
|
110
113
|
template_id : typing.Optional[str]
|
|
111
|
-
Search agents by template
|
|
114
|
+
Search agents by template ID
|
|
112
115
|
|
|
113
116
|
base_template_id : typing.Optional[str]
|
|
114
|
-
Search agents by base template
|
|
117
|
+
Search agents by base template ID
|
|
115
118
|
|
|
116
119
|
identity_id : typing.Optional[str]
|
|
117
|
-
Search agents by
|
|
120
|
+
Search agents by identity ID
|
|
118
121
|
|
|
119
122
|
identifier_keys : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
120
123
|
Search agents by identifier keys
|
|
121
124
|
|
|
125
|
+
include_relationships : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
126
|
+
Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include in the response. If not provided, all relationships are loaded by default. Using this can optimize performance by reducing unnecessary joins.
|
|
127
|
+
|
|
122
128
|
request_options : typing.Optional[RequestOptions]
|
|
123
129
|
Request-specific configuration.
|
|
124
130
|
|
|
@@ -152,6 +158,7 @@ class AgentsClient:
|
|
|
152
158
|
"base_template_id": base_template_id,
|
|
153
159
|
"identity_id": identity_id,
|
|
154
160
|
"identifier_keys": identifier_keys,
|
|
161
|
+
"include_relationships": include_relationships,
|
|
155
162
|
},
|
|
156
163
|
request_options=request_options,
|
|
157
164
|
)
|
|
@@ -1144,11 +1151,14 @@ class AsyncAgentsClient:
|
|
|
1144
1151
|
base_template_id: typing.Optional[str] = None,
|
|
1145
1152
|
identity_id: typing.Optional[str] = None,
|
|
1146
1153
|
identifier_keys: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
1154
|
+
include_relationships: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
1147
1155
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1148
1156
|
) -> typing.List[AgentState]:
|
|
1149
1157
|
"""
|
|
1150
1158
|
List all agents associated with a given user.
|
|
1151
|
-
|
|
1159
|
+
|
|
1160
|
+
This endpoint retrieves a list of all agents and their configurations
|
|
1161
|
+
associated with the specified user ID.
|
|
1152
1162
|
|
|
1153
1163
|
Parameters
|
|
1154
1164
|
----------
|
|
@@ -1159,7 +1169,7 @@ class AsyncAgentsClient:
|
|
|
1159
1169
|
List of tags to filter agents by
|
|
1160
1170
|
|
|
1161
1171
|
match_all_tags : typing.Optional[bool]
|
|
1162
|
-
If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed
|
|
1172
|
+
If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed-in tags.
|
|
1163
1173
|
|
|
1164
1174
|
before : typing.Optional[str]
|
|
1165
1175
|
Cursor for pagination
|
|
@@ -1174,20 +1184,23 @@ class AsyncAgentsClient:
|
|
|
1174
1184
|
Search agents by name
|
|
1175
1185
|
|
|
1176
1186
|
project_id : typing.Optional[str]
|
|
1177
|
-
Search agents by project
|
|
1187
|
+
Search agents by project ID
|
|
1178
1188
|
|
|
1179
1189
|
template_id : typing.Optional[str]
|
|
1180
|
-
Search agents by template
|
|
1190
|
+
Search agents by template ID
|
|
1181
1191
|
|
|
1182
1192
|
base_template_id : typing.Optional[str]
|
|
1183
|
-
Search agents by base template
|
|
1193
|
+
Search agents by base template ID
|
|
1184
1194
|
|
|
1185
1195
|
identity_id : typing.Optional[str]
|
|
1186
|
-
Search agents by
|
|
1196
|
+
Search agents by identity ID
|
|
1187
1197
|
|
|
1188
1198
|
identifier_keys : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
1189
1199
|
Search agents by identifier keys
|
|
1190
1200
|
|
|
1201
|
+
include_relationships : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
1202
|
+
Specify which relational fields (e.g., 'tools', 'sources', 'memory') to include in the response. If not provided, all relationships are loaded by default. Using this can optimize performance by reducing unnecessary joins.
|
|
1203
|
+
|
|
1191
1204
|
request_options : typing.Optional[RequestOptions]
|
|
1192
1205
|
Request-specific configuration.
|
|
1193
1206
|
|
|
@@ -1229,6 +1242,7 @@ class AsyncAgentsClient:
|
|
|
1229
1242
|
"base_template_id": base_template_id,
|
|
1230
1243
|
"identity_id": identity_id,
|
|
1231
1244
|
"identifier_keys": identifier_keys,
|
|
1245
|
+
"include_relationships": include_relationships,
|
|
1232
1246
|
},
|
|
1233
1247
|
request_options=request_options,
|
|
1234
1248
|
)
|
|
@@ -16,7 +16,7 @@ class BaseClientWrapper:
|
|
|
16
16
|
headers: typing.Dict[str, str] = {
|
|
17
17
|
"X-Fern-Language": "Python",
|
|
18
18
|
"X-Fern-SDK-Name": "letta-client",
|
|
19
|
-
"X-Fern-SDK-Version": "0.1.
|
|
19
|
+
"X-Fern-SDK-Version": "0.1.69",
|
|
20
20
|
}
|
|
21
21
|
if self.token is not None:
|
|
22
22
|
headers["Authorization"] = f"Bearer {self.token}"
|
letta_client/tools/__init__.py
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from .types import
|
|
3
|
+
from .types import (
|
|
4
|
+
AddMcpServerRequest,
|
|
5
|
+
AddMcpServerResponseItem,
|
|
6
|
+
DeleteMcpServerResponseItem,
|
|
7
|
+
ListMcpServersResponseValue,
|
|
8
|
+
)
|
|
4
9
|
|
|
5
|
-
__all__ = [
|
|
10
|
+
__all__ = [
|
|
11
|
+
"AddMcpServerRequest",
|
|
12
|
+
"AddMcpServerResponseItem",
|
|
13
|
+
"DeleteMcpServerResponseItem",
|
|
14
|
+
"ListMcpServersResponseValue",
|
|
15
|
+
]
|
letta_client/tools/client.py
CHANGED
|
@@ -14,7 +14,11 @@ from ..types.tool_return_message import ToolReturnMessage
|
|
|
14
14
|
from ..types.app_model import AppModel
|
|
15
15
|
from ..types.action_model import ActionModel
|
|
16
16
|
from .types.list_mcp_servers_response_value import ListMcpServersResponseValue
|
|
17
|
+
from .types.add_mcp_server_request import AddMcpServerRequest
|
|
18
|
+
from .types.add_mcp_server_response_item import AddMcpServerResponseItem
|
|
19
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
17
20
|
from ..types.mcp_tool import McpTool
|
|
21
|
+
from .types.delete_mcp_server_response_item import DeleteMcpServerResponseItem
|
|
18
22
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
19
23
|
|
|
20
24
|
# this is used as the default value for optional parameters
|
|
@@ -872,6 +876,72 @@ class ToolsClient:
|
|
|
872
876
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
873
877
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
874
878
|
|
|
879
|
+
def add_mcp_server(
|
|
880
|
+
self, *, request: AddMcpServerRequest, request_options: typing.Optional[RequestOptions] = None
|
|
881
|
+
) -> typing.List[AddMcpServerResponseItem]:
|
|
882
|
+
"""
|
|
883
|
+
Add a new MCP server to the Letta MCP server config
|
|
884
|
+
|
|
885
|
+
Parameters
|
|
886
|
+
----------
|
|
887
|
+
request : AddMcpServerRequest
|
|
888
|
+
|
|
889
|
+
request_options : typing.Optional[RequestOptions]
|
|
890
|
+
Request-specific configuration.
|
|
891
|
+
|
|
892
|
+
Returns
|
|
893
|
+
-------
|
|
894
|
+
typing.List[AddMcpServerResponseItem]
|
|
895
|
+
Successful Response
|
|
896
|
+
|
|
897
|
+
Examples
|
|
898
|
+
--------
|
|
899
|
+
from letta_client import Letta, StdioServerConfig
|
|
900
|
+
|
|
901
|
+
client = Letta(
|
|
902
|
+
token="YOUR_TOKEN",
|
|
903
|
+
)
|
|
904
|
+
client.tools.add_mcp_server(
|
|
905
|
+
request=StdioServerConfig(
|
|
906
|
+
server_name="server_name",
|
|
907
|
+
command="command",
|
|
908
|
+
args=["args"],
|
|
909
|
+
),
|
|
910
|
+
)
|
|
911
|
+
"""
|
|
912
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
913
|
+
"v1/tools/mcp/servers",
|
|
914
|
+
method="PUT",
|
|
915
|
+
json=convert_and_respect_annotation_metadata(
|
|
916
|
+
object_=request, annotation=AddMcpServerRequest, direction="write"
|
|
917
|
+
),
|
|
918
|
+
request_options=request_options,
|
|
919
|
+
omit=OMIT,
|
|
920
|
+
)
|
|
921
|
+
try:
|
|
922
|
+
if 200 <= _response.status_code < 300:
|
|
923
|
+
return typing.cast(
|
|
924
|
+
typing.List[AddMcpServerResponseItem],
|
|
925
|
+
construct_type(
|
|
926
|
+
type_=typing.List[AddMcpServerResponseItem], # type: ignore
|
|
927
|
+
object_=_response.json(),
|
|
928
|
+
),
|
|
929
|
+
)
|
|
930
|
+
if _response.status_code == 422:
|
|
931
|
+
raise UnprocessableEntityError(
|
|
932
|
+
typing.cast(
|
|
933
|
+
HttpValidationError,
|
|
934
|
+
construct_type(
|
|
935
|
+
type_=HttpValidationError, # type: ignore
|
|
936
|
+
object_=_response.json(),
|
|
937
|
+
),
|
|
938
|
+
)
|
|
939
|
+
)
|
|
940
|
+
_response_json = _response.json()
|
|
941
|
+
except JSONDecodeError:
|
|
942
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
943
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
944
|
+
|
|
875
945
|
def list_mcp_tools_by_server(
|
|
876
946
|
self, mcp_server_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
877
947
|
) -> typing.List[McpTool]:
|
|
@@ -934,7 +1004,7 @@ class ToolsClient:
|
|
|
934
1004
|
self, mcp_server_name: str, mcp_tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
935
1005
|
) -> Tool:
|
|
936
1006
|
"""
|
|
937
|
-
|
|
1007
|
+
Register a new MCP tool as a Letta server by MCP server + tool name
|
|
938
1008
|
|
|
939
1009
|
Parameters
|
|
940
1010
|
----------
|
|
@@ -991,6 +1061,64 @@ class ToolsClient:
|
|
|
991
1061
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
992
1062
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
993
1063
|
|
|
1064
|
+
def delete_mcp_server(
|
|
1065
|
+
self, mcp_server_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1066
|
+
) -> typing.List[DeleteMcpServerResponseItem]:
|
|
1067
|
+
"""
|
|
1068
|
+
Add a new MCP server to the Letta MCP server config
|
|
1069
|
+
|
|
1070
|
+
Parameters
|
|
1071
|
+
----------
|
|
1072
|
+
mcp_server_name : str
|
|
1073
|
+
|
|
1074
|
+
request_options : typing.Optional[RequestOptions]
|
|
1075
|
+
Request-specific configuration.
|
|
1076
|
+
|
|
1077
|
+
Returns
|
|
1078
|
+
-------
|
|
1079
|
+
typing.List[DeleteMcpServerResponseItem]
|
|
1080
|
+
Successful Response
|
|
1081
|
+
|
|
1082
|
+
Examples
|
|
1083
|
+
--------
|
|
1084
|
+
from letta_client import Letta
|
|
1085
|
+
|
|
1086
|
+
client = Letta(
|
|
1087
|
+
token="YOUR_TOKEN",
|
|
1088
|
+
)
|
|
1089
|
+
client.tools.delete_mcp_server(
|
|
1090
|
+
mcp_server_name="mcp_server_name",
|
|
1091
|
+
)
|
|
1092
|
+
"""
|
|
1093
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1094
|
+
f"v1/tools/mcp/servers/{jsonable_encoder(mcp_server_name)}",
|
|
1095
|
+
method="DELETE",
|
|
1096
|
+
request_options=request_options,
|
|
1097
|
+
)
|
|
1098
|
+
try:
|
|
1099
|
+
if 200 <= _response.status_code < 300:
|
|
1100
|
+
return typing.cast(
|
|
1101
|
+
typing.List[DeleteMcpServerResponseItem],
|
|
1102
|
+
construct_type(
|
|
1103
|
+
type_=typing.List[DeleteMcpServerResponseItem], # type: ignore
|
|
1104
|
+
object_=_response.json(),
|
|
1105
|
+
),
|
|
1106
|
+
)
|
|
1107
|
+
if _response.status_code == 422:
|
|
1108
|
+
raise UnprocessableEntityError(
|
|
1109
|
+
typing.cast(
|
|
1110
|
+
HttpValidationError,
|
|
1111
|
+
construct_type(
|
|
1112
|
+
type_=HttpValidationError, # type: ignore
|
|
1113
|
+
object_=_response.json(),
|
|
1114
|
+
),
|
|
1115
|
+
)
|
|
1116
|
+
)
|
|
1117
|
+
_response_json = _response.json()
|
|
1118
|
+
except JSONDecodeError:
|
|
1119
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1120
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1121
|
+
|
|
994
1122
|
|
|
995
1123
|
class AsyncToolsClient:
|
|
996
1124
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -1941,6 +2069,80 @@ class AsyncToolsClient:
|
|
|
1941
2069
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1942
2070
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1943
2071
|
|
|
2072
|
+
async def add_mcp_server(
|
|
2073
|
+
self, *, request: AddMcpServerRequest, request_options: typing.Optional[RequestOptions] = None
|
|
2074
|
+
) -> typing.List[AddMcpServerResponseItem]:
|
|
2075
|
+
"""
|
|
2076
|
+
Add a new MCP server to the Letta MCP server config
|
|
2077
|
+
|
|
2078
|
+
Parameters
|
|
2079
|
+
----------
|
|
2080
|
+
request : AddMcpServerRequest
|
|
2081
|
+
|
|
2082
|
+
request_options : typing.Optional[RequestOptions]
|
|
2083
|
+
Request-specific configuration.
|
|
2084
|
+
|
|
2085
|
+
Returns
|
|
2086
|
+
-------
|
|
2087
|
+
typing.List[AddMcpServerResponseItem]
|
|
2088
|
+
Successful Response
|
|
2089
|
+
|
|
2090
|
+
Examples
|
|
2091
|
+
--------
|
|
2092
|
+
import asyncio
|
|
2093
|
+
|
|
2094
|
+
from letta_client import AsyncLetta, StdioServerConfig
|
|
2095
|
+
|
|
2096
|
+
client = AsyncLetta(
|
|
2097
|
+
token="YOUR_TOKEN",
|
|
2098
|
+
)
|
|
2099
|
+
|
|
2100
|
+
|
|
2101
|
+
async def main() -> None:
|
|
2102
|
+
await client.tools.add_mcp_server(
|
|
2103
|
+
request=StdioServerConfig(
|
|
2104
|
+
server_name="server_name",
|
|
2105
|
+
command="command",
|
|
2106
|
+
args=["args"],
|
|
2107
|
+
),
|
|
2108
|
+
)
|
|
2109
|
+
|
|
2110
|
+
|
|
2111
|
+
asyncio.run(main())
|
|
2112
|
+
"""
|
|
2113
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2114
|
+
"v1/tools/mcp/servers",
|
|
2115
|
+
method="PUT",
|
|
2116
|
+
json=convert_and_respect_annotation_metadata(
|
|
2117
|
+
object_=request, annotation=AddMcpServerRequest, direction="write"
|
|
2118
|
+
),
|
|
2119
|
+
request_options=request_options,
|
|
2120
|
+
omit=OMIT,
|
|
2121
|
+
)
|
|
2122
|
+
try:
|
|
2123
|
+
if 200 <= _response.status_code < 300:
|
|
2124
|
+
return typing.cast(
|
|
2125
|
+
typing.List[AddMcpServerResponseItem],
|
|
2126
|
+
construct_type(
|
|
2127
|
+
type_=typing.List[AddMcpServerResponseItem], # type: ignore
|
|
2128
|
+
object_=_response.json(),
|
|
2129
|
+
),
|
|
2130
|
+
)
|
|
2131
|
+
if _response.status_code == 422:
|
|
2132
|
+
raise UnprocessableEntityError(
|
|
2133
|
+
typing.cast(
|
|
2134
|
+
HttpValidationError,
|
|
2135
|
+
construct_type(
|
|
2136
|
+
type_=HttpValidationError, # type: ignore
|
|
2137
|
+
object_=_response.json(),
|
|
2138
|
+
),
|
|
2139
|
+
)
|
|
2140
|
+
)
|
|
2141
|
+
_response_json = _response.json()
|
|
2142
|
+
except JSONDecodeError:
|
|
2143
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2144
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2145
|
+
|
|
1944
2146
|
async def list_mcp_tools_by_server(
|
|
1945
2147
|
self, mcp_server_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1946
2148
|
) -> typing.List[McpTool]:
|
|
@@ -2011,7 +2213,7 @@ class AsyncToolsClient:
|
|
|
2011
2213
|
self, mcp_server_name: str, mcp_tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2012
2214
|
) -> Tool:
|
|
2013
2215
|
"""
|
|
2014
|
-
|
|
2216
|
+
Register a new MCP tool as a Letta server by MCP server + tool name
|
|
2015
2217
|
|
|
2016
2218
|
Parameters
|
|
2017
2219
|
----------
|
|
@@ -2075,3 +2277,69 @@ class AsyncToolsClient:
|
|
|
2075
2277
|
except JSONDecodeError:
|
|
2076
2278
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2077
2279
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2280
|
+
|
|
2281
|
+
async def delete_mcp_server(
|
|
2282
|
+
self, mcp_server_name: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2283
|
+
) -> typing.List[DeleteMcpServerResponseItem]:
|
|
2284
|
+
"""
|
|
2285
|
+
Add a new MCP server to the Letta MCP server config
|
|
2286
|
+
|
|
2287
|
+
Parameters
|
|
2288
|
+
----------
|
|
2289
|
+
mcp_server_name : str
|
|
2290
|
+
|
|
2291
|
+
request_options : typing.Optional[RequestOptions]
|
|
2292
|
+
Request-specific configuration.
|
|
2293
|
+
|
|
2294
|
+
Returns
|
|
2295
|
+
-------
|
|
2296
|
+
typing.List[DeleteMcpServerResponseItem]
|
|
2297
|
+
Successful Response
|
|
2298
|
+
|
|
2299
|
+
Examples
|
|
2300
|
+
--------
|
|
2301
|
+
import asyncio
|
|
2302
|
+
|
|
2303
|
+
from letta_client import AsyncLetta
|
|
2304
|
+
|
|
2305
|
+
client = AsyncLetta(
|
|
2306
|
+
token="YOUR_TOKEN",
|
|
2307
|
+
)
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
async def main() -> None:
|
|
2311
|
+
await client.tools.delete_mcp_server(
|
|
2312
|
+
mcp_server_name="mcp_server_name",
|
|
2313
|
+
)
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
asyncio.run(main())
|
|
2317
|
+
"""
|
|
2318
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2319
|
+
f"v1/tools/mcp/servers/{jsonable_encoder(mcp_server_name)}",
|
|
2320
|
+
method="DELETE",
|
|
2321
|
+
request_options=request_options,
|
|
2322
|
+
)
|
|
2323
|
+
try:
|
|
2324
|
+
if 200 <= _response.status_code < 300:
|
|
2325
|
+
return typing.cast(
|
|
2326
|
+
typing.List[DeleteMcpServerResponseItem],
|
|
2327
|
+
construct_type(
|
|
2328
|
+
type_=typing.List[DeleteMcpServerResponseItem], # type: ignore
|
|
2329
|
+
object_=_response.json(),
|
|
2330
|
+
),
|
|
2331
|
+
)
|
|
2332
|
+
if _response.status_code == 422:
|
|
2333
|
+
raise UnprocessableEntityError(
|
|
2334
|
+
typing.cast(
|
|
2335
|
+
HttpValidationError,
|
|
2336
|
+
construct_type(
|
|
2337
|
+
type_=HttpValidationError, # type: ignore
|
|
2338
|
+
object_=_response.json(),
|
|
2339
|
+
),
|
|
2340
|
+
)
|
|
2341
|
+
)
|
|
2342
|
+
_response_json = _response.json()
|
|
2343
|
+
except JSONDecodeError:
|
|
2344
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2345
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
from .add_mcp_server_request import AddMcpServerRequest
|
|
4
|
+
from .add_mcp_server_response_item import AddMcpServerResponseItem
|
|
5
|
+
from .delete_mcp_server_response_item import DeleteMcpServerResponseItem
|
|
3
6
|
from .list_mcp_servers_response_value import ListMcpServersResponseValue
|
|
4
7
|
|
|
5
|
-
__all__ = [
|
|
8
|
+
__all__ = [
|
|
9
|
+
"AddMcpServerRequest",
|
|
10
|
+
"AddMcpServerResponseItem",
|
|
11
|
+
"DeleteMcpServerResponseItem",
|
|
12
|
+
"ListMcpServersResponseValue",
|
|
13
|
+
]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ...types.stdio_server_config import StdioServerConfig
|
|
5
|
+
from ...types.sse_server_config import SseServerConfig
|
|
6
|
+
|
|
7
|
+
AddMcpServerRequest = typing.Union[StdioServerConfig, SseServerConfig]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ...types.stdio_server_config import StdioServerConfig
|
|
5
|
+
from ...types.sse_server_config import SseServerConfig
|
|
6
|
+
|
|
7
|
+
AddMcpServerResponseItem = typing.Union[StdioServerConfig, SseServerConfig]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ...types.stdio_server_config import StdioServerConfig
|
|
5
|
+
from ...types.sse_server_config import SseServerConfig
|
|
6
|
+
|
|
7
|
+
DeleteMcpServerResponseItem = typing.Union[StdioServerConfig, SseServerConfig]
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
from ...types.sse_server_config import SseServerConfig
|
|
5
|
-
from ...types.
|
|
5
|
+
from ...types.stdio_server_config import StdioServerConfig
|
|
6
6
|
|
|
7
|
-
ListMcpServersResponseValue = typing.Union[SseServerConfig,
|
|
7
|
+
ListMcpServersResponseValue = typing.Union[SseServerConfig, StdioServerConfig]
|
letta_client/types/__init__.py
CHANGED
|
@@ -115,7 +115,6 @@ from .letta_usage_statistics import LettaUsageStatistics
|
|
|
115
115
|
from .llm_config import LlmConfig
|
|
116
116
|
from .llm_config_model_endpoint_type import LlmConfigModelEndpointType
|
|
117
117
|
from .local_sandbox_config import LocalSandboxConfig
|
|
118
|
-
from .local_server_config import LocalServerConfig
|
|
119
118
|
from .manager_type import ManagerType
|
|
120
119
|
from .mcp_server_type import McpServerType
|
|
121
120
|
from .mcp_tool import McpTool
|
|
@@ -156,6 +155,7 @@ from .sandbox_environment_variable_update import SandboxEnvironmentVariableUpdat
|
|
|
156
155
|
from .sandbox_type import SandboxType
|
|
157
156
|
from .source import Source
|
|
158
157
|
from .sse_server_config import SseServerConfig
|
|
158
|
+
from .stdio_server_config import StdioServerConfig
|
|
159
159
|
from .step import Step
|
|
160
160
|
from .supervisor_manager import SupervisorManager
|
|
161
161
|
from .system_message import SystemMessage
|
|
@@ -309,7 +309,6 @@ __all__ = [
|
|
|
309
309
|
"LlmConfig",
|
|
310
310
|
"LlmConfigModelEndpointType",
|
|
311
311
|
"LocalSandboxConfig",
|
|
312
|
-
"LocalServerConfig",
|
|
313
312
|
"ManagerType",
|
|
314
313
|
"McpServerType",
|
|
315
314
|
"McpTool",
|
|
@@ -346,6 +345,7 @@ __all__ = [
|
|
|
346
345
|
"SandboxType",
|
|
347
346
|
"Source",
|
|
348
347
|
"SseServerConfig",
|
|
348
|
+
"StdioServerConfig",
|
|
349
349
|
"Step",
|
|
350
350
|
"SupervisorManager",
|
|
351
351
|
"SystemMessage",
|
|
@@ -7,7 +7,7 @@ from .mcp_server_type import McpServerType
|
|
|
7
7
|
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class StdioServerConfig(UncheckedBaseModel):
|
|
11
11
|
server_name: str = pydantic.Field()
|
|
12
12
|
"""
|
|
13
13
|
The name of the server
|
|
@@ -24,6 +24,11 @@ class LocalServerConfig(UncheckedBaseModel):
|
|
|
24
24
|
The arguments to pass to the command
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
|
+
env: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
|
|
28
|
+
"""
|
|
29
|
+
Environment variables to set
|
|
30
|
+
"""
|
|
31
|
+
|
|
27
32
|
if IS_PYDANTIC_V2:
|
|
28
33
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
29
34
|
else:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
letta_client/__init__.py,sha256=
|
|
1
|
+
letta_client/__init__.py,sha256=CxEcj2yzbE_UEsqUVyTwf1uNgc1SbOCzbf0nGT2ar-Q,63541
|
|
2
2
|
letta_client/agents/__init__.py,sha256=HMLlMwIDoMSMsE99OMGYmDQbdZcYWScYF2L1bW_2zKA,25036
|
|
3
3
|
letta_client/agents/blocks/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
4
4
|
letta_client/agents/blocks/client.py,sha256=u5zvutxoH_DqfSLWhRtNSRBC9_ezQDx682cxkxDz3JA,23822
|
|
5
|
-
letta_client/agents/client.py,sha256=
|
|
5
|
+
letta_client/agents/client.py,sha256=GaTQF74VZFDiwk41_51aKxE3XrmZ3qEan28PMW6_8r8,84805
|
|
6
6
|
letta_client/agents/context/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
7
7
|
letta_client/agents/context/client.py,sha256=GKKvoG4N_K8Biz9yDjeIHpFG0C8Cwc7tHmEX3pTL_9U,4815
|
|
8
8
|
letta_client/agents/core_memory/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
|
@@ -228,7 +228,7 @@ letta_client/blocks/client.py,sha256=LE9dsHaBxFLC3G035f0VpNDG7XKWRK8y9OXpeFCMvUw
|
|
|
228
228
|
letta_client/client.py,sha256=xdSrD4IkWokZHujowd1r7zESBoVgKGNvo6RqgZ3f0Fg,12808
|
|
229
229
|
letta_client/core/__init__.py,sha256=OKbX2aCZXgHCDUsCouqv-OiX32xA6eFFCKIUH9M5Vzk,1591
|
|
230
230
|
letta_client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
|
231
|
-
letta_client/core/client_wrapper.py,sha256=
|
|
231
|
+
letta_client/core/client_wrapper.py,sha256=ffSrx_kI6oX2SVlnb2sOdF4wSLIK3V8KS_52aG9Kqh0,1997
|
|
232
232
|
letta_client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
|
233
233
|
letta_client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
|
234
234
|
letta_client/core/http_client.py,sha256=Z77OIxIbL4OAB2IDqjRq_sYa5yNYAWfmdhdCSSvh6Y4,19552
|
|
@@ -459,11 +459,14 @@ letta_client/templates/types/templates_create_agents_response_agents_item_tools_
|
|
|
459
459
|
letta_client/templates/types/templates_create_agents_response_agents_item_tools_item_tool_type.py,sha256=41qFb26ocOiXdzlnoef44J-fpZ1f9PUQFbBPwsoz6Ms,384
|
|
460
460
|
letta_client/templates/types/templates_create_agents_response_agents_item_updated_at.py,sha256=Md7WfCTT1_AGvyd24EeWzUibPvnrun9rhyxqCLeAURg,439
|
|
461
461
|
letta_client/templates/types/templates_create_agents_response_agents_item_updated_at_item.py,sha256=T3rYnv5m_cBAEPBnEjUkkHJLYtFZfXNMbb7a9FrIwKY,175
|
|
462
|
-
letta_client/tools/__init__.py,sha256=
|
|
463
|
-
letta_client/tools/client.py,sha256=
|
|
464
|
-
letta_client/tools/types/__init__.py,sha256=
|
|
465
|
-
letta_client/tools/types/
|
|
466
|
-
letta_client/types/
|
|
462
|
+
letta_client/tools/__init__.py,sha256=XsuAkxHDA-Z98gLNNW_fiEwFP3fP4XQipflrK2bHl8k,353
|
|
463
|
+
letta_client/tools/client.py,sha256=m_GRTYbqESVr21FuQ3WtpRcShqDPt8nupQu06aIJCLY,76942
|
|
464
|
+
letta_client/tools/types/__init__.py,sha256=R11LYBi6lxkud_DRyaHFUHtlnbfnEI93-SEo7FL4tzs,478
|
|
465
|
+
letta_client/tools/types/add_mcp_server_request.py,sha256=EieZjfOT95sjkpxXdqy7glpxF4J4J3fm6tlaHFnYk84,265
|
|
466
|
+
letta_client/tools/types/add_mcp_server_response_item.py,sha256=pb3A4IoP7Qpen0UDDniXrASYEJZWnYnnrZThtPkvZt4,270
|
|
467
|
+
letta_client/tools/types/delete_mcp_server_response_item.py,sha256=hKc4uehqcubO8BzpgMlvk2jJAjHXOWRM_zmWsCz_vZE,273
|
|
468
|
+
letta_client/tools/types/list_mcp_servers_response_value.py,sha256=AIoXu4bO8QNSU7zjL1jj0Rg4313wVtPaTt13W0aevLQ,273
|
|
469
|
+
letta_client/types/__init__.py,sha256=6A5BT5eUXbiMyw_pCDdNyctyUTwosQGzjCt7BusoBi4,17291
|
|
467
470
|
letta_client/types/action_model.py,sha256=y1e2XMv3skFaNJIBdYoBKgiORzGh05aOVvu-qVR9uHg,1240
|
|
468
471
|
letta_client/types/action_parameters_model.py,sha256=LgKf5aPZG3-OHGxFdXiSokIDgce8c02xPYIAY05VgW8,828
|
|
469
472
|
letta_client/types/action_response_model.py,sha256=yq2Fd9UU8j7vvtE3VqXUoRRvDzWcfJPj_95ynGdeHCs,824
|
|
@@ -579,9 +582,8 @@ letta_client/types/letta_usage_statistics.py,sha256=0BHM3ArfwH6WVJNHYja7LI2k3BZ3
|
|
|
579
582
|
letta_client/types/llm_config.py,sha256=B-LJpzPB5RNSPG-cag65yTIWc0mbD7iKg77N6ejPL64,3045
|
|
580
583
|
letta_client/types/llm_config_model_endpoint_type.py,sha256=HOSM5kIZDCNAVCWmASvAk52K819plqGlD66yKQ1xFkI,620
|
|
581
584
|
letta_client/types/local_sandbox_config.py,sha256=jfe7akG_YrJJ8csLaLdev04Zg1x-PTN0XCAL4KifaZI,1387
|
|
582
|
-
letta_client/types/local_server_config.py,sha256=0tkHCooFWb0ciwCoUPkBbUiDnaFRvL8wiJc_ncM17Eg,945
|
|
583
585
|
letta_client/types/manager_type.py,sha256=hV271989JpEhJQH02MzLpJ34EsbGnyMlckbz2TXBc-E,184
|
|
584
|
-
letta_client/types/mcp_server_type.py,sha256=
|
|
586
|
+
letta_client/types/mcp_server_type.py,sha256=Hv45mKMPzmey2UVjwrTAvWXP1sDd13UwAtvtogBloLo,153
|
|
585
587
|
letta_client/types/mcp_tool.py,sha256=_GSTb0k8l-IUEflRkQ6-v45UnbTcA4Nv1N8sgmExJQ0,912
|
|
586
588
|
letta_client/types/memory.py,sha256=KD5MkDQB-vbRPT9f_-yFBWY1WUW_NWxYEI0IiflG6P8,1035
|
|
587
589
|
letta_client/types/message.py,sha256=dOue5njUr5YaxdGIsyBv1JZk_230v5XZXAgCYFtbz3U,3595
|
|
@@ -616,6 +618,7 @@ letta_client/types/sandbox_environment_variable_update.py,sha256=JMkX6nzvcBNEemj
|
|
|
616
618
|
letta_client/types/sandbox_type.py,sha256=XSWmX3JIFFrDPQ4i89E8LauXY8kjmJEtaz6e_JheGm4,151
|
|
617
619
|
letta_client/types/source.py,sha256=7tLptZ4AZrvRPF6NqToM4Vf9i7TosS2_Ydks4zfvZx4,2239
|
|
618
620
|
letta_client/types/sse_server_config.py,sha256=b-h5FLm5MELZ5A9bwZt-02Zx_f3UbfKAQS--yHQVOQU,844
|
|
621
|
+
letta_client/types/stdio_server_config.py,sha256=dEQ7bguiLikGemLxYZJ3JCmmEQgAMsSPO_P52oHZSl0,1091
|
|
619
622
|
letta_client/types/step.py,sha256=XE98vMiU34dgUxLPvmJLdp9iWFPjg6E2Pb8xNSURMMg,2988
|
|
620
623
|
letta_client/types/supervisor_manager.py,sha256=VdR1ySp4k43apxM8Bb5uNoBvADsvz8oMEEtDy2F5K6M,676
|
|
621
624
|
letta_client/types/system_message.py,sha256=E7ExEVt5Y1p3g-fq1t--Zxr0148v_PRs8DIfsSDcXzE,1281
|
|
@@ -657,6 +660,6 @@ letta_client/voice/__init__.py,sha256=ZrZEuXIukVGhsfM-i0dIFfqjeSOBMPeEgDva7Vvnip
|
|
|
657
660
|
letta_client/voice/client.py,sha256=O38dLq__WTwLPlFTtvw1hgqaPYK9alds_ft12Bnp5fs,6475
|
|
658
661
|
letta_client/voice/types/__init__.py,sha256=hBLJcrom99DkDxxsVRU2ni8kPx6SsCy8gtAJvNOz26w,199
|
|
659
662
|
letta_client/voice/types/create_voice_chat_completions_request.py,sha256=K4__83rXRCshfdobyAmH-5fUDJQ_PeSQetTUeC4Abk0,381
|
|
660
|
-
letta_client-0.1.
|
|
661
|
-
letta_client-0.1.
|
|
662
|
-
letta_client-0.1.
|
|
663
|
+
letta_client-0.1.69.dist-info/METADATA,sha256=hXon62dM2ujqpAdciusX9de3WvYcjuGcBfX7mJiQ_0o,4942
|
|
664
|
+
letta_client-0.1.69.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
665
|
+
letta_client-0.1.69.dist-info/RECORD,,
|
|
File without changes
|