Skip to main content
Glama
smith-nathanh

Oracle MCP Server

list_views

Retrieve all database views to understand data structures. Filter by schema owner to focus on specific data sets.

Instructions

List all views in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerNoFilter by schema owner (optional)

Implementation Reference

  • MCP tool call handler branch for 'list_views': extracts optional 'owner' parameter from arguments, calls DatabaseInspector.get_views(owner), formats the views list as JSON, and returns as TextContent.
    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), ) ]
  • Core helper method in DatabaseInspector class that executes SQL query against ALL_VIEWS and ALL_TAB_COMMENTS to retrieve views filtered by optional owner, including owner, view_name, and view_comment.
    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 handle_list_tools(), specifying name, description, and input schema with optional 'owner' parameter.
    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, } }, }, ),
  • Pydantic/MCP input schema for 'list_views' tool: object with optional 'owner' string property for filtering views by schema.
    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