@@ -200,7 +200,7 @@ impl DatabricksTool for DatabricksListTables {
200200 type Error = String ;
201201
202202 fn name ( & self ) -> String {
203- "databricks_list_tables " . to_string ( )
203+ "databricks_find_tables " . to_string ( )
204204 }
205205
206206 fn definition ( & self ) -> rig:: completion:: ToolDefinition {
@@ -253,18 +253,26 @@ impl DatabricksTool for DatabricksListTables {
253253 match client. list_tables ( & request) . await {
254254 Ok ( result) => {
255255 if result. tables . is_empty ( ) {
256- Ok ( Ok ( format ! (
257- "No tables found in '{}.{}'." ,
258- args. catalog_name, args. schema_name
259- ) ) )
256+ let location = match ( & args. catalog_name , & args. schema_name ) {
257+ ( Some ( c) , Some ( s) ) => format ! ( "'{}.{}'" , c, s) ,
258+ ( Some ( c) , None ) => format ! ( "catalog '{}'" , c) ,
259+ ( None , None ) => "any catalog/schema" . to_string ( ) ,
260+ _ => "specified location" . to_string ( ) ,
261+ } ;
262+ Ok ( Ok ( format ! ( "No tables found in {}." , location) ) )
260263 } else {
261264 Ok ( Ok ( result. display ( ) ) )
262265 }
263266 }
264- Err ( e) => Ok ( Err ( format ! (
265- "Failed to list tables in '{}.{}': {}" ,
266- args. catalog_name, args. schema_name, e
267- ) ) ) ,
267+ Err ( e) => {
268+ let location = match ( & args. catalog_name , & args. schema_name ) {
269+ ( Some ( c) , Some ( s) ) => format ! ( "'{}.{}'" , c, s) ,
270+ ( Some ( c) , None ) => format ! ( "catalog '{}'" , c) ,
271+ ( None , None ) => "any catalog/schema" . to_string ( ) ,
272+ _ => "specified location" . to_string ( ) ,
273+ } ;
274+ Ok ( Err ( format ! ( "Failed to list tables in {}: {}" , location, e) ) )
275+ }
268276 }
269277 }
270278}
0 commit comments