|
18 | 18 | from airbyte.cloud.connectors import CloudDestination, CloudSource, CustomCloudSourceDefinition |
19 | 19 | from airbyte.cloud.workspaces import CloudWorkspace |
20 | 20 | from airbyte.destinations.util import get_noop_destination |
21 | | -from airbyte.mcp._tool_utils import mcp_tool, register_tools |
| 21 | +from airbyte.mcp._tool_utils import ( |
| 22 | + check_guid_created_in_session, |
| 23 | + mcp_tool, |
| 24 | + register_guid_created_in_session, |
| 25 | + register_tools, |
| 26 | +) |
22 | 27 | from airbyte.mcp._util import resolve_config, resolve_list_of_strings |
23 | 28 |
|
24 | 29 |
|
@@ -96,6 +101,7 @@ def deploy_source_to_cloud( |
96 | 101 | except Exception as ex: |
97 | 102 | return f"Failed to deploy source '{source_name}': {ex}" |
98 | 103 | else: |
| 104 | + register_guid_created_in_session(deployed_source.connector_id) |
99 | 105 | return ( |
100 | 106 | f"Successfully deployed source '{source_name}' with ID '{deployed_source.connector_id}'" |
101 | 107 | f" and URL: {deployed_source.connector_url}" |
@@ -166,6 +172,7 @@ def deploy_destination_to_cloud( |
166 | 172 | except Exception as ex: |
167 | 173 | return f"Failed to deploy destination '{destination_name}': {ex}" |
168 | 174 | else: |
| 175 | + register_guid_created_in_session(deployed_destination.connector_id) |
169 | 176 | return ( |
170 | 177 | f"Successfully deployed destination '{destination_name}' " |
171 | 178 | f"with ID: {deployed_destination.connector_id}" |
@@ -227,6 +234,7 @@ def create_connection_on_cloud( |
227 | 234 | except Exception as ex: |
228 | 235 | return f"Failed to create connection '{connection_name}': {ex}" |
229 | 236 | else: |
| 237 | + register_guid_created_in_session(deployed_connection.connection_id) |
230 | 238 | return ( |
231 | 239 | f"Successfully created connection '{connection_name}' " |
232 | 240 | f"with ID '{deployed_connection.connection_id}' and " |
@@ -342,6 +350,7 @@ def deploy_noop_destination_to_cloud( |
342 | 350 | except Exception as ex: |
343 | 351 | return f"Failed to deploy No-op Destination: {ex}" |
344 | 352 | else: |
| 353 | + register_guid_created_in_session(deployed_destination.connector_id) |
345 | 354 | return ( |
346 | 355 | f"Successfully deployed No-op Destination " |
347 | 356 | f"with ID '{deployed_destination.connector_id}' and " |
@@ -617,6 +626,7 @@ def publish_custom_source_definition( |
617 | 626 | except Exception as ex: |
618 | 627 | return f"Failed to publish custom source definition '{name}': {ex}" |
619 | 628 | else: |
| 629 | + register_guid_created_in_session(custom_source.definition_id) |
620 | 630 | return ( |
621 | 631 | "Successfully published custom YAML source definition:\n" |
622 | 632 | + _get_custom_source_definition_description( |
@@ -684,6 +694,7 @@ def update_custom_source_definition( |
684 | 694 | Note: Only YAML (declarative) connectors are currently supported. |
685 | 695 | Docker-based custom sources are not yet available. |
686 | 696 | """ |
| 697 | + check_guid_created_in_session(definition_id) |
687 | 698 | try: |
688 | 699 | processed_manifest = manifest_yaml |
689 | 700 | if isinstance(manifest_yaml, str) and "\n" not in manifest_yaml: |
@@ -733,6 +744,7 @@ def permanently_delete_custom_source_definition( |
733 | 744 | Note: Only YAML (declarative) connectors are currently supported. |
734 | 745 | Docker-based custom sources are not yet available. |
735 | 746 | """ |
| 747 | + check_guid_created_in_session(definition_id) |
736 | 748 | workspace: CloudWorkspace = _get_cloud_workspace() |
737 | 749 | definition = workspace.get_custom_source_definition( |
738 | 750 | definition_id=definition_id, |
@@ -806,6 +818,7 @@ def update_cloud_source_config( |
806 | 818 | and `AIRBYTE_API_ROOT` environment variables will be used to authenticate with the |
807 | 819 | Airbyte Cloud API. |
808 | 820 | """ |
| 821 | + check_guid_created_in_session(source_id) |
809 | 822 | workspace: CloudWorkspace = _get_cloud_workspace() |
810 | 823 | source = workspace.get_source(source_id=source_id) |
811 | 824 |
|
@@ -881,6 +894,7 @@ def update_cloud_destination_config( |
881 | 894 | and `AIRBYTE_API_ROOT` environment variables will be used to authenticate with the |
882 | 895 | Airbyte Cloud API. |
883 | 896 | """ |
| 897 | + check_guid_created_in_session(destination_id) |
884 | 898 | workspace: CloudWorkspace = _get_cloud_workspace() |
885 | 899 | destination = workspace.get_destination(destination_id=destination_id) |
886 | 900 |
|
@@ -983,6 +997,7 @@ def set_cloud_connection_selected_streams( |
983 | 997 | and `AIRBYTE_API_ROOT` environment variables will be used to authenticate with the |
984 | 998 | Airbyte Cloud API. |
985 | 999 | """ |
| 1000 | + check_guid_created_in_session(connection_id) |
986 | 1001 | workspace: CloudWorkspace = _get_cloud_workspace() |
987 | 1002 | connection = workspace.get_connection(connection_id=connection_id) |
988 | 1003 |
|
|
0 commit comments