Skip to main content
Glama

run_report

Execute ERPNext reports to extract business data and insights using customizable filters for analysis and decision-making.

Instructions

Run an ERPNext report

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
report_nameYesName of the report
filtersNoReport filters (optional)

Implementation Reference

  • Main handler for the 'run_report' tool call within the CallToolRequestSchema handler. Extracts parameters, validates, calls erpnext.runReport, and returns the result or error.
    case "run_report": {
      if (!erpnext.isAuthenticated()) {
        return {
          content: [{
            type: "text",
            text: "Not authenticated with ERPNext. Please configure API key authentication."
          }],
          isError: true
        };
      }
      
      const reportName = String(request.params.arguments?.report_name);
      const filters = request.params.arguments?.filters as Record<string, any> | undefined;
      
      if (!reportName) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Report name is required"
        );
      }
      
      try {
        const result = await erpnext.runReport(reportName, filters);
        return {
          content: [{
            type: "text",
            text: JSON.stringify(result, null, 2)
          }]
        };
      } catch (error: any) {
        return {
          content: [{
            type: "text",
            text: `Failed to run report ${reportName}: ${error?.message || 'Unknown error'}`
          }],
          isError: true
        };
      }
    }
  • Tool registration and input schema definition for 'run_report' in the ListToolsRequestSchema handler, specifying parameters report_name (required) and optional filters.
    {
      name: "run_report",
      description: "Run an ERPNext report",
      inputSchema: {
        type: "object",
        properties: {
          report_name: {
            type: "string",
            description: "Name of the report"
          },
          filters: {
            type: "object",
            additionalProperties: true,
            description: "Report filters (optional)"
          }
        },
        required: ["report_name"]
      }
    }
  • Helper method in ERPNextClient class that performs the actual API call to run the specified ERPNext report with given filters.
    // Run a report
    async runReport(reportName: string, filters?: Record<string, any>): Promise<any> {
      try {
        const response = await this.axiosInstance.get(`/api/method/frappe.desk.query_report.run`, {
          params: {
            report_name: reportName,
            filters: filters ? JSON.stringify(filters) : undefined
          }
        });
        return response.data.message;
      } catch (error: any) {
        throw new Error(`Failed to run report ${reportName}: ${error?.message || 'Unknown error'}`);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Run an ERPNext report' but does not explain what this entails—whether it's a read-only operation, if it modifies data, requires specific permissions, has rate limits, or what the output looks like. This leaves critical behavioral traits unspecified for a tool that likely interacts with a database system.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It is front-loaded and directly states the tool's function without unnecessary elaboration, making it highly concise and well-structured for quick understanding.

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

Completeness2/5

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

Given the complexity of running reports in an ERP system, the description is incomplete. With no annotations, no output schema, and sibling tools present, it fails to cover essential context like the tool's behavior, output format, or when to use it. This leaves significant gaps for an agent to understand and invoke the tool correctly in a real-world scenario.

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?

Schema description coverage is 100%, with clear documentation for 'report_name' and 'filters' parameters. The description does not add any meaning beyond the schema, such as examples of report names or filter structures. Since the schema already provides adequate parameter details, the baseline score of 3 is appropriate, indicating no extra value from the description.

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

Purpose3/5

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

The description 'Run an ERPNext report' states the action (run) and resource (ERPNext report), providing a basic purpose. However, it lacks specificity about what 'run' entails (e.g., execution, data retrieval, or generation) and does not distinguish this tool from potential siblings like 'get_documents' that might also retrieve data, making it vague rather than clear.

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?

No guidance is provided on when to use this tool versus alternatives. The description does not mention context, prerequisites, or exclusions, such as whether it's for analytics, data export, or real-time queries. With sibling tools like 'get_documents' available, there is no indication of how 'run_report' differs in usage, leaving the agent without direction.

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/rakeshgangwar/erpnext-mcp-server'

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