get_app_sheets
Retrieve sheet titles and descriptions from Qlik Sense applications to analyze dashboard structure and content organization.
Instructions
Get list of sheets from application with title and description.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | Application GUID |
Implementation Reference
- Core handler function that implements get_app_sheets logic by creating a SheetList session object in Qlik Engine API, retrieving its layout, and extracting sheet information including ID, title, and description.
def get_sheets(self, app_handle: int) -> List[Dict[str, Any]]: """Get app sheets.""" try: sheet_list_def = { "qInfo": {"qType": "SheetList"}, "qAppObjectListDef": { "qType": "sheet", "qData": { "title": "/qMetaDef/title", "description": "/qMetaDef/description", "thumbnail": "/thumbnail", "cells": "/cells", "rank": "/rank", "columns": "/columns", "rows": "/rows" } } } create_result = self.send_request("CreateSessionObject", [sheet_list_def], handle=app_handle) if "qReturn" not in create_result or "qHandle" not in create_result["qReturn"]: logger.warning(f"Failed to create SheetList object: {create_result}") return [] sheet_list_handle = create_result["qReturn"]["qHandle"] layout_result = self.send_request("GetLayout", [], handle=sheet_list_handle) if "qLayout" not in layout_result or "qAppObjectList" not in layout_result["qLayout"]: logger.warning(f"No sheet list in layout: {layout_result}") return [] sheets = layout_result["qLayout"]["qAppObjectList"]["qItems"] logger.info(f"Found {len(sheets)} sheets") return sheets except Exception as e: logger.error(f"get_sheets exception: {str(e)}") return [] - qlik_sense_mcp_server/server.py:857-891 (handler)MCP server tool dispatch handler for get_app_sheets: validates input, connects to Engine API, opens app, calls engine_api.get_sheets, formats response with sheet_id, title, description, and returns JSON.
elif name == "get_app_sheets": app_id = arguments["app_id"] def _get_app_sheets(): try: self.engine_api.connect() app_result = self.engine_api.open_doc_safe(app_id, no_data=True) app_handle = app_result.get("qReturn", {}).get("qHandle", -1) if app_handle == -1: return {"error": "Failed to open app"} sheets = self.engine_api.get_sheets(app_handle) sheets_list = [] for sheet in sheets: sheet_info = sheet.get("qMeta", {}) sheet_data = sheet.get("qData", {}) sheets_list.append({ "sheet_id": sheet.get("qInfo", {}).get("qId", ""), "title": sheet_info.get("title", ""), "description": sheet_info.get("description", "") }) return { "app_id": app_id, "total_sheets": len(sheets_list), "sheets": sheets_list } except Exception as e: return {"error": str(e)} finally: self.engine_api.disconnect() result = await asyncio.to_thread(_get_app_sheets) return [TextContent(type="text", text=json.dumps(result, indent=2, ensure_ascii=False))] - Tool schema definition: requires 'app_id' (Application GUID), describes purpose of retrieving sheets with titles and descriptions.
Tool( name="get_app_sheets", description="Get list of sheets from application with title and description.", inputSchema={ "type": "object", "properties": { "app_id": {"type": "string", "description": "Application GUID"} }, "required": ["app_id"] } ), - qlik_sense_mcp_server/server.py:218-397 (registration)MCP tool registration in list_tools handler: registers get_app_sheets among other tools with its schema and description for client discovery.
@self.server.list_tools() async def handle_list_tools(): """ List all available MCP tools for Qlik Sense operations. Returns tool definitions with schemas for Repository API and Engine API operations including applications, analytics tools, and data export. """ tools_list = [ Tool( name="get_apps", description="Get list of Qlik Sense applications with essential fields and filters (name, stream, published) and pagination.", inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Maximum number of apps to return (default: 25, max: 50)", "default": 25 }, "offset": { "type": "integer", "description": "Number of apps to skip for pagination (default: 0)", "default": 0 }, "name": { "type": "string", "description": "Wildcard case-insensitive search in application name" }, "stream": { "type": "string", "description": "Wildcard case-insensitive search in stream name" }, "published": { "type": "string", "description": "Filter by published status (true/false or 1/0). Default: true", "default": "true" } } } ), Tool( name="get_app_details", description="Get compact application info with filters by guid or name (case-insensitive). Returns metainfo, tables/fields list, master items, sheets and objects with used fields.", inputSchema={ "type": "object", "properties": { "app_id": {"type": "string", "description": "Application GUID (preferred if known)"}, "name": {"type": "string", "description": "Case-insensitive fuzzy search by app name"} }, "oneOf": [ {"required": ["app_id"]}, {"required": ["name"]} ] } ), Tool(name="get_app_script", description="Get load script from app", inputSchema={"type": "object", "properties": {"app_id": {"type": "string", "description": "Application ID"}}, "required": ["app_id"]}), Tool(name="get_app_field_statistics", description="Get comprehensive statistics for a field", inputSchema={"type": "object", "properties": {"app_id": {"type": "string", "description": "Application ID"}, "field_name": {"type": "string", "description": "Field name"}}, "required": ["app_id", "field_name"]}), Tool(name="engine_create_hypercube", description="Create hypercube for data analysis with custom sorting options. IMPORTANT: To get top-N records, use qSortByExpression: 1 in dimension sorting with qExpression containing the measure formula (e.g., 'Count(field)' for ascending, '-Count(field)' for descending). Measure sorting is ignored by Qlik Engine.", inputSchema={ "type": "object", "properties": { "app_id": {"type": "string", "description": "Application ID"}, "dimensions": { "type": "array", "items": { "type": "object", "properties": { "field": {"type": "string", "description": "Field name for dimension"}, "label": {"type": "string", "description": "Optional label for dimension"}, "sort_by": { "type": "object", "properties": { "qSortByNumeric": {"type": "integer", "description": "Sort by numeric value (-1 desc, 0 none, 1 asc)", "default": 0}, "qSortByAscii": {"type": "integer", "description": "Sort by ASCII value (-1 desc, 0 none, 1 asc)", "default": 1}, "qSortByExpression": {"type": "integer", "description": "Use expression for sorting (0/1). For top-N results, set to 1 and use qExpression with measure formula", "default": 0}, "qExpression": {"type": "string", "description": "Expression for custom sorting. For top-N: 'Count(field)' for ascending, '-Count(field)' for descending", "default": ""} }, "additionalProperties": False } }, "additionalProperties": False }, "description": "List of dimension definitions with optional sorting" }, "measures": { "type": "array", "items": { "type": "object", "properties": { "expression": {"type": "string", "description": "Measure expression"}, "label": {"type": "string", "description": "Optional label for measure"}, "sort_by": { "type": "object", "properties": { "qSortByNumeric": {"type": "integer", "description": "Sort by numeric value (-1 desc, 0 none, 1 asc). NOTE: Measure sorting is ignored by Qlik Engine - use dimension sorting with qSortByExpression for top-N results", "default": -1} }, "additionalProperties": False } }, "additionalProperties": False }, "description": "List of measure definitions with optional sorting" }, "max_rows": {"type": "integer", "description": "Maximum rows to return", "default": 1000} }, "required": ["app_id"] }) , Tool( name="get_app_field", description="Return values of a single field from app with pagination and wildcard search (supports * and %).", inputSchema={ "type": "object", "properties": { "app_id": {"type": "string", "description": "Application GUID"}, "field_name": {"type": "string", "description": "Field name"}, "limit": {"type": "integer", "description": "Max values to return (default: 10, max: 100)", "default": 10}, "offset": {"type": "integer", "description": "Offset for pagination (default: 0)", "default": 0}, "search_string": {"type": "string", "description": "Wildcard text search mask (* and % supported), case-insensitive by default"}, "search_number": {"type": "string", "description": "Wildcard numeric search mask (* and % supported)"}, "case_sensitive": {"type": "boolean", "description": "Case sensitive matching for search_string", "default": False} }, "required": ["app_id", "field_name"], } ), Tool( name="get_app_variables", description="Return variables split by source (script/ui) with pagination and wildcard search.", inputSchema={ "type": "object", "properties": { "app_id": {"type": "string", "description": "Application GUID"}, "limit": {"type": "integer", "description": "Max variables to return (default: 10, max: 100)", "default": 10}, "offset": {"type": "integer", "description": "Offset for pagination (default: 0)", "default": 0}, "created_in_script": {"type": "string", "description": "Return only variables created in script (true/false). If omitted, return both"}, "search_string": {"type": "string", "description": "Wildcard search by variable name or text value (* and % supported), case-insensitive by default"}, "search_number": {"type": "string", "description": "Wildcard search among numeric variable values (* and % supported)"}, "case_sensitive": {"type": "boolean", "description": "Case sensitive matching for search_string", "default": False} }, "required": ["app_id"], } ), Tool( name="get_app_sheets", description="Get list of sheets from application with title and description.", inputSchema={ "type": "object", "properties": { "app_id": {"type": "string", "description": "Application GUID"} }, "required": ["app_id"] } ), Tool( name="get_app_sheet_objects", description="Get list of objects from specific sheet with object ID, type and description.", inputSchema={ "type": "object", "properties": { "app_id": {"type": "string", "description": "Application GUID"}, "sheet_id": {"type": "string", "description": "Sheet GUID"} }, "required": ["app_id", "sheet_id"] } ), Tool( name="get_app_object", description="Get specific object layout by calling GetObject and GetLayout sequentially via WebSocket.", inputSchema={ "type": "object", "properties": { "app_id": {"type": "string", "description": "Application GUID"}, "object_id": {"type": "string", "description": "Object ID to retrieve"} }, "required": ["app_id", "object_id"] } ) ] return tools_list