Skip to main content
Glama

get_business_metrics

Read-only

Retrieve high-level business metrics like Revenue, Conversion, and Customers from the Semantic Layer. Specify time windows to analyze performance data.

Instructions

Retrieve high-level business metrics (Revenue, Conversion, Customers) from the Semantic Layer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
windowNoAnalytics window (today, 7d, 30d, all)

Implementation Reference

  • The handler function `getBusinessMetrics` that aggregates data from billing, telemetry, and feedback to calculate metrics.
    async function getBusinessMetrics(options = {}) {
      const window = resolveAnalyticsWindow(options);
      const billing = getBillingSummary(window);
      const { getFeedbackPaths } = require('./feedback-loop');
      const feedbackDir = options.feedbackDir || getFeedbackPaths().FEEDBACK_DIR;
      const telemetry = getTelemetryAnalytics(feedbackDir, window);
    
      const uniqueVisitors = telemetry.visitors.uniqueVisitors || 0;
      const paidCustomers = billing.revenue.paidCustomers || 0;
      const bookedRevenueCents = billing.revenue.bookedRevenueCents || 0;
    
      return {
        generatedAt: new Date().toISOString(),
        window: billing.window,
        metrics: {
          uniqueVisitors,
          checkoutStarts: telemetry.ctas.checkoutStarts || 0,
          acquisitionLeads: billing.signups.uniqueLeads || 0,
          paidCustomers,
          bookedRevenueCents,
          bookedRevenueFormatted: `$${(bookedRevenueCents / 100).toFixed(2)}`,
          conversionRate: safeRate(paidCustomers, uniqueVisitors),
          leadToPaidRate: safeRate(paidCustomers, billing.signups.uniqueLeads || 0),
          activeProKeys: billing.keys.active || 0,
          totalUsage: billing.keys.totalUsage || 0,
        },
        attribution: billing.attribution,
        status: {
          isPostFirstDollar: paidCustomers > 0 || bookedRevenueCents > 0,
          hasActivePipeline: (telemetry.ctas.checkoutStarts || 0) > 0 || billing.signups.uniqueLeads > 0,
        }
      };
    }
  • Registration of the `get_business_metrics` tool in the tool registry.
    readOnlyTool({
      name: 'get_business_metrics',
      description: 'Retrieve high-level business metrics (Revenue, Conversion, Customers) from the Semantic Layer.',
      inputSchema: {
        type: 'object',
        properties: {
          window: { type: 'string', description: 'Analytics window (today, 7d, 30d, all)' },
  • MCP server-stdio handler dispatching the `get_business_metrics` request to the semantic layer.
    case 'get_business_metrics': {
      const { getBusinessMetrics } = require('../../scripts/semantic-layer');
      const metrics = await getBusinessMetrics(args);
      return toTextResult(metrics);
Behavior3/5

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

The annotations declare readOnlyHint=true, indicating a safe read operation, which the description doesn't contradict. The description adds context by specifying the source ('Semantic Layer') and the types of metrics retrieved, but it lacks details on behavioral traits like rate limits, authentication needs, or response format, which would be helpful given no output schema.

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 that directly states the tool's purpose without any unnecessary words. It's front-loaded with the key action and resource, making it easy to parse and understand quickly.

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 with full schema coverage and read-only annotations, the description is adequate for a basic retrieval tool. However, without an output schema, it doesn't explain what the returned metrics look like (e.g., format, structure), which could leave gaps in understanding for the agent.

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 input schema has 100% description coverage, with the 'window' parameter fully documented in the schema. The description doesn't add any semantic details beyond what the schema provides, such as explaining the 'Analytics window' further or its impact on the metrics retrieved, so it meets the baseline for high schema coverage.

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 'Retrieve' and the resource 'high-level business metrics (Revenue, Conversion, Customers) from the Semantic Layer', making the purpose specific and understandable. However, it doesn't differentiate this tool from potential sibling tools that might also retrieve metrics, such as 'dashboard' or 'feedback_stats', which could be related.

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 any prerequisites, exclusions, or compare it to sibling tools like 'dashboard' or 'feedback_stats', leaving the agent without context for tool selection.

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/IgorGanapolsky/mcp-memory-gateway'

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