phenoml 0.0.6__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.
- phenoml/__init__.py +30 -0
- phenoml/agent/__init__.py +56 -0
- phenoml/agent/client.py +939 -0
- phenoml/agent/errors/__init__.py +11 -0
- phenoml/agent/errors/bad_request_error.py +10 -0
- phenoml/agent/errors/forbidden_error.py +10 -0
- phenoml/agent/errors/internal_server_error.py +10 -0
- phenoml/agent/errors/not_found_error.py +10 -0
- phenoml/agent/errors/unauthorized_error.py +10 -0
- phenoml/agent/prompts/__init__.py +7 -0
- phenoml/agent/prompts/client.py +707 -0
- phenoml/agent/prompts/raw_client.py +1345 -0
- phenoml/agent/prompts/types/__init__.py +8 -0
- phenoml/agent/prompts/types/prompts_delete_response.py +20 -0
- phenoml/agent/prompts/types/prompts_list_response.py +22 -0
- phenoml/agent/raw_client.py +1668 -0
- phenoml/agent/types/__init__.py +43 -0
- phenoml/agent/types/agent_chat_response.py +33 -0
- phenoml/agent/types/agent_create_request.py +53 -0
- phenoml/agent/types/agent_create_request_provider.py +5 -0
- phenoml/agent/types/agent_delete_response.py +20 -0
- phenoml/agent/types/agent_get_chat_messages_request_order.py +5 -0
- phenoml/agent/types/agent_get_chat_messages_response.py +22 -0
- phenoml/agent/types/agent_list_response.py +22 -0
- phenoml/agent/types/agent_prompts_response.py +22 -0
- phenoml/agent/types/agent_response.py +22 -0
- phenoml/agent/types/agent_template.py +58 -0
- phenoml/agent/types/agent_template_provider.py +5 -0
- phenoml/agent/types/chat_message_template.py +72 -0
- phenoml/agent/types/chat_session_template.py +67 -0
- phenoml/agent/types/json_patch.py +7 -0
- phenoml/agent/types/json_patch_operation.py +40 -0
- phenoml/agent/types/json_patch_operation_op.py +5 -0
- phenoml/agent/types/prompt_template.py +52 -0
- phenoml/agent/types/success_response.py +20 -0
- phenoml/authtoken/__init__.py +17 -0
- phenoml/authtoken/auth/__init__.py +7 -0
- phenoml/authtoken/auth/client.py +129 -0
- phenoml/authtoken/auth/raw_client.py +173 -0
- phenoml/authtoken/auth/types/__init__.py +7 -0
- phenoml/authtoken/auth/types/auth_generate_token_response.py +22 -0
- phenoml/authtoken/client.py +39 -0
- phenoml/authtoken/errors/__init__.py +8 -0
- phenoml/authtoken/errors/bad_request_error.py +10 -0
- phenoml/authtoken/errors/unauthorized_error.py +10 -0
- phenoml/authtoken/raw_client.py +13 -0
- phenoml/authtoken/types/__init__.py +8 -0
- phenoml/authtoken/types/bad_request_error_body.py +21 -0
- phenoml/authtoken/types/unauthorized_error_body.py +21 -0
- phenoml/client.py +177 -0
- phenoml/cohort/__init__.py +8 -0
- phenoml/cohort/client.py +113 -0
- phenoml/cohort/errors/__init__.py +9 -0
- phenoml/cohort/errors/bad_request_error.py +10 -0
- phenoml/cohort/errors/internal_server_error.py +10 -0
- phenoml/cohort/errors/unauthorized_error.py +10 -0
- phenoml/cohort/raw_client.py +185 -0
- phenoml/cohort/types/__init__.py +8 -0
- phenoml/cohort/types/cohort_response.py +33 -0
- phenoml/cohort/types/search_concept.py +37 -0
- phenoml/construe/__init__.py +45 -0
- phenoml/construe/client.py +399 -0
- phenoml/construe/errors/__init__.py +11 -0
- phenoml/construe/errors/bad_request_error.py +10 -0
- phenoml/construe/errors/conflict_error.py +10 -0
- phenoml/construe/errors/failed_dependency_error.py +10 -0
- phenoml/construe/errors/internal_server_error.py +10 -0
- phenoml/construe/errors/unauthorized_error.py +10 -0
- phenoml/construe/raw_client.py +706 -0
- phenoml/construe/types/__init__.py +41 -0
- phenoml/construe/types/bad_request_error_body.py +27 -0
- phenoml/construe/types/construe_cohort_request_config.py +37 -0
- phenoml/construe/types/construe_cohort_response.py +33 -0
- phenoml/construe/types/construe_cohort_response_queries_item.py +49 -0
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item.py +31 -0
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py +32 -0
- phenoml/construe/types/construe_upload_code_system_response.py +19 -0
- phenoml/construe/types/extract_codes_result.py +22 -0
- phenoml/construe/types/extract_request_config.py +23 -0
- phenoml/construe/types/extract_request_config_chunking_method.py +5 -0
- phenoml/construe/types/extract_request_system.py +37 -0
- phenoml/construe/types/extracted_code_result.py +41 -0
- phenoml/construe/types/internal_server_error_body.py +27 -0
- phenoml/construe/types/unauthorized_error_body.py +27 -0
- phenoml/construe/types/upload_request_format.py +5 -0
- phenoml/core/__init__.py +52 -0
- phenoml/core/api_error.py +23 -0
- phenoml/core/client_wrapper.py +87 -0
- phenoml/core/datetime_utils.py +28 -0
- phenoml/core/file.py +67 -0
- phenoml/core/force_multipart.py +16 -0
- phenoml/core/http_client.py +543 -0
- phenoml/core/http_response.py +55 -0
- phenoml/core/jsonable_encoder.py +100 -0
- phenoml/core/pydantic_utilities.py +255 -0
- phenoml/core/query_encoder.py +58 -0
- phenoml/core/remove_none_from_dict.py +11 -0
- phenoml/core/request_options.py +35 -0
- phenoml/core/serialization.py +276 -0
- phenoml/environment.py +7 -0
- phenoml/fhir/__init__.py +36 -0
- phenoml/fhir/client.py +970 -0
- phenoml/fhir/errors/__init__.py +10 -0
- phenoml/fhir/errors/bad_request_error.py +10 -0
- phenoml/fhir/errors/internal_server_error.py +10 -0
- phenoml/fhir/errors/not_found_error.py +10 -0
- phenoml/fhir/errors/unauthorized_error.py +10 -0
- phenoml/fhir/raw_client.py +1385 -0
- phenoml/fhir/types/__init__.py +29 -0
- phenoml/fhir/types/error_response.py +36 -0
- phenoml/fhir/types/fhir_bundle.py +43 -0
- phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
- phenoml/fhir/types/fhir_bundle_entry_item_request.py +25 -0
- phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
- phenoml/fhir/types/fhir_bundle_entry_item_response.py +24 -0
- phenoml/fhir/types/fhir_patch_request_body_item.py +40 -0
- phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
- phenoml/fhir/types/fhir_resource.py +40 -0
- phenoml/fhir/types/fhir_resource_meta.py +28 -0
- phenoml/fhir/types/fhir_search_response.py +8 -0
- phenoml/fhir_provider/__init__.py +43 -0
- phenoml/fhir_provider/client.py +731 -0
- phenoml/fhir_provider/errors/__init__.py +11 -0
- phenoml/fhir_provider/errors/bad_request_error.py +10 -0
- phenoml/fhir_provider/errors/forbidden_error.py +10 -0
- phenoml/fhir_provider/errors/internal_server_error.py +10 -0
- phenoml/fhir_provider/errors/not_found_error.py +10 -0
- phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
- phenoml/fhir_provider/raw_client.py +1445 -0
- phenoml/fhir_provider/types/__init__.py +35 -0
- phenoml/fhir_provider/types/auth_method.py +7 -0
- phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
- phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
- phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
- phenoml/fhir_provider/types/fhir_query_response.py +27 -0
- phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
- phenoml/fhir_provider/types/json_web_key.py +51 -0
- phenoml/fhir_provider/types/provider.py +8 -0
- phenoml/fhir_provider/types/service_account_key.py +35 -0
- phenoml/fhir_provider/types/smart_configuration.py +46 -0
- phenoml/lang2fhir/__init__.py +27 -0
- phenoml/lang2fhir/client.py +430 -0
- phenoml/lang2fhir/errors/__init__.py +11 -0
- phenoml/lang2fhir/errors/bad_request_error.py +10 -0
- phenoml/lang2fhir/errors/failed_dependency_error.py +10 -0
- phenoml/lang2fhir/errors/forbidden_error.py +10 -0
- phenoml/lang2fhir/errors/internal_server_error.py +10 -0
- phenoml/lang2fhir/errors/unauthorized_error.py +10 -0
- phenoml/lang2fhir/raw_client.py +788 -0
- phenoml/lang2fhir/types/__init__.py +19 -0
- phenoml/lang2fhir/types/create_request_resource.py +25 -0
- phenoml/lang2fhir/types/document_request_file_type.py +7 -0
- phenoml/lang2fhir/types/document_request_resource.py +5 -0
- phenoml/lang2fhir/types/fhir_resource.py +5 -0
- phenoml/lang2fhir/types/lang2fhir_upload_profile_response.py +23 -0
- phenoml/lang2fhir/types/search_response.py +33 -0
- phenoml/py.typed +0 -0
- phenoml/tools/__init__.py +37 -0
- phenoml/tools/client.py +359 -0
- phenoml/tools/errors/__init__.py +11 -0
- phenoml/tools/errors/bad_request_error.py +10 -0
- phenoml/tools/errors/failed_dependency_error.py +10 -0
- phenoml/tools/errors/forbidden_error.py +10 -0
- phenoml/tools/errors/internal_server_error.py +10 -0
- phenoml/tools/errors/unauthorized_error.py +10 -0
- phenoml/tools/mcp_server/__init__.py +7 -0
- phenoml/tools/mcp_server/client.py +336 -0
- phenoml/tools/mcp_server/raw_client.py +641 -0
- phenoml/tools/mcp_server/tools/__init__.py +4 -0
- phenoml/tools/mcp_server/tools/client.py +358 -0
- phenoml/tools/mcp_server/tools/raw_client.py +656 -0
- phenoml/tools/raw_client.py +696 -0
- phenoml/tools/types/__init__.py +27 -0
- phenoml/tools/types/cohort_response.py +49 -0
- phenoml/tools/types/lang2fhir_and_create_request_resource.py +25 -0
- phenoml/tools/types/lang2fhir_and_create_response.py +33 -0
- phenoml/tools/types/lang2fhir_and_search_response.py +40 -0
- phenoml/tools/types/mcp_server_response.py +33 -0
- phenoml/tools/types/mcp_server_response_data.py +51 -0
- phenoml/tools/types/mcp_server_tool_call_response.py +37 -0
- phenoml/tools/types/mcp_server_tool_response.py +33 -0
- phenoml/tools/types/mcp_server_tool_response_data.py +61 -0
- phenoml/tools/types/search_concept.py +41 -0
- phenoml/types/__init__.py +21 -0
- phenoml/types/cohort_response.py +5 -0
- phenoml/types/lang2fhir_and_create_response.py +5 -0
- phenoml/types/lang2fhir_and_search_response.py +5 -0
- phenoml/types/mcp_server_response.py +5 -0
- phenoml/types/mcp_server_tool_call_response.py +5 -0
- phenoml/types/mcp_server_tool_response.py +5 -0
- phenoml/types/search_concept.py +5 -0
- phenoml/version.py +3 -0
- phenoml/workflows/__init__.py +66 -0
- phenoml/workflows/client.py +210 -0
- phenoml/workflows/errors/__init__.py +11 -0
- phenoml/workflows/errors/bad_request_error.py +10 -0
- phenoml/workflows/errors/forbidden_error.py +10 -0
- phenoml/workflows/errors/internal_server_error.py +10 -0
- phenoml/workflows/errors/not_found_error.py +10 -0
- phenoml/workflows/errors/unauthorized_error.py +10 -0
- phenoml/workflows/mcp_server/__init__.py +7 -0
- phenoml/workflows/mcp_server/client.py +274 -0
- phenoml/workflows/mcp_server/raw_client.py +226 -0
- phenoml/workflows/mcp_server/tools/__init__.py +4 -0
- phenoml/workflows/mcp_server/tools/client.py +287 -0
- phenoml/workflows/mcp_server/tools/raw_client.py +244 -0
- phenoml/workflows/raw_client.py +169 -0
- phenoml/workflows/types/__init__.py +43 -0
- phenoml/workflows/types/create_workflow_response.py +44 -0
- phenoml/workflows/types/decision_node_definition.py +32 -0
- phenoml/workflows/types/execute_workflow_response.py +30 -0
- phenoml/workflows/types/execute_workflow_response_results.py +22 -0
- phenoml/workflows/types/lang2fhir_create_definition.py +37 -0
- phenoml/workflows/types/lang2fhir_search_definition.py +42 -0
- phenoml/workflows/types/list_workflows_response.py +39 -0
- phenoml/workflows/types/step_operation.py +26 -0
- phenoml/workflows/types/sub_workflow_definition.py +32 -0
- phenoml/workflows/types/workflow_config.py +27 -0
- phenoml/workflows/types/workflow_definition.py +57 -0
- phenoml/workflows/types/workflow_graph.py +23 -0
- phenoml/workflows/types/workflow_response.py +61 -0
- phenoml/workflows/types/workflow_response_graph.py +23 -0
- phenoml/workflows/types/workflow_step.py +55 -0
- phenoml/workflows/types/workflow_step_summary.py +47 -0
- phenoml/workflows/types/workflow_step_summary_type.py +5 -0
- phenoml/workflows/types/workflow_step_type.py +5 -0
- phenoml/workflows/workflows/__init__.py +19 -0
- phenoml/workflows/workflows/client.py +694 -0
- phenoml/workflows/workflows/raw_client.py +1266 -0
- phenoml/workflows/workflows/types/__init__.py +17 -0
- phenoml/workflows/workflows/types/create_workflow_request_fhir_provider_id.py +5 -0
- phenoml/workflows/workflows/types/update_workflow_request_fhir_provider_id.py +5 -0
- phenoml/workflows/workflows/types/workflows_delete_response.py +20 -0
- phenoml/workflows/workflows/types/workflows_get_response.py +26 -0
- phenoml/workflows/workflows/types/workflows_update_response.py +31 -0
- phenoml/wrapper_client.py +123 -0
- phenoml-0.0.6.dist-info/LICENSE +21 -0
- phenoml-0.0.6.dist-info/METADATA +192 -0
- phenoml-0.0.6.dist-info/RECORD +244 -0
- phenoml-0.0.6.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ....core.api_error import ApiError
|
|
7
|
+
from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ....core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ....core.jsonable_encoder import jsonable_encoder
|
|
10
|
+
from ....core.pydantic_utilities import parse_obj_as
|
|
11
|
+
from ....core.request_options import RequestOptions
|
|
12
|
+
from ...errors.bad_request_error import BadRequestError
|
|
13
|
+
from ...errors.forbidden_error import ForbiddenError
|
|
14
|
+
from ...errors.internal_server_error import InternalServerError
|
|
15
|
+
from ...errors.unauthorized_error import UnauthorizedError
|
|
16
|
+
from ...types.mcp_server_tool_call_response import McpServerToolCallResponse
|
|
17
|
+
from ...types.mcp_server_tool_response import McpServerToolResponse
|
|
18
|
+
|
|
19
|
+
# this is used as the default value for optional parameters
|
|
20
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RawToolsClient:
|
|
24
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
25
|
+
self._client_wrapper = client_wrapper
|
|
26
|
+
|
|
27
|
+
def list(
|
|
28
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
29
|
+
) -> HttpResponse[McpServerToolResponse]:
|
|
30
|
+
"""
|
|
31
|
+
Lists all MCP server tools for a specific MCP server
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
mcp_server_id : str
|
|
36
|
+
ID of the MCP server to list tools for
|
|
37
|
+
|
|
38
|
+
request_options : typing.Optional[RequestOptions]
|
|
39
|
+
Request-specific configuration.
|
|
40
|
+
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
HttpResponse[McpServerToolResponse]
|
|
44
|
+
Successfully listed MCP server tools
|
|
45
|
+
"""
|
|
46
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
47
|
+
f"tools/mcp-server/{jsonable_encoder(mcp_server_id)}/list",
|
|
48
|
+
method="GET",
|
|
49
|
+
request_options=request_options,
|
|
50
|
+
)
|
|
51
|
+
try:
|
|
52
|
+
if 200 <= _response.status_code < 300:
|
|
53
|
+
_data = typing.cast(
|
|
54
|
+
McpServerToolResponse,
|
|
55
|
+
parse_obj_as(
|
|
56
|
+
type_=McpServerToolResponse, # type: ignore
|
|
57
|
+
object_=_response.json(),
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
return HttpResponse(response=_response, data=_data)
|
|
61
|
+
if _response.status_code == 401:
|
|
62
|
+
raise UnauthorizedError(
|
|
63
|
+
headers=dict(_response.headers),
|
|
64
|
+
body=typing.cast(
|
|
65
|
+
typing.Optional[typing.Any],
|
|
66
|
+
parse_obj_as(
|
|
67
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
68
|
+
object_=_response.json(),
|
|
69
|
+
),
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
if _response.status_code == 403:
|
|
73
|
+
raise ForbiddenError(
|
|
74
|
+
headers=dict(_response.headers),
|
|
75
|
+
body=typing.cast(
|
|
76
|
+
typing.Optional[typing.Any],
|
|
77
|
+
parse_obj_as(
|
|
78
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
79
|
+
object_=_response.json(),
|
|
80
|
+
),
|
|
81
|
+
),
|
|
82
|
+
)
|
|
83
|
+
if _response.status_code == 500:
|
|
84
|
+
raise InternalServerError(
|
|
85
|
+
headers=dict(_response.headers),
|
|
86
|
+
body=typing.cast(
|
|
87
|
+
typing.Optional[typing.Any],
|
|
88
|
+
parse_obj_as(
|
|
89
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
90
|
+
object_=_response.json(),
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
)
|
|
94
|
+
_response_json = _response.json()
|
|
95
|
+
except JSONDecodeError:
|
|
96
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
97
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
98
|
+
|
|
99
|
+
def get(
|
|
100
|
+
self, mcp_server_tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
101
|
+
) -> HttpResponse[McpServerToolResponse]:
|
|
102
|
+
"""
|
|
103
|
+
Gets a MCP server tool by ID
|
|
104
|
+
|
|
105
|
+
Parameters
|
|
106
|
+
----------
|
|
107
|
+
mcp_server_tool_id : str
|
|
108
|
+
ID of the MCP server tool to retrieve
|
|
109
|
+
|
|
110
|
+
request_options : typing.Optional[RequestOptions]
|
|
111
|
+
Request-specific configuration.
|
|
112
|
+
|
|
113
|
+
Returns
|
|
114
|
+
-------
|
|
115
|
+
HttpResponse[McpServerToolResponse]
|
|
116
|
+
Successfully retrieved MCP server tool
|
|
117
|
+
"""
|
|
118
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
119
|
+
f"tools/mcp-server/tool/{jsonable_encoder(mcp_server_tool_id)}",
|
|
120
|
+
method="GET",
|
|
121
|
+
request_options=request_options,
|
|
122
|
+
)
|
|
123
|
+
try:
|
|
124
|
+
if 200 <= _response.status_code < 300:
|
|
125
|
+
_data = typing.cast(
|
|
126
|
+
McpServerToolResponse,
|
|
127
|
+
parse_obj_as(
|
|
128
|
+
type_=McpServerToolResponse, # type: ignore
|
|
129
|
+
object_=_response.json(),
|
|
130
|
+
),
|
|
131
|
+
)
|
|
132
|
+
return HttpResponse(response=_response, data=_data)
|
|
133
|
+
if _response.status_code == 401:
|
|
134
|
+
raise UnauthorizedError(
|
|
135
|
+
headers=dict(_response.headers),
|
|
136
|
+
body=typing.cast(
|
|
137
|
+
typing.Optional[typing.Any],
|
|
138
|
+
parse_obj_as(
|
|
139
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
140
|
+
object_=_response.json(),
|
|
141
|
+
),
|
|
142
|
+
),
|
|
143
|
+
)
|
|
144
|
+
if _response.status_code == 403:
|
|
145
|
+
raise ForbiddenError(
|
|
146
|
+
headers=dict(_response.headers),
|
|
147
|
+
body=typing.cast(
|
|
148
|
+
typing.Optional[typing.Any],
|
|
149
|
+
parse_obj_as(
|
|
150
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
151
|
+
object_=_response.json(),
|
|
152
|
+
),
|
|
153
|
+
),
|
|
154
|
+
)
|
|
155
|
+
if _response.status_code == 500:
|
|
156
|
+
raise InternalServerError(
|
|
157
|
+
headers=dict(_response.headers),
|
|
158
|
+
body=typing.cast(
|
|
159
|
+
typing.Optional[typing.Any],
|
|
160
|
+
parse_obj_as(
|
|
161
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
162
|
+
object_=_response.json(),
|
|
163
|
+
),
|
|
164
|
+
),
|
|
165
|
+
)
|
|
166
|
+
_response_json = _response.json()
|
|
167
|
+
except JSONDecodeError:
|
|
168
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
169
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
170
|
+
|
|
171
|
+
def delete(
|
|
172
|
+
self, mcp_server_tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
173
|
+
) -> HttpResponse[McpServerToolResponse]:
|
|
174
|
+
"""
|
|
175
|
+
Deletes a MCP server tool by ID
|
|
176
|
+
|
|
177
|
+
Parameters
|
|
178
|
+
----------
|
|
179
|
+
mcp_server_tool_id : str
|
|
180
|
+
ID of the MCP server tool to delete
|
|
181
|
+
|
|
182
|
+
request_options : typing.Optional[RequestOptions]
|
|
183
|
+
Request-specific configuration.
|
|
184
|
+
|
|
185
|
+
Returns
|
|
186
|
+
-------
|
|
187
|
+
HttpResponse[McpServerToolResponse]
|
|
188
|
+
Successfully deleted MCP server tool
|
|
189
|
+
"""
|
|
190
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
191
|
+
f"tools/mcp-server/tool/{jsonable_encoder(mcp_server_tool_id)}",
|
|
192
|
+
method="DELETE",
|
|
193
|
+
request_options=request_options,
|
|
194
|
+
)
|
|
195
|
+
try:
|
|
196
|
+
if 200 <= _response.status_code < 300:
|
|
197
|
+
_data = typing.cast(
|
|
198
|
+
McpServerToolResponse,
|
|
199
|
+
parse_obj_as(
|
|
200
|
+
type_=McpServerToolResponse, # type: ignore
|
|
201
|
+
object_=_response.json(),
|
|
202
|
+
),
|
|
203
|
+
)
|
|
204
|
+
return HttpResponse(response=_response, data=_data)
|
|
205
|
+
if _response.status_code == 401:
|
|
206
|
+
raise UnauthorizedError(
|
|
207
|
+
headers=dict(_response.headers),
|
|
208
|
+
body=typing.cast(
|
|
209
|
+
typing.Optional[typing.Any],
|
|
210
|
+
parse_obj_as(
|
|
211
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
212
|
+
object_=_response.json(),
|
|
213
|
+
),
|
|
214
|
+
),
|
|
215
|
+
)
|
|
216
|
+
if _response.status_code == 403:
|
|
217
|
+
raise ForbiddenError(
|
|
218
|
+
headers=dict(_response.headers),
|
|
219
|
+
body=typing.cast(
|
|
220
|
+
typing.Optional[typing.Any],
|
|
221
|
+
parse_obj_as(
|
|
222
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
223
|
+
object_=_response.json(),
|
|
224
|
+
),
|
|
225
|
+
),
|
|
226
|
+
)
|
|
227
|
+
if _response.status_code == 500:
|
|
228
|
+
raise InternalServerError(
|
|
229
|
+
headers=dict(_response.headers),
|
|
230
|
+
body=typing.cast(
|
|
231
|
+
typing.Optional[typing.Any],
|
|
232
|
+
parse_obj_as(
|
|
233
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
234
|
+
object_=_response.json(),
|
|
235
|
+
),
|
|
236
|
+
),
|
|
237
|
+
)
|
|
238
|
+
_response_json = _response.json()
|
|
239
|
+
except JSONDecodeError:
|
|
240
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
241
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
242
|
+
|
|
243
|
+
def call(
|
|
244
|
+
self,
|
|
245
|
+
mcp_server_tool_id: str,
|
|
246
|
+
*,
|
|
247
|
+
arguments: typing.Dict[str, typing.Optional[typing.Any]],
|
|
248
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
249
|
+
) -> HttpResponse[McpServerToolCallResponse]:
|
|
250
|
+
"""
|
|
251
|
+
Calls a MCP server tool
|
|
252
|
+
|
|
253
|
+
Parameters
|
|
254
|
+
----------
|
|
255
|
+
mcp_server_tool_id : str
|
|
256
|
+
ID of the MCP server tool to call
|
|
257
|
+
|
|
258
|
+
arguments : typing.Dict[str, typing.Optional[typing.Any]]
|
|
259
|
+
Arguments to pass to the MCP server tool
|
|
260
|
+
|
|
261
|
+
request_options : typing.Optional[RequestOptions]
|
|
262
|
+
Request-specific configuration.
|
|
263
|
+
|
|
264
|
+
Returns
|
|
265
|
+
-------
|
|
266
|
+
HttpResponse[McpServerToolCallResponse]
|
|
267
|
+
Successfully called MCP server tool
|
|
268
|
+
"""
|
|
269
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
270
|
+
f"tools/mcp-server/tool/{jsonable_encoder(mcp_server_tool_id)}/call",
|
|
271
|
+
method="POST",
|
|
272
|
+
json={
|
|
273
|
+
"arguments": arguments,
|
|
274
|
+
},
|
|
275
|
+
headers={
|
|
276
|
+
"content-type": "application/json",
|
|
277
|
+
},
|
|
278
|
+
request_options=request_options,
|
|
279
|
+
omit=OMIT,
|
|
280
|
+
)
|
|
281
|
+
try:
|
|
282
|
+
if 200 <= _response.status_code < 300:
|
|
283
|
+
_data = typing.cast(
|
|
284
|
+
McpServerToolCallResponse,
|
|
285
|
+
parse_obj_as(
|
|
286
|
+
type_=McpServerToolCallResponse, # type: ignore
|
|
287
|
+
object_=_response.json(),
|
|
288
|
+
),
|
|
289
|
+
)
|
|
290
|
+
return HttpResponse(response=_response, data=_data)
|
|
291
|
+
if _response.status_code == 400:
|
|
292
|
+
raise BadRequestError(
|
|
293
|
+
headers=dict(_response.headers),
|
|
294
|
+
body=typing.cast(
|
|
295
|
+
typing.Optional[typing.Any],
|
|
296
|
+
parse_obj_as(
|
|
297
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
298
|
+
object_=_response.json(),
|
|
299
|
+
),
|
|
300
|
+
),
|
|
301
|
+
)
|
|
302
|
+
if _response.status_code == 401:
|
|
303
|
+
raise UnauthorizedError(
|
|
304
|
+
headers=dict(_response.headers),
|
|
305
|
+
body=typing.cast(
|
|
306
|
+
typing.Optional[typing.Any],
|
|
307
|
+
parse_obj_as(
|
|
308
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
309
|
+
object_=_response.json(),
|
|
310
|
+
),
|
|
311
|
+
),
|
|
312
|
+
)
|
|
313
|
+
if _response.status_code == 403:
|
|
314
|
+
raise ForbiddenError(
|
|
315
|
+
headers=dict(_response.headers),
|
|
316
|
+
body=typing.cast(
|
|
317
|
+
typing.Optional[typing.Any],
|
|
318
|
+
parse_obj_as(
|
|
319
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
320
|
+
object_=_response.json(),
|
|
321
|
+
),
|
|
322
|
+
),
|
|
323
|
+
)
|
|
324
|
+
if _response.status_code == 500:
|
|
325
|
+
raise InternalServerError(
|
|
326
|
+
headers=dict(_response.headers),
|
|
327
|
+
body=typing.cast(
|
|
328
|
+
typing.Optional[typing.Any],
|
|
329
|
+
parse_obj_as(
|
|
330
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
331
|
+
object_=_response.json(),
|
|
332
|
+
),
|
|
333
|
+
),
|
|
334
|
+
)
|
|
335
|
+
_response_json = _response.json()
|
|
336
|
+
except JSONDecodeError:
|
|
337
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
338
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
class AsyncRawToolsClient:
|
|
342
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
343
|
+
self._client_wrapper = client_wrapper
|
|
344
|
+
|
|
345
|
+
async def list(
|
|
346
|
+
self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
347
|
+
) -> AsyncHttpResponse[McpServerToolResponse]:
|
|
348
|
+
"""
|
|
349
|
+
Lists all MCP server tools for a specific MCP server
|
|
350
|
+
|
|
351
|
+
Parameters
|
|
352
|
+
----------
|
|
353
|
+
mcp_server_id : str
|
|
354
|
+
ID of the MCP server to list tools for
|
|
355
|
+
|
|
356
|
+
request_options : typing.Optional[RequestOptions]
|
|
357
|
+
Request-specific configuration.
|
|
358
|
+
|
|
359
|
+
Returns
|
|
360
|
+
-------
|
|
361
|
+
AsyncHttpResponse[McpServerToolResponse]
|
|
362
|
+
Successfully listed MCP server tools
|
|
363
|
+
"""
|
|
364
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
365
|
+
f"tools/mcp-server/{jsonable_encoder(mcp_server_id)}/list",
|
|
366
|
+
method="GET",
|
|
367
|
+
request_options=request_options,
|
|
368
|
+
)
|
|
369
|
+
try:
|
|
370
|
+
if 200 <= _response.status_code < 300:
|
|
371
|
+
_data = typing.cast(
|
|
372
|
+
McpServerToolResponse,
|
|
373
|
+
parse_obj_as(
|
|
374
|
+
type_=McpServerToolResponse, # type: ignore
|
|
375
|
+
object_=_response.json(),
|
|
376
|
+
),
|
|
377
|
+
)
|
|
378
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
379
|
+
if _response.status_code == 401:
|
|
380
|
+
raise UnauthorizedError(
|
|
381
|
+
headers=dict(_response.headers),
|
|
382
|
+
body=typing.cast(
|
|
383
|
+
typing.Optional[typing.Any],
|
|
384
|
+
parse_obj_as(
|
|
385
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
386
|
+
object_=_response.json(),
|
|
387
|
+
),
|
|
388
|
+
),
|
|
389
|
+
)
|
|
390
|
+
if _response.status_code == 403:
|
|
391
|
+
raise ForbiddenError(
|
|
392
|
+
headers=dict(_response.headers),
|
|
393
|
+
body=typing.cast(
|
|
394
|
+
typing.Optional[typing.Any],
|
|
395
|
+
parse_obj_as(
|
|
396
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
397
|
+
object_=_response.json(),
|
|
398
|
+
),
|
|
399
|
+
),
|
|
400
|
+
)
|
|
401
|
+
if _response.status_code == 500:
|
|
402
|
+
raise InternalServerError(
|
|
403
|
+
headers=dict(_response.headers),
|
|
404
|
+
body=typing.cast(
|
|
405
|
+
typing.Optional[typing.Any],
|
|
406
|
+
parse_obj_as(
|
|
407
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
408
|
+
object_=_response.json(),
|
|
409
|
+
),
|
|
410
|
+
),
|
|
411
|
+
)
|
|
412
|
+
_response_json = _response.json()
|
|
413
|
+
except JSONDecodeError:
|
|
414
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
415
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
416
|
+
|
|
417
|
+
async def get(
|
|
418
|
+
self, mcp_server_tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
419
|
+
) -> AsyncHttpResponse[McpServerToolResponse]:
|
|
420
|
+
"""
|
|
421
|
+
Gets a MCP server tool by ID
|
|
422
|
+
|
|
423
|
+
Parameters
|
|
424
|
+
----------
|
|
425
|
+
mcp_server_tool_id : str
|
|
426
|
+
ID of the MCP server tool to retrieve
|
|
427
|
+
|
|
428
|
+
request_options : typing.Optional[RequestOptions]
|
|
429
|
+
Request-specific configuration.
|
|
430
|
+
|
|
431
|
+
Returns
|
|
432
|
+
-------
|
|
433
|
+
AsyncHttpResponse[McpServerToolResponse]
|
|
434
|
+
Successfully retrieved MCP server tool
|
|
435
|
+
"""
|
|
436
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
437
|
+
f"tools/mcp-server/tool/{jsonable_encoder(mcp_server_tool_id)}",
|
|
438
|
+
method="GET",
|
|
439
|
+
request_options=request_options,
|
|
440
|
+
)
|
|
441
|
+
try:
|
|
442
|
+
if 200 <= _response.status_code < 300:
|
|
443
|
+
_data = typing.cast(
|
|
444
|
+
McpServerToolResponse,
|
|
445
|
+
parse_obj_as(
|
|
446
|
+
type_=McpServerToolResponse, # type: ignore
|
|
447
|
+
object_=_response.json(),
|
|
448
|
+
),
|
|
449
|
+
)
|
|
450
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
451
|
+
if _response.status_code == 401:
|
|
452
|
+
raise UnauthorizedError(
|
|
453
|
+
headers=dict(_response.headers),
|
|
454
|
+
body=typing.cast(
|
|
455
|
+
typing.Optional[typing.Any],
|
|
456
|
+
parse_obj_as(
|
|
457
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
458
|
+
object_=_response.json(),
|
|
459
|
+
),
|
|
460
|
+
),
|
|
461
|
+
)
|
|
462
|
+
if _response.status_code == 403:
|
|
463
|
+
raise ForbiddenError(
|
|
464
|
+
headers=dict(_response.headers),
|
|
465
|
+
body=typing.cast(
|
|
466
|
+
typing.Optional[typing.Any],
|
|
467
|
+
parse_obj_as(
|
|
468
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
469
|
+
object_=_response.json(),
|
|
470
|
+
),
|
|
471
|
+
),
|
|
472
|
+
)
|
|
473
|
+
if _response.status_code == 500:
|
|
474
|
+
raise InternalServerError(
|
|
475
|
+
headers=dict(_response.headers),
|
|
476
|
+
body=typing.cast(
|
|
477
|
+
typing.Optional[typing.Any],
|
|
478
|
+
parse_obj_as(
|
|
479
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
480
|
+
object_=_response.json(),
|
|
481
|
+
),
|
|
482
|
+
),
|
|
483
|
+
)
|
|
484
|
+
_response_json = _response.json()
|
|
485
|
+
except JSONDecodeError:
|
|
486
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
487
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
488
|
+
|
|
489
|
+
async def delete(
|
|
490
|
+
self, mcp_server_tool_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
491
|
+
) -> AsyncHttpResponse[McpServerToolResponse]:
|
|
492
|
+
"""
|
|
493
|
+
Deletes a MCP server tool by ID
|
|
494
|
+
|
|
495
|
+
Parameters
|
|
496
|
+
----------
|
|
497
|
+
mcp_server_tool_id : str
|
|
498
|
+
ID of the MCP server tool to delete
|
|
499
|
+
|
|
500
|
+
request_options : typing.Optional[RequestOptions]
|
|
501
|
+
Request-specific configuration.
|
|
502
|
+
|
|
503
|
+
Returns
|
|
504
|
+
-------
|
|
505
|
+
AsyncHttpResponse[McpServerToolResponse]
|
|
506
|
+
Successfully deleted MCP server tool
|
|
507
|
+
"""
|
|
508
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
509
|
+
f"tools/mcp-server/tool/{jsonable_encoder(mcp_server_tool_id)}",
|
|
510
|
+
method="DELETE",
|
|
511
|
+
request_options=request_options,
|
|
512
|
+
)
|
|
513
|
+
try:
|
|
514
|
+
if 200 <= _response.status_code < 300:
|
|
515
|
+
_data = typing.cast(
|
|
516
|
+
McpServerToolResponse,
|
|
517
|
+
parse_obj_as(
|
|
518
|
+
type_=McpServerToolResponse, # type: ignore
|
|
519
|
+
object_=_response.json(),
|
|
520
|
+
),
|
|
521
|
+
)
|
|
522
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
523
|
+
if _response.status_code == 401:
|
|
524
|
+
raise UnauthorizedError(
|
|
525
|
+
headers=dict(_response.headers),
|
|
526
|
+
body=typing.cast(
|
|
527
|
+
typing.Optional[typing.Any],
|
|
528
|
+
parse_obj_as(
|
|
529
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
530
|
+
object_=_response.json(),
|
|
531
|
+
),
|
|
532
|
+
),
|
|
533
|
+
)
|
|
534
|
+
if _response.status_code == 403:
|
|
535
|
+
raise ForbiddenError(
|
|
536
|
+
headers=dict(_response.headers),
|
|
537
|
+
body=typing.cast(
|
|
538
|
+
typing.Optional[typing.Any],
|
|
539
|
+
parse_obj_as(
|
|
540
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
541
|
+
object_=_response.json(),
|
|
542
|
+
),
|
|
543
|
+
),
|
|
544
|
+
)
|
|
545
|
+
if _response.status_code == 500:
|
|
546
|
+
raise InternalServerError(
|
|
547
|
+
headers=dict(_response.headers),
|
|
548
|
+
body=typing.cast(
|
|
549
|
+
typing.Optional[typing.Any],
|
|
550
|
+
parse_obj_as(
|
|
551
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
552
|
+
object_=_response.json(),
|
|
553
|
+
),
|
|
554
|
+
),
|
|
555
|
+
)
|
|
556
|
+
_response_json = _response.json()
|
|
557
|
+
except JSONDecodeError:
|
|
558
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
559
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
560
|
+
|
|
561
|
+
async def call(
|
|
562
|
+
self,
|
|
563
|
+
mcp_server_tool_id: str,
|
|
564
|
+
*,
|
|
565
|
+
arguments: typing.Dict[str, typing.Optional[typing.Any]],
|
|
566
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
567
|
+
) -> AsyncHttpResponse[McpServerToolCallResponse]:
|
|
568
|
+
"""
|
|
569
|
+
Calls a MCP server tool
|
|
570
|
+
|
|
571
|
+
Parameters
|
|
572
|
+
----------
|
|
573
|
+
mcp_server_tool_id : str
|
|
574
|
+
ID of the MCP server tool to call
|
|
575
|
+
|
|
576
|
+
arguments : typing.Dict[str, typing.Optional[typing.Any]]
|
|
577
|
+
Arguments to pass to the MCP server tool
|
|
578
|
+
|
|
579
|
+
request_options : typing.Optional[RequestOptions]
|
|
580
|
+
Request-specific configuration.
|
|
581
|
+
|
|
582
|
+
Returns
|
|
583
|
+
-------
|
|
584
|
+
AsyncHttpResponse[McpServerToolCallResponse]
|
|
585
|
+
Successfully called MCP server tool
|
|
586
|
+
"""
|
|
587
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
588
|
+
f"tools/mcp-server/tool/{jsonable_encoder(mcp_server_tool_id)}/call",
|
|
589
|
+
method="POST",
|
|
590
|
+
json={
|
|
591
|
+
"arguments": arguments,
|
|
592
|
+
},
|
|
593
|
+
headers={
|
|
594
|
+
"content-type": "application/json",
|
|
595
|
+
},
|
|
596
|
+
request_options=request_options,
|
|
597
|
+
omit=OMIT,
|
|
598
|
+
)
|
|
599
|
+
try:
|
|
600
|
+
if 200 <= _response.status_code < 300:
|
|
601
|
+
_data = typing.cast(
|
|
602
|
+
McpServerToolCallResponse,
|
|
603
|
+
parse_obj_as(
|
|
604
|
+
type_=McpServerToolCallResponse, # type: ignore
|
|
605
|
+
object_=_response.json(),
|
|
606
|
+
),
|
|
607
|
+
)
|
|
608
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
609
|
+
if _response.status_code == 400:
|
|
610
|
+
raise BadRequestError(
|
|
611
|
+
headers=dict(_response.headers),
|
|
612
|
+
body=typing.cast(
|
|
613
|
+
typing.Optional[typing.Any],
|
|
614
|
+
parse_obj_as(
|
|
615
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
616
|
+
object_=_response.json(),
|
|
617
|
+
),
|
|
618
|
+
),
|
|
619
|
+
)
|
|
620
|
+
if _response.status_code == 401:
|
|
621
|
+
raise UnauthorizedError(
|
|
622
|
+
headers=dict(_response.headers),
|
|
623
|
+
body=typing.cast(
|
|
624
|
+
typing.Optional[typing.Any],
|
|
625
|
+
parse_obj_as(
|
|
626
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
627
|
+
object_=_response.json(),
|
|
628
|
+
),
|
|
629
|
+
),
|
|
630
|
+
)
|
|
631
|
+
if _response.status_code == 403:
|
|
632
|
+
raise ForbiddenError(
|
|
633
|
+
headers=dict(_response.headers),
|
|
634
|
+
body=typing.cast(
|
|
635
|
+
typing.Optional[typing.Any],
|
|
636
|
+
parse_obj_as(
|
|
637
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
638
|
+
object_=_response.json(),
|
|
639
|
+
),
|
|
640
|
+
),
|
|
641
|
+
)
|
|
642
|
+
if _response.status_code == 500:
|
|
643
|
+
raise InternalServerError(
|
|
644
|
+
headers=dict(_response.headers),
|
|
645
|
+
body=typing.cast(
|
|
646
|
+
typing.Optional[typing.Any],
|
|
647
|
+
parse_obj_as(
|
|
648
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
649
|
+
object_=_response.json(),
|
|
650
|
+
),
|
|
651
|
+
),
|
|
652
|
+
)
|
|
653
|
+
_response_json = _response.json()
|
|
654
|
+
except JSONDecodeError:
|
|
655
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
656
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|