list_tables
Retrieve table names from Oracle database schemas using optional filters for schema and table patterns to identify available data structures.
Instructions
List tables from specified schema or all accessible schemas
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | Schema name (optional, shows all accessible schemas if not specified) | |
| pattern | No | Table name pattern (supports % wildcards) |
Implementation Reference
- src/index.js:345-379 (handler)The main handler function for the 'list_tables' tool. It constructs a dynamic SQL query against the ALL_TABLES view, applying optional filters for schema and table name pattern, executes it using the shared executeQuery method, and returns the results as JSON-formatted text content.async handleListTables(args) { let query = ` SELECT owner AS schema_name, table_name, num_rows, last_analyzed FROM all_tables WHERE 1=1 `; const params = []; if (args.schema) { query += ` AND owner = :1`; params.push(args.schema.toUpperCase()); } if (args.pattern) { query += ` AND table_name LIKE :${params.length + 1}`; params.push(args.pattern.toUpperCase()); } query += ` ORDER BY owner, table_name`; const result = await this.executeQuery(query, params); return { content: [ { type: 'text', text: JSON.stringify(result.rows, null, 2) } ] }; }
- src/index.js:194-210 (registration)Tool registration in the ListToolsRequestHandler response. Defines the tool name, description, and input schema specifying optional 'schema' and 'pattern' parameters.{ name: 'list_tables', description: 'List tables from specified schema or all accessible schemas', inputSchema: { type: 'object', properties: { schema: { type: 'string', description: 'Schema name (optional, shows all accessible schemas if not specified)' }, pattern: { type: 'string', description: 'Table name pattern (supports % wildcards)' } } } },
- src/index.js:197-209 (schema)Input schema definition for the list_tables tool, validating optional schema name and table pattern parameters.inputSchema: { type: 'object', properties: { schema: { type: 'string', description: 'Schema name (optional, shows all accessible schemas if not specified)' }, pattern: { type: 'string', description: 'Table name pattern (supports % wildcards)' } } }