list_reports
Retrieve available reports from the Frappe Framework system, with optional filtering by module and limit settings to focus on specific reporting needs.
Instructions
Get a list of all available reports in the system.
Args:
module: Filter reports by module (optional)
limit: Maximum number of reports to return (default: 50)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| module | No |
Implementation Reference
- src/tools/reports.py:127-164 (handler)The main handler function for the 'list_reports' tool. It fetches a list of Frappe reports using the API, optionally filtered by module and limited in count. Formats and returns the results as JSON.@mcp.tool() async def list_reports( module: Optional[str] = None, limit: Optional[int] = 50 ) -> str: """ Get a list of all available reports in the system. Args: module: Filter reports by module (optional) limit: Maximum number of reports to return (default: 50) """ try: client = get_client() # Build parameters params = { "fields": json.dumps(["name", "report_type", "module", "is_standard", "ref_doctype"]), "limit": str(limit), "order_by": "name" } if module: params["filters"] = json.dumps({"module": module}) # Get reports list response = await client.get("api/resource/Report", params=params) if "data" in response: reports = response["data"] count = len(reports) filter_text = f" in module '{module}'" if module else "" return f"Found {count} reports{filter_text}:\n\n" + json.dumps(reports, indent=2) else: return json.dumps(response, indent=2) except Exception as error: return _format_error_response(error, "list_reports")
- src/server.py:42-42 (registration)Registers the reports module (containing list_reports tool) with the MCP server instance.reports.register_tools(mcp)