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
| Name | Required | Description | Default |
|---|---|---|---|
| owner | No | Filter by schema owner (optional) |
Implementation Reference
- src/oracle_mcp_server/server.py:281-317 (handler)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()
- src/oracle_mcp_server/server.py:681-694 (registration)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, } }, }, ),
- src/oracle_mcp_server/server.py:811-820 (handler)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, } },