Skip to main content
Glama

get_report_meta

Retrieve report metadata including column definitions and filter parameters to understand data structure and customize report views.

Instructions

    Get metadata for a specific report including columns and filters.
    
    Args:
        report_name: Name of the report to get metadata for
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
report_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_report_meta' tool. It fetches the Report document metadata from the Frappe API using the provided report_name, formats key fields into a metadata dictionary, and returns it as indented JSON. Includes error handling with _format_error_response.
    async def get_report_meta(report_name: str) -> str:
        """
        Get metadata for a specific report including columns and filters.
        
        Args:
            report_name: Name of the report to get metadata for
        """
        try:
            client = get_client()
            
            # Get report document
            response = await client.get(f"api/resource/Report/{report_name}")
            
            if "data" in response:
                report_data = response["data"]
                
                # Format metadata
                metadata = {
                    "report_name": report_name,
                    "report_type": report_data.get("report_type"),
                    "module": report_data.get("module"),
                    "is_standard": report_data.get("is_standard"),
                    "ref_doctype": report_data.get("ref_doctype"),
                    "query": report_data.get("query"),
                    "columns": report_data.get("columns", []),
                    "filters": report_data.get("filters", [])
                }
                
                return json.dumps(metadata, indent=2)
            else:
                return json.dumps(response, indent=2)
                
        except Exception as error:
            return _format_error_response(error, "get_report_meta")
  • src/server.py:42-42 (registration)
    The registration call for the reports module, which includes the get_report_meta tool via its register_tools function decorated with @mcp.tool() decorators.
    reports.register_tools(mcp)
  • Helper function used by get_report_meta (and other tools) to format error responses, handling authentication checks, Frappe API errors, and general exceptions with operation-specific messages.
    def _format_error_response(error: Exception, operation: str) -> str:
        """Format error response with detailed information."""
        credentials_check = validate_api_credentials()
        
        # Check for missing credentials first
        if not credentials_check["valid"]:
            error_msg = f"Authentication failed: {credentials_check['message']}. "
            error_msg += "API key/secret is the only supported authentication method."
            return error_msg
        
        # Handle FrappeApiError
        if isinstance(error, FrappeApiError):
            error_msg = f"Frappe API error: {error}"
            if error.status_code in (401, 403):
                error_msg += " Please check your API key and secret."
            return error_msg
        
        # Default error handling
        return f"Error in {operation}: {str(error)}"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states it 'gets' metadata, implying a read-only operation, but doesn't disclose behavioral traits such as error handling (e.g., what happens if the report doesn't exist), authentication needs, rate limits, or response format. This leaves significant gaps for an agent to understand how to invoke it correctly.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with two sentences: one stating the purpose and one explaining the parameter. It's front-loaded with the core functionality. There's no wasted text, though it could be more structured (e.g., bullet points).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has one parameter, no annotations, and an output schema exists, the description is minimally complete. It covers the basic purpose and parameter, but lacks behavioral context (e.g., error cases) and usage guidelines. The output schema mitigates the need to explain return values, but overall completeness is adequate with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal semantics beyond the input schema. It documents the single parameter 'report_name' with a brief explanation ('Name of the report to get metadata for'), but schema description coverage is 0%, so the schema provides no details. The description compensates slightly by clarifying the parameter's role, but doesn't specify format (e.g., string constraints) or examples, leaving room for improvement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'metadata for a specific report', specifying it includes 'columns and filters'. This distinguishes it from sibling tools like 'get_report_columns' (which might only get columns) or 'list_reports' (which lists reports rather than metadata). However, it doesn't explicitly differentiate from all siblings, such as 'get_doctype_schema', which could have overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether the report must exist), exclusions, or compare it to siblings like 'get_report_columns' or 'run_doctype_report'. The user must infer usage from the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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