@@ -1372,6 +1372,32 @@ def publish_custom_source_definition(
13721372 default = True ,
13731373 ),
13741374 ] = True ,
1375+ testing_values : Annotated [
1376+ dict | str | None ,
1377+ Field (
1378+ description = (
1379+ "Optional testing configuration values for the Builder UI. "
1380+ "Can be provided as a JSON object or JSON string. "
1381+ "Supports inline secret refs via 'secret_reference::ENV_VAR_NAME' syntax. "
1382+ "If provided, these values replace any existing testing values "
1383+ "for the connector builder project, allowing immediate test read operations."
1384+ ),
1385+ default = None ,
1386+ ),
1387+ ],
1388+ testing_values_secret_name : Annotated [
1389+ str | None ,
1390+ Field (
1391+ description = (
1392+ "Optional name of a secret containing testing configuration values "
1393+ "in JSON or YAML format. The secret will be resolved by the MCP "
1394+ "server and merged into testing_values, with secret values taking "
1395+ "precedence. This lets the agent reference secrets without sending "
1396+ "raw values as tool arguments."
1397+ ),
1398+ default = None ,
1399+ ),
1400+ ],
13751401) -> str :
13761402 """Publish a custom YAML source connector definition to Airbyte Cloud.
13771403
@@ -1382,12 +1408,24 @@ def publish_custom_source_definition(
13821408 if isinstance (manifest_yaml , str ) and "\n " not in manifest_yaml :
13831409 processed_manifest = Path (manifest_yaml )
13841410
1411+ # Resolve testing values from inline config and/or secret
1412+ testing_values_dict : dict [str , Any ] | None = None
1413+ if testing_values is not None or testing_values_secret_name is not None :
1414+ testing_values_dict = (
1415+ resolve_config (
1416+ config = testing_values ,
1417+ config_secret_name = testing_values_secret_name ,
1418+ )
1419+ or None
1420+ )
1421+
13851422 workspace : CloudWorkspace = _get_cloud_workspace (workspace_id )
13861423 custom_source = workspace .publish_custom_source_definition (
13871424 name = name ,
13881425 manifest_yaml = processed_manifest ,
13891426 unique = unique ,
13901427 pre_validate = pre_validate ,
1428+ testing_values = testing_values_dict ,
13911429 )
13921430 register_guid_created_in_session (custom_source .definition_id )
13931431 return (
@@ -1447,11 +1485,15 @@ def update_custom_source_definition(
14471485 Field (description = "The ID of the definition to update." ),
14481486 ],
14491487 manifest_yaml : Annotated [
1450- str | Path ,
1488+ str | Path | None ,
14511489 Field (
1452- description = "New manifest as YAML string or file path." ,
1490+ description = (
1491+ "New manifest as YAML string or file path. "
1492+ "Optional; omit to update only testing values."
1493+ ),
1494+ default = None ,
14531495 ),
1454- ],
1496+ ] = None ,
14551497 * ,
14561498 workspace_id : Annotated [
14571499 str | None ,
@@ -1467,26 +1509,85 @@ def update_custom_source_definition(
14671509 default = True ,
14681510 ),
14691511 ] = True ,
1512+ testing_values : Annotated [
1513+ dict | str | None ,
1514+ Field (
1515+ description = (
1516+ "Optional testing configuration values for the Builder UI. "
1517+ "Can be provided as a JSON object or JSON string. "
1518+ "Supports inline secret refs via 'secret_reference::ENV_VAR_NAME' syntax. "
1519+ "If provided, these values replace any existing testing values "
1520+ "for the connector builder project. The entire testing values object "
1521+ "is overwritten, so pass the full set of values you want to persist."
1522+ ),
1523+ default = None ,
1524+ ),
1525+ ],
1526+ testing_values_secret_name : Annotated [
1527+ str | None ,
1528+ Field (
1529+ description = (
1530+ "Optional name of a secret containing testing configuration values "
1531+ "in JSON or YAML format. The secret will be resolved by the MCP "
1532+ "server and merged into testing_values, with secret values taking "
1533+ "precedence. This lets the agent reference secrets without sending "
1534+ "raw values as tool arguments."
1535+ ),
1536+ default = None ,
1537+ ),
1538+ ],
14701539) -> str :
14711540 """Update a custom YAML source definition in Airbyte Cloud.
14721541
1473- Note: Only YAML (declarative) connectors are currently supported .
1474- Docker-based custom sources are not yet available .
1542+ Updates the manifest and/or testing values for an existing custom source definition .
1543+ At least one of manifest_yaml, testing_values, or testing_values_secret_name must be provided .
14751544 """
14761545 check_guid_created_in_session (definition_id )
1477- processed_manifest = manifest_yaml
1546+
1547+ workspace : CloudWorkspace = _get_cloud_workspace (workspace_id )
1548+
1549+ if manifest_yaml is None and testing_values is None and testing_values_secret_name is None :
1550+ raise PyAirbyteInputError (
1551+ message = (
1552+ "At least one of manifest_yaml, testing_values, or testing_values_secret_name "
1553+ "must be provided to update a custom source definition."
1554+ ),
1555+ context = {
1556+ "definition_id" : definition_id ,
1557+ "workspace_id" : workspace .workspace_id ,
1558+ },
1559+ )
1560+
1561+ processed_manifest : str | Path | None = manifest_yaml
14781562 if isinstance (manifest_yaml , str ) and "\n " not in manifest_yaml :
14791563 processed_manifest = Path (manifest_yaml )
14801564
1481- workspace : CloudWorkspace = _get_cloud_workspace (workspace_id )
1565+ # Resolve testing values from inline config and/or secret
1566+ testing_values_dict : dict [str , Any ] | None = None
1567+ if testing_values is not None or testing_values_secret_name is not None :
1568+ testing_values_dict = (
1569+ resolve_config (
1570+ config = testing_values ,
1571+ config_secret_name = testing_values_secret_name ,
1572+ )
1573+ or None
1574+ )
1575+
14821576 definition = workspace .get_custom_source_definition (
14831577 definition_id = definition_id ,
14841578 definition_type = "yaml" ,
14851579 )
1486- custom_source : CustomCloudSourceDefinition = definition .update_definition (
1487- manifest_yaml = processed_manifest ,
1488- pre_validate = pre_validate ,
1489- )
1580+ custom_source : CustomCloudSourceDefinition = definition
1581+
1582+ if processed_manifest is not None :
1583+ custom_source = definition .update_definition (
1584+ manifest_yaml = processed_manifest ,
1585+ pre_validate = pre_validate ,
1586+ )
1587+
1588+ if testing_values_dict is not None :
1589+ custom_source .set_testing_values (testing_values_dict )
1590+
14901591 return (
14911592 "Successfully updated custom YAML source definition:\n "
14921593 + _get_custom_source_definition_description (
0 commit comments