list_tables
Retrieve all table names in an Oracle database using the MCP Oracle Server for database interaction and management tasks.
Instructions
Get a list of all tables in the oracle database
Args:
None
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_tables"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- Core implementation of list_tables tool: queries Oracle user_tables and returns newline-separated list of table names.
async def list_tables() -> list: tables = [] try: # Run database operations in a separate thread def db_operation(): result_tables = [] with cx_Oracle.connect(connection_string) as conn: cursor = conn.cursor() cursor.execute( "SELECT table_name FROM user_tables ORDER BY table_name") for row in cursor: result_tables.append(row[0]) return '\n'.join(result_tables) return await asyncio.to_thread(db_operation) except cx_Oracle.DatabaseError as e: print('Error occurred:', e) return str(e) - Core implementation of list_tables tool: queries Oracle user_tables and returns newline-separated list of table names.
async def list_tables() -> list: tables = [] try: # Run database operations in a separate thread def db_operation(): result_tables = [] with cx_Oracle.connect(connection_string) as conn: cursor = conn.cursor() cursor.execute( "SELECT table_name FROM user_tables ORDER BY table_name") for row in cursor: result_tables.append(row[0]) return '\n'.join(result_tables) return await asyncio.to_thread(db_operation) except cx_Oracle.DatabaseError as e: print('Error occurred:', e) return str(e) - src/mcp_server_oracle/__init__.py:19-27 (registration)Registers the list_tables tool using @mcp.tool() decorator on FastMCP server, delegating to oracle_tools.list_tables().
@mcp.tool() async def list_tables() -> str: """Get a list of all tables in the oracle database Args: None """ return await oracle_tools.list_tables() - src/mcp_server_jysd_cx_oracle/__init__.py:19-27 (registration)Registers the list_tables tool using @mcp.tool() decorator on FastMCP server, delegating to oracle_tools.list_tables().
@mcp.tool() async def list_tables() -> str: """Get a list of all tables in the oracle database Args: None """ return await oracle_tools.list_tables()