oci 2.154.2__py3-none-any.whl → 2.155.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oci/__init__.py +2 -2
- oci/access_governance_cp/access_governance_cp_client.py +8 -8
- oci/addons/adk/agent.py +82 -32
- oci/addons/adk/mcp/__init__.py +11 -0
- oci/addons/adk/mcp/mcp_client.py +420 -0
- oci/addons/adk/tool/function_tool.py +7 -3
- oci/addons/adk/tool/tool.py +11 -1
- oci/addons/adk/tool/toolkit.py +11 -2
- oci/adm/application_dependency_management_client.py +36 -36
- oci/ai_anomaly_detection/anomaly_detection_client.py +72 -72
- oci/ai_document/ai_service_document_client.py +26 -26
- oci/ai_language/ai_service_language_client.py +44 -44
- oci/ai_speech/ai_service_speech_client.py +19 -19
- oci/ai_vision/ai_service_vision_client.py +28 -28
- oci/analytics/analytics_client.py +24 -24
- oci/announcements_service/announcement_client.py +5 -5
- oci/announcements_service/announcement_subscription_client.py +9 -9
- oci/announcements_service/announcements_preferences_client.py +4 -4
- oci/announcements_service/service_client.py +1 -1
- oci/apiaccesscontrol/api_metadata_client.py +6 -6
- oci/apiaccesscontrol/privileged_api_control_client.py +12 -12
- oci/apiaccesscontrol/privileged_api_requests_client.py +14 -14
- oci/apiaccesscontrol/privileged_api_work_request_client.py +10 -10
- oci/apigateway/api_gateway_client.py +21 -21
- oci/apigateway/deployment_client.py +6 -6
- oci/apigateway/gateway_client.py +6 -6
- oci/apigateway/subscribers_client.py +6 -6
- oci/apigateway/usage_plans_client.py +6 -6
- oci/apigateway/work_requests_client.py +5 -5
- oci/apm_config/config_client.py +12 -12
- oci/apm_control_plane/apm_domain_client.py +14 -14
- oci/apm_synthetics/apm_synthetic_client.py +28 -28
- oci/apm_traces/__init__.py +3 -1
- oci/apm_traces/attributes_client.py +12 -12
- oci/apm_traces/models/__init__.py +25 -1
- oci/apm_traces/models/attribute.py +101 -0
- oci/apm_traces/models/attribute_metadata.py +149 -0
- oci/apm_traces/models/attribute_response.py +2 -2
- oci/apm_traces/models/attribute_update_response.py +2 -2
- oci/apm_traces/models/auto_activate_status.py +16 -0
- oci/apm_traces/models/auto_activate_toggle_status.py +16 -0
- oci/apm_traces/models/bulk_activate_attribute_detail.py +47 -8
- oci/apm_traces/models/bulk_de_activate_attribute_detail.py +7 -3
- oci/apm_traces/models/bulk_pin_attribute_detail.py +7 -3
- oci/apm_traces/models/bulk_unpin_attribute_detail.py +7 -3
- oci/apm_traces/models/bulk_update_attribute_detail.py +9 -5
- oci/apm_traces/models/bulk_update_attribute_notes_detail.py +7 -3
- oci/apm_traces/models/create_scheduled_query_details.py +471 -0
- oci/apm_traces/models/custom_metric.py +295 -0
- oci/apm_traces/models/log.py +475 -0
- oci/apm_traces/models/object_storage.py +132 -0
- oci/apm_traces/models/scheduled_query.py +666 -0
- oci/apm_traces/models/scheduled_query_collection.py +70 -0
- oci/apm_traces/models/scheduled_query_processing_config.py +120 -0
- oci/apm_traces/models/scheduled_query_summary.py +573 -0
- oci/apm_traces/models/streaming.py +70 -0
- oci/apm_traces/models/tag_metadata.py +2 -2
- oci/apm_traces/models/update_scheduled_query_details.py +471 -0
- oci/apm_traces/query_client.py +8 -6
- oci/apm_traces/scheduled_query_client.py +755 -0
- oci/apm_traces/scheduled_query_client_composite_operations.py +181 -0
- oci/apm_traces/trace_client.py +131 -6
- oci/appmgmt_control/appmgmt_control_client.py +8 -8
- oci/artifacts/artifacts_client.py +32 -32
- oci/audit/audit_client.py +3 -3
- oci/autoscaling/auto_scaling_client.py +11 -11
- oci/base_client.py +3 -0
- oci/bastion/bastion_client.py +15 -15
- oci/bds/bds_client.py +88 -88
- oci/blockchain/blockchain_platform_client.py +27 -27
- oci/budget/budget_client.py +10 -10
- oci/capacity_management/capacity_management_client.py +32 -32
- oci/capacity_management/demand_signal_client.py +13 -13
- oci/capacity_management/internal_demand_signal_client.py +12 -12
- oci/certificates/certificates_client.py +5 -5
- oci/certificates_management/certificates_management_client.py +32 -32
- oci/cims/incident_client.py +6 -6
- oci/cloud_bridge/common_client.py +5 -5
- oci/cloud_bridge/discovery_client.py +15 -15
- oci/cloud_bridge/inventory_client.py +16 -16
- oci/cloud_bridge/ocb_agent_svc_client.py +23 -23
- oci/cloud_guard/cloud_guard_client.py +155 -155
- oci/cloud_migrations/migration_client.py +43 -43
- oci/cluster_placement_groups/cluster_placement_groups_cp_client.py +13 -13
- oci/compute_cloud_at_customer/compute_cloud_at_customer_client.py +12 -12
- oci/compute_instance_agent/compute_instance_agent_client.py +6 -6
- oci/compute_instance_agent/plugin_client.py +2 -2
- oci/compute_instance_agent/pluginconfig_client.py +1 -1
- oci/container_engine/container_engine_client.py +46 -46
- oci/container_instances/container_instance_client.py +18 -18
- oci/core/blockstorage_client.py +60 -60
- oci/core/compute_client.py +125 -125
- oci/core/compute_management_client.py +32 -32
- oci/core/virtual_network_client.py +258 -258
- oci/dashboard_service/dashboard_client.py +6 -6
- oci/dashboard_service/dashboard_group_client.py +6 -6
- oci/data_catalog/data_catalog_client.py +149 -149
- oci/data_flow/data_flow_client.py +45 -45
- oci/data_integration/data_integration_client.py +163 -163
- oci/data_labeling_service/data_labeling_management_client.py +17 -17
- oci/data_labeling_service_dataplane/data_labeling_client.py +15 -15
- oci/data_safe/data_safe_client.py +317 -317
- oci/data_science/data_science_client.py +145 -145
- oci/database/database_client.py +901 -421
- oci/database/database_client_composite_operations.py +123 -0
- oci/database/models/__init__.py +14 -0
- oci/database/models/autonomous_container_database.py +37 -0
- oci/database/models/autonomous_container_database_summary.py +37 -0
- oci/database/models/autonomous_database_software_image.py +37 -0
- oci/database/models/autonomous_database_software_image_summary.py +37 -0
- oci/database/models/autonomous_vm_cluster.py +37 -0
- oci/database/models/autonomous_vm_cluster_summary.py +37 -0
- oci/database/models/azure_encryption_key_details.py +80 -0
- oci/database/models/backup.py +7 -3
- oci/database/models/backup_destination.py +37 -0
- oci/database/models/backup_destination_configuration_summary.py +7 -3
- oci/database/models/backup_destination_details.py +7 -3
- oci/database/models/backup_destination_details_summary.py +7 -3
- oci/database/models/backup_destination_summary.py +37 -0
- oci/database/models/backup_summary.py +7 -3
- oci/database/models/change_cloud_autonomous_vm_cluster_subscription_details.py +105 -0
- oci/database/models/cloud_autonomous_vm_cluster.py +74 -2
- oci/database/models/cloud_autonomous_vm_cluster_summary.py +74 -2
- oci/database/models/cloud_vm_cluster.py +80 -2
- oci/database/models/cloud_vm_cluster_summary.py +80 -2
- oci/database/models/create_cloud_autonomous_vm_cluster_details.py +37 -2
- oci/database/models/create_cloud_vm_cluster_details.py +17 -17
- oci/database/models/create_database_base.py +1 -1
- oci/database/models/create_vm_cluster_details.py +2 -2
- oci/database/models/database.py +37 -0
- oci/database/models/database_software_image.py +37 -0
- oci/database/models/database_software_image_summary.py +37 -0
- oci/database/models/database_summary.py +37 -0
- oci/database/models/db_home.py +37 -0
- oci/database/models/db_home_from_agent_resource_id.py +37 -0
- oci/database/models/db_home_summary.py +37 -0
- oci/database/models/db_node.py +37 -0
- oci/database/models/db_node_summary.py +37 -0
- oci/database/models/db_server.py +37 -0
- oci/database/models/db_server_summary.py +37 -0
- oci/database/models/db_system.py +37 -0
- oci/database/models/db_system_summary.py +37 -0
- oci/database/models/encryption_key_location_details.py +15 -5
- oci/database/models/exadata_infrastructure.py +37 -0
- oci/database/models/exadata_infrastructure_summary.py +37 -0
- oci/database/models/execution_action.py +39 -2
- oci/database/models/execution_action_summary.py +39 -2
- oci/database/models/execution_window.py +39 -2
- oci/database/models/execution_window_summary.py +39 -2
- oci/database/models/external_container_database.py +37 -0
- oci/database/models/external_container_database_summary.py +37 -0
- oci/database/models/external_database_base.py +37 -0
- oci/database/models/external_database_connector.py +37 -0
- oci/database/models/external_database_connector_summary.py +37 -0
- oci/database/models/external_hsm_encryption_details.py +1 -1
- oci/database/models/external_macs_connector.py +7 -0
- oci/database/models/external_macs_connector_summary.py +7 -0
- oci/database/models/external_non_container_database.py +37 -0
- oci/database/models/external_non_container_database_summary.py +37 -0
- oci/database/models/external_pluggable_database.py +37 -0
- oci/database/models/external_pluggable_database_summary.py +37 -0
- oci/database/models/identity_connector_details.py +113 -0
- oci/database/models/key_store.py +39 -2
- oci/database/models/key_store_summary.py +39 -2
- oci/database/models/maintenance_run.py +37 -0
- oci/database/models/maintenance_run_history.py +39 -2
- oci/database/models/maintenance_run_history_summary.py +39 -2
- oci/database/models/maintenance_run_summary.py +37 -0
- oci/database/models/oneoff_patch.py +39 -2
- oci/database/models/oneoff_patch_summary.py +39 -2
- oci/database/models/pluggable_database.py +37 -0
- oci/database/models/pluggable_database_summary.py +37 -0
- oci/database/models/register_cloud_vm_cluster_pkcs_details.py +86 -0
- oci/database/models/resource_pool_member_collection.py +70 -0
- oci/database/models/resource_pool_member_summary.py +74 -0
- oci/database/models/scheduling_policy.py +39 -2
- oci/database/models/scheduling_policy_summary.py +39 -2
- oci/database/models/scheduling_window.py +39 -2
- oci/database/models/scheduling_window_summary.py +39 -2
- oci/database/models/unregister_cloud_vm_cluster_pkcs_details.py +86 -0
- oci/database/models/vm_cluster.py +37 -0
- oci/database/models/vm_cluster_network.py +39 -2
- oci/database/models/vm_cluster_network_summary.py +39 -2
- oci/database/models/vm_cluster_summary.py +37 -0
- oci/database_management/db_management_client.py +229 -229
- oci/database_management/diagnosability_client.py +4 -4
- oci/database_management/managed_my_sql_databases_client.py +15 -15
- oci/database_management/perfhub_client.py +1 -1
- oci/database_management/sql_tuning_client.py +17 -17
- oci/database_migration/database_migration_client.py +155 -42
- oci/database_migration/database_migration_client_composite_operations.py +42 -0
- oci/database_migration/models/__init__.py +4 -0
- oci/database_migration/models/collect_traces_data.py +183 -0
- oci/database_migration/models/collect_traces_details.py +132 -0
- oci/database_migration/models/job.py +27 -0
- oci/database_tools/database_tools_client.py +23 -23
- oci/dblm/db_life_cycle_management_client.py +14 -14
- oci/dbmulticloud/__init__.py +28 -0
- oci/dbmulticloud/models/__init__.py +112 -0
- oci/dbmulticloud/models/arc_agent_nodes.py +218 -0
- oci/dbmulticloud/models/change_multi_cloud_resource_discovery_compartment_details.py +191 -0
- oci/dbmulticloud/models/change_oracle_db_azure_blob_container_compartment_details.py +187 -0
- oci/dbmulticloud/models/change_oracle_db_azure_blob_mount_compartment_details.py +187 -0
- oci/dbmulticloud/models/change_oracle_db_azure_connector_compartment_details.py +187 -0
- oci/dbmulticloud/models/change_oracle_db_azure_vault_association_compartment_details.py +191 -0
- oci/dbmulticloud/models/change_oracle_db_azure_vault_compartment_details.py +191 -0
- oci/dbmulticloud/models/create_multi_cloud_resource_discovery_details.py +253 -0
- oci/dbmulticloud/models/create_oracle_db_azure_blob_container_details.py +307 -0
- oci/dbmulticloud/models/create_oracle_db_azure_blob_mount_details.py +245 -0
- oci/dbmulticloud/models/create_oracle_db_azure_connector_details.py +431 -0
- oci/dbmulticloud/models/create_oracle_db_azure_vault_association_details.py +257 -0
- oci/dbmulticloud/models/create_oracle_db_azure_vault_details.py +377 -0
- oci/dbmulticloud/models/multi_cloud_resource_discovery.py +577 -0
- oci/dbmulticloud/models/multi_cloud_resource_discovery_summary.py +517 -0
- oci/dbmulticloud/models/multi_cloud_resource_discovery_summary_collection.py +70 -0
- oci/dbmulticloud/models/oracle_db_azure_blob_container.py +568 -0
- oci/dbmulticloud/models/oracle_db_azure_blob_container_summary.py +536 -0
- oci/dbmulticloud/models/oracle_db_azure_blob_container_summary_collection.py +70 -0
- oci/dbmulticloud/models/oracle_db_azure_blob_mount.py +537 -0
- oci/dbmulticloud/models/oracle_db_azure_blob_mount_summary.py +505 -0
- oci/dbmulticloud/models/oracle_db_azure_blob_mount_summary_collection.py +70 -0
- oci/dbmulticloud/models/oracle_db_azure_connector.py +739 -0
- oci/dbmulticloud/models/oracle_db_azure_connector_summary.py +660 -0
- oci/dbmulticloud/models/oracle_db_azure_connector_summary_collection.py +70 -0
- oci/dbmulticloud/models/oracle_db_azure_key.py +518 -0
- oci/dbmulticloud/models/oracle_db_azure_key_summary.py +486 -0
- oci/dbmulticloud/models/oracle_db_azure_key_summary_collection.py +70 -0
- oci/dbmulticloud/models/oracle_db_azure_vault.py +642 -0
- oci/dbmulticloud/models/oracle_db_azure_vault_association.py +553 -0
- oci/dbmulticloud/models/oracle_db_azure_vault_association_summary.py +521 -0
- oci/dbmulticloud/models/oracle_db_azure_vault_association_summary_collection.py +70 -0
- oci/dbmulticloud/models/oracle_db_azure_vault_summary.py +610 -0
- oci/dbmulticloud/models/oracle_db_azure_vault_summary_collection.py +70 -0
- oci/dbmulticloud/models/patch_oracle_db_azure_connector_details.py +187 -0
- oci/dbmulticloud/models/resources.py +229 -0
- oci/dbmulticloud/models/update_multi_cloud_resource_discovery_details.py +253 -0
- oci/dbmulticloud/models/update_oracle_db_azure_blob_container_details.py +307 -0
- oci/dbmulticloud/models/update_oracle_db_azure_blob_mount_details.py +245 -0
- oci/dbmulticloud/models/update_oracle_db_azure_connector_details.py +431 -0
- oci/dbmulticloud/models/update_oracle_db_azure_vault_association_details.py +257 -0
- oci/dbmulticloud/models/update_oracle_db_azure_vault_details.py +377 -0
- oci/dbmulticloud/models/work_request.py +496 -0
- oci/dbmulticloud/models/work_request_error.py +134 -0
- oci/dbmulticloud/models/work_request_error_collection.py +70 -0
- oci/dbmulticloud/models/work_request_log_entry.py +101 -0
- oci/dbmulticloud/models/work_request_log_entry_collection.py +70 -0
- oci/dbmulticloud/models/work_request_resource.py +232 -0
- oci/dbmulticloud/models/work_request_summary.py +496 -0
- oci/dbmulticloud/models/work_request_summary_collection.py +70 -0
- oci/dbmulticloud/multi_cloud_resource_discovery_client.py +883 -0
- oci/dbmulticloud/multi_cloud_resource_discovery_client_composite_operations.py +202 -0
- oci/dbmulticloud/oracle_db_azure_blob_container_client.py +864 -0
- oci/dbmulticloud/oracle_db_azure_blob_container_client_composite_operations.py +196 -0
- oci/dbmulticloud/oracle_db_azure_blob_mount_client.py +865 -0
- oci/dbmulticloud/oracle_db_azure_blob_mount_client_composite_operations.py +196 -0
- oci/dbmulticloud/oracle_db_azure_connector_client.py +963 -0
- oci/dbmulticloud/oracle_db_azure_connector_client_composite_operations.py +239 -0
- oci/dbmulticloud/oracle_db_azure_key_client.py +419 -0
- oci/dbmulticloud/oracle_db_azure_key_client_composite_operations.py +26 -0
- oci/dbmulticloud/oracle_db_azure_vault_association_client.py +979 -0
- oci/dbmulticloud/oracle_db_azure_vault_association_client_composite_operations.py +235 -0
- oci/dbmulticloud/oracle_db_azure_vault_client.py +979 -0
- oci/dbmulticloud/oracle_db_azure_vault_client_composite_operations.py +235 -0
- oci/dbmulticloud/work_request_client.py +770 -0
- oci/dbmulticloud/work_request_client_composite_operations.py +26 -0
- oci/delegate_access_control/delegate_access_control_client.py +26 -26
- oci/delegate_access_control/work_request_client.py +4 -4
- oci/demand_signal/occ_demand_signal_client.py +7 -7
- oci/desktops/desktop_service_client.py +21 -21
- oci/devops/devops_client.py +141 -141
- oci/disaster_recovery/disaster_recovery_client.py +31 -31
- oci/distributed_database/distributed_autonomous_db_service_client.py +18 -18
- oci/distributed_database/distributed_db_private_endpoint_service_client.py +7 -7
- oci/distributed_database/distributed_db_service_client.py +19 -19
- oci/distributed_database/distributed_db_work_request_service_client.py +4 -4
- oci/dns/dns_client.py +54 -54
- oci/dts/appliance_export_job_client.py +6 -6
- oci/dts/shipping_vendors_client.py +1 -1
- oci/dts/transfer_appliance_client.py +8 -8
- oci/dts/transfer_appliance_entitlement_client.py +3 -3
- oci/dts/transfer_device_client.py +5 -5
- oci/dts/transfer_job_client.py +6 -6
- oci/dts/transfer_package_client.py +7 -7
- oci/em_warehouse/em_warehouse_client.py +13 -13
- oci/email/email_client.py +31 -31
- oci/email_data_plane/email_dp_client.py +1 -1
- oci/events/events_client.py +6 -6
- oci/file_storage/file_storage_client.py +74 -74
- oci/fleet_apps_management/fleet_apps_management_admin_client.py +27 -27
- oci/fleet_apps_management/fleet_apps_management_catalog_client.py +7 -7
- oci/fleet_apps_management/fleet_apps_management_client.py +32 -32
- oci/fleet_apps_management/fleet_apps_management_maintenance_window_client.py +5 -5
- oci/fleet_apps_management/fleet_apps_management_operations_client.py +29 -29
- oci/fleet_apps_management/fleet_apps_management_provision_client.py +6 -6
- oci/fleet_apps_management/fleet_apps_management_runbooks_client.py +19 -19
- oci/fleet_apps_management/fleet_apps_management_work_request_client.py +4 -4
- oci/fleet_software_update/fleet_software_update_client.py +46 -46
- oci/fleet_software_update/models/__init__.py +12 -0
- oci/fleet_software_update/models/create_fsu_cycle_details.py +11 -3
- oci/fleet_software_update/models/create_patch_fsu_cycle.py +1 -1
- oci/fleet_software_update/models/create_upgrade_fsu_cycle.py +147 -0
- oci/fleet_software_update/models/fsu_cycle.py +11 -3
- oci/fleet_software_update/models/fsu_cycle_summary.py +7 -3
- oci/fleet_software_update/models/patch_fsu_cycle.py +1 -1
- oci/fleet_software_update/models/update_fsu_cycle_details.py +11 -3
- oci/fleet_software_update/models/update_patch_fsu_cycle.py +1 -1
- oci/fleet_software_update/models/update_upgrade_fsu_cycle.py +118 -0
- oci/fleet_software_update/models/upgrade_db_collection_details.py +142 -0
- oci/fleet_software_update/models/upgrade_details.py +107 -0
- oci/fleet_software_update/models/upgrade_fsu_cycle.py +241 -0
- oci/fleet_software_update/models/upgrade_gi_collection_details.py +111 -0
- oci/functions/functions_invoke_client.py +1 -1
- oci/functions/functions_management_client.py +16 -16
- oci/fusion_apps/fusion_applications_client.py +41 -41
- oci/generative_ai/generative_ai_client.py +22 -22
- oci/generative_ai_agent/generative_ai_agent_client.py +38 -38
- oci/generative_ai_agent_runtime/generative_ai_agent_runtime_client.py +6 -6
- oci/generative_ai_inference/generative_ai_inference_client.py +6 -6
- oci/generic_artifacts_content/generic_artifacts_content_client.py +3 -3
- oci/globally_distributed_database/sharded_database_service_client.py +30 -30
- oci/golden_gate/golden_gate_client.py +89 -89
- oci/governance_rules_control_plane/governance_rule_client.py +15 -15
- oci/governance_rules_control_plane/work_request_client.py +5 -5
- oci/healthchecks/health_checks_client.py +17 -17
- oci/identity/identity_client.py +145 -145
- oci/identity_data_plane/dataplane_client.py +2 -2
- oci/identity_domains/identity_domains_client.py +311 -311
- oci/integration/integration_instance_client.py +19 -19
- oci/jms/java_management_service_client.py +79 -79
- oci/jms_java_downloads/java_download_client.py +25 -25
- oci/key_management/ekm_client.py +5 -5
- oci/key_management/kms_crypto_client.py +6 -6
- oci/key_management/kms_hsm_cluster_client.py +12 -12
- oci/key_management/kms_management_client.py +21 -21
- oci/key_management/kms_vault_client.py +14 -14
- oci/license_manager/license_manager_client.py +18 -18
- oci/limits/limits_client.py +4 -4
- oci/limits/quotas_client.py +7 -7
- oci/load_balancer/load_balancer_client.py +61 -61
- oci/load_balancer/models/backend.py +4 -4
- oci/load_balancer/models/backend_details.py +10 -4
- oci/load_balancer/models/backend_set.py +6 -4
- oci/load_balancer/models/backend_set_details.py +12 -4
- oci/load_balancer/models/create_backend_details.py +10 -4
- oci/load_balancer/models/create_backend_set_details.py +12 -4
- oci/load_balancer/models/create_listener_details.py +6 -4
- oci/load_balancer/models/create_load_balancer_details.py +39 -0
- oci/load_balancer/models/listener.py +6 -4
- oci/load_balancer/models/listener_details.py +6 -4
- oci/load_balancer/models/load_balancer.py +61 -2
- oci/load_balancer/models/reserved_ip.py +4 -0
- oci/load_balancer/models/update_backend_details.py +10 -4
- oci/load_balancer/models/update_backend_set_details.py +12 -4
- oci/load_balancer/models/update_listener_details.py +6 -4
- oci/load_balancer/models/update_load_balancer_details.py +59 -0
- oci/lockbox/lockbox_client.py +24 -24
- oci/log_analytics/log_analytics_client.py +200 -200
- oci/logging/logging_management_client.py +30 -30
- oci/loggingingestion/logging_client.py +1 -1
- oci/loggingsearch/log_search_client.py +1 -1
- oci/lustre_file_storage/lustre_file_storage_client.py +11 -11
- oci/management_agent/management_agent_client.py +28 -28
- oci/management_dashboard/dashx_apis_client.py +18 -18
- oci/marketplace/account_client.py +2 -2
- oci/marketplace/marketplace_client.py +30 -30
- oci/marketplace_private_offer/attachment_client.py +5 -5
- oci/marketplace_private_offer/offer_client.py +6 -6
- oci/marketplace_publisher/attachment_client.py +5 -5
- oci/marketplace_publisher/marketplace_publisher_client.py +71 -71
- oci/marketplace_publisher/offer_client.py +6 -6
- oci/media_services/media_services_client.py +60 -60
- oci/media_services/media_stream_client.py +2 -2
- oci/mngdmac/mac_device_client.py +3 -3
- oci/mngdmac/mac_order_client.py +11 -11
- oci/model_deployment/model_deployment_client.py +2 -2
- oci/monitoring/monitoring_client.py +18 -18
- oci/mysql/channels_client.py +7 -7
- oci/mysql/db_backups_client.py +8 -8
- oci/mysql/db_system_client.py +17 -17
- oci/mysql/models/__init__.py +2 -0
- oci/mysql/models/backup.py +29 -2
- oci/mysql/models/backup_summary.py +29 -2
- oci/mysql/models/copy_backup_details.py +29 -2
- oci/mysql/models/create_db_system_details.py +27 -0
- oci/mysql/models/db_system.py +27 -0
- oci/mysql/models/db_system_snapshot.py +27 -0
- oci/mysql/models/encrypt_data_details.py +117 -0
- oci/mysql/models/replica.py +27 -0
- oci/mysql/models/update_db_system_details.py +27 -0
- oci/mysql/mysqlaas_client.py +7 -7
- oci/mysql/replicas_client.py +5 -5
- oci/mysql/work_requests_client.py +4 -4
- oci/network_firewall/network_firewall_client.py +92 -92
- oci/network_load_balancer/network_load_balancer_client.py +35 -35
- oci/nosql/models/__init__.py +14 -0
- oci/nosql/models/configuration.py +109 -0
- oci/nosql/models/hosted_configuration.py +78 -0
- oci/nosql/models/kms_key.py +244 -0
- oci/nosql/models/multi_tenancy_configuration.py +49 -0
- oci/nosql/models/update_configuration_details.py +109 -0
- oci/nosql/models/update_hosted_configuration_details.py +78 -0
- oci/nosql/models/update_multi_tenancy_configuration_details.py +52 -0
- oci/nosql/models/work_request.py +7 -3
- oci/nosql/models/work_request_summary.py +7 -3
- oci/nosql/nosql_client.py +340 -25
- oci/nosql/nosql_client_composite_operations.py +81 -0
- oci/object_storage/object_storage_client.py +55 -55
- oci/oce/oce_instance_client.py +10 -10
- oci/oci_control_center/occ_metrics_client.py +3 -3
- oci/ocvp/cluster_client.py +5 -5
- oci/ocvp/esxi_host_client.py +8 -8
- oci/ocvp/sddc_client.py +14 -14
- oci/ocvp/work_request_client.py +4 -4
- oci/oda/management_client.py +59 -59
- oci/oda/oda_client.py +17 -17
- oci/oda/odapackage_client.py +7 -7
- oci/onesubscription/billing_schedule_client.py +1 -1
- oci/onesubscription/commitment_client.py +2 -2
- oci/onesubscription/computed_usage_client.py +3 -3
- oci/onesubscription/invoice_summary_client.py +2 -2
- oci/onesubscription/organization_subscription_client.py +1 -1
- oci/onesubscription/ratecard_client.py +1 -1
- oci/onesubscription/subscribed_service_client.py +2 -2
- oci/onesubscription/subscription_client.py +1 -1
- oci/ons/notification_control_plane_client.py +6 -6
- oci/ons/notification_data_plane_client.py +10 -10
- oci/opa/opa_instance_client.py +13 -13
- oci/opensearch/opensearch_cluster_backup_client.py +4 -4
- oci/opensearch/opensearch_cluster_client.py +17 -17
- oci/opensearch/opensearch_cluster_pipeline_client.py +5 -5
- oci/operator_access_control/access_requests_client.py +10 -10
- oci/operator_access_control/operator_actions_client.py +2 -2
- oci/operator_access_control/operator_control_assignment_client.py +8 -8
- oci/operator_access_control/operator_control_client.py +6 -6
- oci/opsi/operations_insights_client.py +181 -181
- oci/optimizer/optimizer_client.py +26 -26
- oci/os_management/event_client.py +8 -8
- oci/os_management/os_management_client.py +69 -69
- oci/os_management_hub/event_client.py +8 -8
- oci/os_management_hub/lifecycle_environment_client.py +13 -13
- oci/os_management_hub/managed_instance_client.py +33 -33
- oci/os_management_hub/managed_instance_group_client.py +26 -26
- oci/os_management_hub/management_station_client.py +10 -10
- oci/os_management_hub/onboarding_client.py +13 -13
- oci/os_management_hub/reporting_managed_instance_client.py +3 -3
- oci/os_management_hub/scheduled_job_client.py +7 -7
- oci/os_management_hub/software_source_client.py +33 -33
- oci/os_management_hub/work_request_client.py +5 -5
- oci/osp_gateway/address_rule_service_client.py +1 -1
- oci/osp_gateway/address_service_client.py +2 -2
- oci/osp_gateway/invoice_service_client.py +5 -5
- oci/osp_gateway/subscription_service_client.py +5 -5
- oci/osub_billing_schedule/billing_schedule_client.py +1 -1
- oci/osub_organization_subscription/organization_subscription_client.py +1 -1
- oci/osub_subscription/commitment_client.py +2 -2
- oci/osub_subscription/ratecard_client.py +1 -1
- oci/osub_subscription/subscription_client.py +1 -1
- oci/osub_usage/computed_usage_client.py +3 -3
- oci/psql/postgresql_client.py +34 -34
- oci/queue/queue_admin_client.py +11 -11
- oci/queue/queue_client.py +8 -8
- oci/recovery/database_recovery_client.py +26 -26
- oci/redis/oci_cache_user_client.py +7 -7
- oci/redis/redis_cluster_client.py +15 -15
- oci/redis/redis_identity_client.py +1 -1
- oci/resource_manager/resource_manager_client.py +52 -52
- oci/resource_scheduler/schedule_client.py +14 -14
- oci/resource_search/resource_search_client.py +3 -3
- oci/rover/rover_bundle_client.py +8 -8
- oci/rover/rover_cluster_client.py +8 -8
- oci/rover/rover_entitlement_client.py +6 -6
- oci/rover/rover_node_client.py +15 -15
- oci/rover/shape_client.py +1 -1
- oci/rover/work_requests_client.py +5 -5
- oci/sch/connector_plugins_client.py +2 -2
- oci/sch/service_connector_client.py +12 -12
- oci/secrets/secrets_client.py +3 -3
- oci/security_attribute/security_attribute_client.py +18 -18
- oci/service_catalog/service_catalog_client.py +26 -26
- oci/service_manager_proxy/service_manager_proxy_client.py +2 -2
- oci/service_mesh/service_mesh_client.py +96 -96
- oci/stack_monitoring/stack_monitoring_client.py +87 -87
- oci/streaming/stream_admin_client.py +18 -18
- oci/streaming/stream_client.py +8 -8
- oci/tenant_manager_control_plane/domain_client.py +5 -5
- oci/tenant_manager_control_plane/domain_governance_client.py +5 -5
- oci/tenant_manager_control_plane/governance_client.py +2 -2
- oci/tenant_manager_control_plane/link_client.py +3 -3
- oci/tenant_manager_control_plane/orders_client.py +2 -2
- oci/tenant_manager_control_plane/organization_client.py +10 -10
- oci/tenant_manager_control_plane/recipient_invitation_client.py +5 -5
- oci/tenant_manager_control_plane/sender_invitation_client.py +5 -5
- oci/tenant_manager_control_plane/subscription_client.py +11 -11
- oci/tenant_manager_control_plane/work_request_client.py +4 -4
- oci/threat_intelligence/threatintel_client.py +5 -5
- oci/usage/resources_client.py +2 -2
- oci/usage/rewards_client.py +6 -6
- oci/usage/usagelimits_client.py +1 -1
- oci/usage_api/usageapi_client.py +33 -33
- oci/vault/vaults_client.py +13 -13
- oci/vbs_inst/vbs_instance_client.py +10 -10
- oci/version.py +1 -1
- oci/visual_builder/vb_instance_client.py +14 -14
- oci/vn_monitoring/vn_monitoring_client.py +12 -12
- oci/vulnerability_scanning/vulnerability_scanning_client.py +58 -58
- oci/waa/waa_client.py +13 -13
- oci/waa/work_request_client.py +4 -4
- oci/waas/redirect_client.py +6 -6
- oci/waas/waas_client.py +66 -66
- oci/waf/waf_client.py +24 -24
- oci/wlms/weblogic_management_service_client.py +41 -41
- oci/wlms/weblogic_management_service_configuration_client.py +2 -2
- oci/work_requests/work_request_client.py +4 -4
- oci/zpr/zpr_client.py +15 -15
- {oci-2.154.2.dist-info → oci-2.155.0.dist-info}/METADATA +1 -1
- {oci-2.154.2.dist-info → oci-2.155.0.dist-info}/RECORD +520 -413
- {oci-2.154.2.dist-info → oci-2.155.0.dist-info}/LICENSE.txt +0 -0
- {oci-2.154.2.dist-info → oci-2.155.0.dist-info}/THIRD_PARTY_LICENSES.txt +0 -0
- {oci-2.154.2.dist-info → oci-2.155.0.dist-info}/WHEEL +0 -0
- {oci-2.154.2.dist-info → oci-2.155.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,420 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
3
|
+
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
|
4
|
+
|
5
|
+
|
6
|
+
import abc
|
7
|
+
import asyncio
|
8
|
+
import json
|
9
|
+
import sys
|
10
|
+
from abc import ABC, abstractmethod
|
11
|
+
|
12
|
+
from asyncio.subprocess import Process
|
13
|
+
from contextlib import AsyncExitStack, asynccontextmanager
|
14
|
+
from typing import Any, TextIO, Optional
|
15
|
+
|
16
|
+
from mcp import ClientSession, StdioServerParameters
|
17
|
+
from mcp.client.session_group import StreamableHttpParameters
|
18
|
+
from mcp import Tool as MCPTool
|
19
|
+
from mcp import stdio_client
|
20
|
+
from mcp.client.streamable_http import streamablehttp_client
|
21
|
+
from mcp.types import CallToolResult
|
22
|
+
|
23
|
+
from oci.addons.adk.agent_error import AgentError
|
24
|
+
from oci.addons.adk.logger import default_logger as logger
|
25
|
+
from oci.addons.adk.tool import FunctionTool
|
26
|
+
from oci.addons.adk.tool.toolkit import Toolkit
|
27
|
+
|
28
|
+
|
29
|
+
class MCPClient(ABC):
|
30
|
+
"""Abstract base class for a MCP Client.
|
31
|
+
|
32
|
+
This class defines the interface for a MCP client, without imposing implementation
|
33
|
+
approach (e.g., Anthropic's ClientSession), or transport (e.g., stdio, SSE, etc.).
|
34
|
+
"""
|
35
|
+
|
36
|
+
@abstractmethod
|
37
|
+
async def connect(self):
|
38
|
+
"""Connect to the server.
|
39
|
+
|
40
|
+
This can spawn a subprocess or open a network connection, depending
|
41
|
+
on the transport used in the subclass's implementation.
|
42
|
+
|
43
|
+
The server will remain connected until `cleanup()` is called.
|
44
|
+
"""
|
45
|
+
pass
|
46
|
+
|
47
|
+
@abstractmethod
|
48
|
+
async def cleanup(self):
|
49
|
+
"""Cleanup the server connection.
|
50
|
+
|
51
|
+
This can close a subprocess or close a network connection, depending
|
52
|
+
on the transport used in the subclass's implementation.
|
53
|
+
"""
|
54
|
+
pass
|
55
|
+
|
56
|
+
@property
|
57
|
+
@abstractmethod
|
58
|
+
def name(self) -> str:
|
59
|
+
"""A readable name for the connection to the server.
|
60
|
+
|
61
|
+
This is used for logging and debugging purposes.
|
62
|
+
"""
|
63
|
+
pass
|
64
|
+
|
65
|
+
@abstractmethod
|
66
|
+
async def list_tools(self) -> list[MCPTool]:
|
67
|
+
"""List the tools available on the connected server.
|
68
|
+
|
69
|
+
Returns:
|
70
|
+
A list of `MCPTool` objects.
|
71
|
+
"""
|
72
|
+
pass
|
73
|
+
|
74
|
+
@abstractmethod
|
75
|
+
async def call_tool(
|
76
|
+
self, tool_name: str, arguments: dict[str, Any] | None
|
77
|
+
) -> CallToolResult:
|
78
|
+
"""Invoke a tool on the connected server.
|
79
|
+
|
80
|
+
Args:
|
81
|
+
tool_name: The name of the tool to invoke.
|
82
|
+
arguments: The arguments to pass to the tool.
|
83
|
+
|
84
|
+
Returns:
|
85
|
+
The result of the tool call.
|
86
|
+
"""
|
87
|
+
pass
|
88
|
+
|
89
|
+
|
90
|
+
class MCPClientBase(MCPClient, abc.ABC):
|
91
|
+
"""Base MCP Client that uses `ClientSession` to communicate with the server.
|
92
|
+
|
93
|
+
This class provides the core implementation of a MCP client.
|
94
|
+
It is intended to be used as a base class for MCP clients that
|
95
|
+
use a specific transport (e.g., STDIO, SSE, etc.).
|
96
|
+
"""
|
97
|
+
|
98
|
+
def __init__(self) -> None:
|
99
|
+
"""Initialize the MCP client."""
|
100
|
+
self.session: ClientSession | None = None
|
101
|
+
self.exit_stack: AsyncExitStack = AsyncExitStack()
|
102
|
+
self._cleanup_lock: asyncio.Lock = asyncio.Lock()
|
103
|
+
self._tools_list: list[MCPTool] | None = None
|
104
|
+
self.stderr: TextIO = sys.stderr
|
105
|
+
|
106
|
+
@abstractmethod
|
107
|
+
def create_context_manager(
|
108
|
+
self,
|
109
|
+
process: Optional[Process] = None,
|
110
|
+
stderr: TextIO = sys.stderr,
|
111
|
+
):
|
112
|
+
"""Create the context manager for the server."""
|
113
|
+
pass
|
114
|
+
|
115
|
+
async def connect(self):
|
116
|
+
"""Connect to the server.
|
117
|
+
|
118
|
+
Connect to the server using ClientSession.
|
119
|
+
"""
|
120
|
+
try:
|
121
|
+
transport, process = await self.exit_stack.enter_async_context(
|
122
|
+
self.create_context_manager(self._process, stderr=self.stderr)
|
123
|
+
)
|
124
|
+
read, write = transport
|
125
|
+
self.session = await self.exit_stack.enter_async_context(
|
126
|
+
ClientSession(read, write)
|
127
|
+
)
|
128
|
+
await self.session.initialize()
|
129
|
+
except Exception as e:
|
130
|
+
logger.error(f"Error initializing MCP server: {e}")
|
131
|
+
await self.cleanup()
|
132
|
+
raise
|
133
|
+
|
134
|
+
async def cleanup(self):
|
135
|
+
"""Cleanup the server connection."""
|
136
|
+
async with self._cleanup_lock:
|
137
|
+
try:
|
138
|
+
if self.exit_stack:
|
139
|
+
await self.exit_stack.aclose()
|
140
|
+
await asyncio.get_running_loop().shutdown_asyncgens()
|
141
|
+
self.session = None
|
142
|
+
except Exception as e:
|
143
|
+
logger.error(f"Error cleaning up server: {e}")
|
144
|
+
|
145
|
+
async def list_tools(self) -> list[MCPTool]:
|
146
|
+
"""List the MCP tools available on the server.
|
147
|
+
|
148
|
+
Returns:
|
149
|
+
A list of `MCPTool` objects.
|
150
|
+
"""
|
151
|
+
if not self.session:
|
152
|
+
raise AgentError(
|
153
|
+
"Server not initialized. Make sure you call `connect()` first."
|
154
|
+
)
|
155
|
+
self._tools_list = (await self.session.list_tools()).tools
|
156
|
+
return self._tools_list
|
157
|
+
|
158
|
+
async def call_tool(
|
159
|
+
self, tool_name: str, arguments: dict[str, Any] | None
|
160
|
+
) -> CallToolResult:
|
161
|
+
"""Call an MCP tool on the server.
|
162
|
+
|
163
|
+
Args:
|
164
|
+
tool_name: The name of the MCP tool to invoke.
|
165
|
+
arguments: The arguments to pass to the MCP tool.
|
166
|
+
|
167
|
+
Returns:
|
168
|
+
The result of the tool call.
|
169
|
+
"""
|
170
|
+
if not self.session:
|
171
|
+
raise AgentError(
|
172
|
+
"Server not initialized. Make sure you call `connect()` first."
|
173
|
+
)
|
174
|
+
return await self.session.call_tool(tool_name, arguments)
|
175
|
+
|
176
|
+
async def as_toolkit(self) -> Toolkit:
|
177
|
+
"""Converts the MCP tools available on the server to an ADK `Toolkit`.
|
178
|
+
|
179
|
+
This fetches the MCP tools available on the server and converts them
|
180
|
+
to ADK `ToolKit` (a collection of ADK `FunctionTool`s).
|
181
|
+
|
182
|
+
Returns:
|
183
|
+
A `Toolkit` object.
|
184
|
+
"""
|
185
|
+
mcp_tools = await self.list_tools()
|
186
|
+
function_tools = [self._to_function_tool(tool) for tool in mcp_tools]
|
187
|
+
toolkit = Toolkit()
|
188
|
+
toolkit.add_function_tools(function_tools)
|
189
|
+
return toolkit
|
190
|
+
|
191
|
+
def _to_function_tool(self, tool: MCPTool) -> FunctionTool:
|
192
|
+
"""Convert an MCP tool to ADK `FunctionTool`.
|
193
|
+
|
194
|
+
Args:
|
195
|
+
tool: The MCP tool to convert
|
196
|
+
|
197
|
+
Returns:
|
198
|
+
A `FunctionTool` that wraps the MCP tool functionality
|
199
|
+
"""
|
200
|
+
|
201
|
+
# Create a wrapper callable (upon being called, execute self._invoke_mcp_tool)
|
202
|
+
async def invoke_mcp_tool_proxy(**kwargs) -> Any:
|
203
|
+
# Convert kwargs to JSON string
|
204
|
+
input_json = json.dumps(kwargs) if kwargs else ""
|
205
|
+
return await self._invoke_mcp_tool(tool, input_json)
|
206
|
+
|
207
|
+
# Truncate the tool description to 510 characters(OCI Tool description supports a limit of 512 characters)
|
208
|
+
truncated_tool_description = (tool.description or "No description provided")[:510]
|
209
|
+
|
210
|
+
# Create the function tool using the tool's metadata
|
211
|
+
return FunctionTool(
|
212
|
+
name=tool.name,
|
213
|
+
description=truncated_tool_description,
|
214
|
+
parameters=tool.inputSchema,
|
215
|
+
callable=invoke_mcp_tool_proxy,
|
216
|
+
)
|
217
|
+
|
218
|
+
async def _invoke_mcp_tool(self, tool: MCPTool, input_json: str) -> str:
|
219
|
+
"""Invoke an MCP tool and return the result as a string.
|
220
|
+
|
221
|
+
Args:
|
222
|
+
tool: The MCP tool to invoke
|
223
|
+
input_json: The input to pass to the MCP tool
|
224
|
+
|
225
|
+
Returns:
|
226
|
+
The result of the tool call
|
227
|
+
"""
|
228
|
+
|
229
|
+
try:
|
230
|
+
json_data: dict[str, Any] = json.loads(input_json) if input_json else {}
|
231
|
+
except Exception as e:
|
232
|
+
raise AgentError(
|
233
|
+
f"Invalid JSON input for MCP tool {tool.name}: {input_json}"
|
234
|
+
) from e
|
235
|
+
|
236
|
+
try:
|
237
|
+
call_tool_result = await self.call_tool(tool.name, json_data)
|
238
|
+
self._log_mcp_tool_call(tool.name, json_data, call_tool_result)
|
239
|
+
except Exception as e:
|
240
|
+
raise AgentError(f"Error invoking MCP tool {tool.name}") from e
|
241
|
+
|
242
|
+
if len(call_tool_result.content) == 1:
|
243
|
+
tool_output_item = call_tool_result.content[0]
|
244
|
+
return tool_output_item.model_dump_json()
|
245
|
+
|
246
|
+
if len(call_tool_result.content) > 1:
|
247
|
+
tool_output_list = [item.model_dump() for item in call_tool_result.content]
|
248
|
+
return json.dumps(tool_output_list)
|
249
|
+
|
250
|
+
return "Error invoking MCP tool; call_tool_result.content is an empty list"
|
251
|
+
|
252
|
+
def _log_mcp_tool_call(
|
253
|
+
self,
|
254
|
+
tool_name: str,
|
255
|
+
tool_args: dict[str, Any],
|
256
|
+
call_tool_result: CallToolResult,
|
257
|
+
) -> None:
|
258
|
+
"""
|
259
|
+
Log a MCP tool call.
|
260
|
+
|
261
|
+
Args:
|
262
|
+
tool_name: The name of the MCP tool
|
263
|
+
tool_args: The input to the MCP tool
|
264
|
+
tool_output: The output from the MCP tool
|
265
|
+
"""
|
266
|
+
|
267
|
+
message_text = (
|
268
|
+
f"MCP tool name:\n[bold green]{tool_name}[/bold green]\n\n"
|
269
|
+
f"MCP tool args:\n[bold magenta]{tool_args}[/bold magenta]\n\n"
|
270
|
+
f"MCP tool call result:\n[bold magenta]{call_tool_result.model_dump_json()}[/bold magenta]" # noqa: E501
|
271
|
+
)
|
272
|
+
logger.print(
|
273
|
+
message=message_text,
|
274
|
+
title="MCP tool call result",
|
275
|
+
border_style="blue",
|
276
|
+
expand=False,
|
277
|
+
)
|
278
|
+
|
279
|
+
async def __aenter__(self):
|
280
|
+
"""Enter the context manager.
|
281
|
+
|
282
|
+
Upon entering the context manager, we establish a connection to the
|
283
|
+
server and return a context manager for the transport.
|
284
|
+
"""
|
285
|
+
logger.debug(f"Entering context manager for {self.name}")
|
286
|
+
await self.connect()
|
287
|
+
return self
|
288
|
+
|
289
|
+
async def __aexit__(self, exc_type, exc_value, traceback):
|
290
|
+
"""Exit the context manager.
|
291
|
+
|
292
|
+
Upon exiting the context manager, we close the connection to the server.
|
293
|
+
"""
|
294
|
+
logger.debug(f"Exiting context manager for {self.name}")
|
295
|
+
await self.cleanup()
|
296
|
+
|
297
|
+
|
298
|
+
class MCPClientStdio(MCPClientBase):
|
299
|
+
"""MCP Client that uses the stdio transport to communicate with a MCP Server."""
|
300
|
+
|
301
|
+
def __init__(
|
302
|
+
self,
|
303
|
+
params: StdioServerParameters,
|
304
|
+
name: str | None = None,
|
305
|
+
):
|
306
|
+
"""
|
307
|
+
Create a new MCP Client based on the stdio transport.
|
308
|
+
Args:
|
309
|
+
params: a dictionary of params that configure the server to be connected to.
|
310
|
+
name: A readable name for the client connection.
|
311
|
+
"""
|
312
|
+
super().__init__()
|
313
|
+
self.params = params
|
314
|
+
self._name = (
|
315
|
+
name or f"MCPClientStdio(command={self.params.command}, args={self.params.args})"
|
316
|
+
)
|
317
|
+
self._process: Optional[Process] = None
|
318
|
+
|
319
|
+
@asynccontextmanager
|
320
|
+
async def create_context_manager(
|
321
|
+
self,
|
322
|
+
process: Optional[Process] = None,
|
323
|
+
stderr: TextIO = sys.stderr,
|
324
|
+
):
|
325
|
+
"""Create the context manager for the server."""
|
326
|
+
if not process:
|
327
|
+
self._process = await asyncio.create_subprocess_exec(
|
328
|
+
self.params.command,
|
329
|
+
*self.params.args,
|
330
|
+
stdin=asyncio.subprocess.PIPE,
|
331
|
+
stdout=asyncio.subprocess.PIPE,
|
332
|
+
stderr=stderr,
|
333
|
+
)
|
334
|
+
process = self._process
|
335
|
+
logger.info(f"MCP client created with pid: {process.pid}")
|
336
|
+
|
337
|
+
async with stdio_client(server=self.params, errlog=stderr) as context_manager:
|
338
|
+
yield context_manager, process
|
339
|
+
|
340
|
+
async def cleanup(self):
|
341
|
+
"""Cleanup the server connection."""
|
342
|
+
async with self._cleanup_lock:
|
343
|
+
try:
|
344
|
+
# Finally, clean the exit stack
|
345
|
+
if self.exit_stack:
|
346
|
+
await self.exit_stack.aclose()
|
347
|
+
# Still active process, attempt terminating
|
348
|
+
if self._process and self._process.returncode is None:
|
349
|
+
try:
|
350
|
+
logger.info(f"Closing MCP process with pid: {self._process.pid}")
|
351
|
+
self._process.terminate()
|
352
|
+
await asyncio.wait_for(self._process.wait(), timeout=5.0)
|
353
|
+
|
354
|
+
except (asyncio.CancelledError, asyncio.TimeoutError):
|
355
|
+
logger.warning("MCP process was canceled or timed out terminating, attempting to kill")
|
356
|
+
self._process.kill()
|
357
|
+
await asyncio.wait_for(self._process.wait(), timeout=5.0)
|
358
|
+
finally:
|
359
|
+
logger.info(
|
360
|
+
f"MCP process pid: {self._process.pid} returned code {self._process.returncode}"
|
361
|
+
)
|
362
|
+
|
363
|
+
self.session = None
|
364
|
+
except Exception as e:
|
365
|
+
logger.error(f"Error cleaning up server: {e}")
|
366
|
+
|
367
|
+
@property
|
368
|
+
def name(self) -> str:
|
369
|
+
"""A readable name for the client connection."""
|
370
|
+
return self._name
|
371
|
+
|
372
|
+
|
373
|
+
class MCPClientStreamableHttp(MCPClientBase):
|
374
|
+
"""MCP Client that uses the streamable HTTP transport to communicate with a MCP Server.
|
375
|
+
Implements the Streamable HTTP transport as defined in the Model Context Protocol specification.
|
376
|
+
See: https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http
|
377
|
+
"""
|
378
|
+
|
379
|
+
def __init__(
|
380
|
+
self,
|
381
|
+
params: StreamableHttpParameters,
|
382
|
+
name: str | None = None,
|
383
|
+
client_session_timeout_seconds: float | None = 5
|
384
|
+
):
|
385
|
+
"""Create a new MCP Client based on the HTTP transport.
|
386
|
+
|
387
|
+
Args:
|
388
|
+
params: The parameters for the MCP Server.
|
389
|
+
name: A readable name for the client connection.
|
390
|
+
If not provided, we'll create one from the URL.
|
391
|
+
client_session_timeout_seconds: The read timeout passed to the MCP ClientSession.
|
392
|
+
Defaults to 5 seconds.
|
393
|
+
"""
|
394
|
+
super().__init__()
|
395
|
+
self.params = params
|
396
|
+
self._name = name or f"MCPServerStreamableHttp(url={self.params.url})"
|
397
|
+
self.client_session_timeout_seconds = client_session_timeout_seconds
|
398
|
+
self._process = None # Not used for HTTP, but required for interface compatibility
|
399
|
+
|
400
|
+
@asynccontextmanager
|
401
|
+
async def create_context_manager(
|
402
|
+
self,
|
403
|
+
process,
|
404
|
+
stderr,
|
405
|
+
):
|
406
|
+
"""Create the context manager for the server using streamable HTTP transport."""
|
407
|
+
transport = streamablehttp_client(
|
408
|
+
url=self.params.url,
|
409
|
+
headers=self.params.headers,
|
410
|
+
timeout=self.params.timeout,
|
411
|
+
sse_read_timeout=self.params.sse_read_timeout,
|
412
|
+
terminate_on_close=self.params.terminate_on_close
|
413
|
+
)
|
414
|
+
async with transport as (read_stream, write_stream, _):
|
415
|
+
yield (read_stream, write_stream), process
|
416
|
+
|
417
|
+
@property
|
418
|
+
def name(self) -> str:
|
419
|
+
"""A readable name for the client connection."""
|
420
|
+
return self._name
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
3
3
|
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
|
4
4
|
|
5
|
+
import asyncio
|
5
6
|
from inspect import getdoc, ismethod, signature
|
6
7
|
from typing import Any, Callable, Dict, get_type_hints
|
7
8
|
|
@@ -179,7 +180,7 @@ class FunctionTool(BaseModel):
|
|
179
180
|
),
|
180
181
|
)
|
181
182
|
|
182
|
-
def execute(self, arguments: Dict[str, Any]) -> Any:
|
183
|
+
async def execute(self, arguments: Dict[str, Any]) -> Any:
|
183
184
|
"""
|
184
185
|
Execute the function with the given arguments.
|
185
186
|
|
@@ -195,8 +196,11 @@ class FunctionTool(BaseModel):
|
|
195
196
|
# Clean and filter arguments
|
196
197
|
filtered_args = self._prepare_arguments(arguments)
|
197
198
|
|
198
|
-
|
199
|
-
|
199
|
+
if asyncio.iscoroutinefunction(self.callable):
|
200
|
+
result = await self.callable(**filtered_args)
|
201
|
+
else:
|
202
|
+
# Invoke the callable with the filtered arguments
|
203
|
+
result = self.callable(**filtered_args)
|
200
204
|
|
201
205
|
return result
|
202
206
|
|
oci/addons/adk/tool/tool.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
3
3
|
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
|
4
4
|
|
5
|
+
import inspect
|
5
6
|
from functools import wraps
|
6
7
|
|
7
8
|
from oci.addons.adk.util import get_callable_description
|
@@ -19,9 +20,18 @@ def tool(func=None, *, name=None, description=None):
|
|
19
20
|
|
20
21
|
def decorator(func):
|
21
22
|
@wraps(func)
|
22
|
-
def
|
23
|
+
def sync_wrapper(*args, **kwargs):
|
23
24
|
return func(*args, **kwargs)
|
24
25
|
|
26
|
+
@wraps(func)
|
27
|
+
async def async_wrapper(*args, **kwargs):
|
28
|
+
return await func(*args, **kwargs)
|
29
|
+
|
30
|
+
if inspect.iscoroutinefunction(func):
|
31
|
+
wrapper = async_wrapper
|
32
|
+
else:
|
33
|
+
wrapper = sync_wrapper
|
34
|
+
|
25
35
|
# wrap the function with tool metadata
|
26
36
|
wrapper._is_tool = True
|
27
37
|
wrapper._tool_name = name or func.__name__
|
oci/addons/adk/tool/toolkit.py
CHANGED
@@ -128,7 +128,16 @@ class Toolkit(BaseModel):
|
|
128
128
|
self._add_function_tool_from_openai(attr, matching_openai_tool)
|
129
129
|
else:
|
130
130
|
# Create FunctionTool from method decoration
|
131
|
-
self.
|
131
|
+
self._add_function_tool_from_callable(attr)
|
132
|
+
|
133
|
+
def add_function_tool(self, func_tool: FunctionTool) -> None:
|
134
|
+
"""Add a function tool to the toolkit."""
|
135
|
+
self.functions[func_tool.name] = func_tool
|
136
|
+
|
137
|
+
def add_function_tools(self, func_tools: list[FunctionTool]) -> None:
|
138
|
+
"""Add a list of function tools to the toolkit."""
|
139
|
+
for func_tool in func_tools:
|
140
|
+
self.add_function_tool(func_tool)
|
132
141
|
|
133
142
|
def get_registered_tools(self) -> List[FunctionTool]:
|
134
143
|
"""Return a list of all registered tools in the toolkit."""
|
@@ -155,7 +164,7 @@ class Toolkit(BaseModel):
|
|
155
164
|
f"Executing mock function implementation with received arguments: {args}"
|
156
165
|
)
|
157
166
|
|
158
|
-
def
|
167
|
+
def _add_function_tool_from_callable(self, callable: Callable[..., Any]) -> None:
|
159
168
|
"""Internal method to add a function as a tool to the toolkit.
|
160
169
|
|
161
170
|
Args:
|