Skip to main content
Glama

get_report_columns

Retrieve column structure for specific Frappe reports with optional filtering to analyze data organization and field definitions.

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
filtersNo
report_nameYes

Implementation Reference

  • The handler function implementing the get_report_columns tool logic. It fetches report columns via Frappe's query_report.get_columns API method, with fallback to report metadata, and handles filters using the custom filter parser.
    @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")
  • src/server.py:42-42 (registration)
    Registration of the reports module tools, including get_report_columns, by calling reports.register_tools(mcp) in the main server setup.
    reports.register_tools(mcp)
  • The register_tools function in reports.py where all report tools including get_report_columns are defined and registered via @mcp.tool() decorators.
    def register_tools(mcp: Any) -> None: """Register report tools with the MCP server.""" @mcp.tool() async def run_query_report( 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