Skip to main content
Glama
smith-nathanh

Oracle MCP Server

list_views

Browse and retrieve all database views to analyze schema structure and available data perspectives. Filter by schema owner to focus on specific database segments.

Instructions

List all views in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerNoFilter by schema owner (optional)

Implementation Reference

  • Core handler function that queries Oracle ALL_VIEWS and ALL_TAB_COMMENTS to retrieve list of views with owners and comments, supporting optional owner filter.
    async def get_views(self, owner: Optional[str] = None) -> List[Dict[str, Any]]: """Get list of views""" conn = await self.connection_manager.get_connection() try: cursor = conn.cursor() query = """ SELECT v.owner, v.view_name, vc.comments as view_comment FROM all_views v LEFT JOIN all_tab_comments vc ON v.owner = vc.owner AND v.view_name = vc.table_name WHERE 1=1 """ params = [] if owner: query += " AND v.owner = :owner" params.append(owner) query += " ORDER BY v.owner, v.view_name" cursor.execute(query, params) views = [] for row in cursor: views.append( {"owner": row[0], "view_name": row[1], "view_comment": row[2]} ) return views finally: conn.close()
  • Registers the list_views tool with the MCP server in the list_tools handler, including description and input schema.
    Tool( name="list_views", description="List all views in the database", inputSchema={ "type": "object", "properties": { "owner": { "type": "string", "description": "Filter by schema owner (optional)", "default": None, } }, }, ),
  • Dispatch handler in call_tool that invokes the get_views method and formats the response as JSON text content.
    elif name == "list_views": owner = arguments.get("owner") views = await self.inspector.get_views(owner) return [ TextContent( type="text", text=json.dumps({"views": views}, indent=2, default=str), ) ]
  • Defines the input schema for the list_views tool, accepting an optional 'owner' string parameter.
    inputSchema={ "type": "object", "properties": { "owner": { "type": "string", "description": "Filter by schema owner (optional)", "default": None, } },

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/smith-nathanh/oracle-mcp-server'

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