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