Skip to main content
Glama

get_report_columns

Retrieve column structure for Frappe reports to understand data fields and customize views. Apply optional filters to focus on specific data subsets.

Instructions

Get the column structure for a specific report. Args: report_name: Name of the report filters: Filter string (optional). Uses custom syntax to bypass MCP validation issues. Filter Syntax: Use the same string-based syntax as count_documents and list_documents. Examples: "status:Open", "date:>=:2025-01-01", "status:in:Open|Working"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
report_nameYes
filtersNo

Implementation Reference

  • The handler function for the 'get_report_columns' tool. It fetches column structure for a Frappe report using the API, with fallback to metadata, and handles errors.
    @mcp.tool() async def get_report_columns( report_name: str, filters: Optional[str] = None ) -> str: """ Get the column structure for a specific report. Args: report_name: Name of the report filters: Filter string (optional). Uses custom syntax to bypass MCP validation issues. Filter Syntax: Use the same string-based syntax as count_documents and list_documents. Examples: "status:Open", "date:>=:2025-01-01", "status:in:Open|Working" """ try: client = get_client() # Get report columns using the report.get_columns method parsed_filters = format_filters_for_api(filters) or {} request_data = { "cmd": "frappe.desk.query_report.get_columns", "report_name": report_name, "filters": json.dumps(parsed_filters) } response = await client.post("api/method/frappe.desk.query_report.get_columns", json_data=request_data) if "message" in response: columns = response["message"] formatted_result = { "report_name": report_name, "columns": columns } return json.dumps(formatted_result, indent=2) else: # Fallback: get columns from report metadata meta_response = await client.get(f"api/resource/Report/{report_name}") if "data" in meta_response: columns = meta_response["data"].get("columns", []) return json.dumps({"report_name": report_name, "columns": columns}, indent=2) else: return json.dumps(response, indent=2) except Exception as error: return _format_error_response(error, "get_report_columns")
  • The @mcp.tool() decorator registers the get_report_columns function as an MCP tool.
    @mcp.tool()
  • Input schema defined by function parameters with type hints: report_name (str, required), filters (Optional[str], optional). Output is str (JSON).
    async def get_report_columns( report_name: str, filters: Optional[str] = None ) -> str:

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/appliedrelevance/frappe-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server