Skip to main content
Glama
anpy-j

MCP Oracle Server

by anpy-j

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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)
  • 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()
  • 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()
Install Server

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/anpy-j/mcp-oracle'

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