Skip to main content
Glama
samscarrow

Oracle MCP Server

by samscarrow

list_tables

Retrieve tables from a specified schema or all accessible schemas in an Oracle database, filtering by table name patterns using wildcards. Streamlines database introspection for efficient SQL query preparation.

Instructions

List tables from specified schema or all accessible schemas

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternNoTable name pattern (supports % wildcards)
schemaNoSchema name (optional, shows all accessible schemas if not specified)

Implementation Reference

  • The handler function for the 'list_tables' tool. Constructs a dynamic SQL query against ALL_TABLES view with optional schema and pattern filters, executes it using executeQuery, 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) } ] }; }
  • Input schema definition for the list_tables tool, defining optional 'schema' and '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)' } } }
  • src/index.js:194-210 (registration)
    Registration of the list_tables tool in the ListToolsRequestHandler response, including name, description, and input schema.
    { 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:285-286 (registration)
    Dispatch to list_tables handler in the CallToolRequestHandler switch statement.
    case 'list_tables': return await this.handleListTables(args);

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samscarrow/oracle-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server