Skip to main content
Glama
us-all
by us-all

dq-score-trend

Monitor trends in data quality scores over time, including completeness, freshness, validity, and anomaly-free metrics, to identify degradation or improvement.

Instructions

Time-series of the 4-axis DQ score (completeness / freshness / validity / anomaly_free) plus overall_score from DQ_SCORE_TABLE

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNo
scopeNoScope filter (only honored when DQ_SCHEMA=generic)

Implementation Reference

  • Core handler: builds and executes a SQL query against DQ_SCORE_TABLE to return time-series of 4-axis DQ scores (completeness, freshness, validity, anomaly_free) plus overall_score, filtered by a configurable day window and optional scope.
    export async function dqScoreTrend(args: z.infer<typeof dqScoreTrendSchema>): Promise<unknown> {
      const flavor = getDqFlavor();
      const cols = getDqColumns(flavor);
      const backend = config.dq.backend;
      const filters: string[] = [];
      const params: unknown[] = [];
      filters.push(tableTimeWindowSql(flavor, backend, "DAY"));
      params.push(args.days);
      if (args.scope && hasScope(flavor)) {
        filters.push(`${cols.scope} = ?`);
        params.push(args.scope);
      }
      const where = "WHERE " + filters.join(" AND ");
    
      const scopeSelect = cols.scope ? `${cols.scope} AS scope, ` : "";
      const orderBy = cols.scope ? `${cols.scoreDate} DESC, ${cols.scope}` : `${cols.scoreDate} DESC`;
    
      const sql = `
        SELECT ${cols.scoreDate} AS score_date, ${scopeSelect}
               completeness_pct, freshness_pct, validity_pct, anomaly_free_pct,
               overall_score
        FROM ${scoreTable()}
        ${where}
        ORDER BY ${orderBy}`;
      const result = await dqQuery(sql, params);
      const caveats: string[] = [];
      if (args.scope && !hasScope(flavor)) {
        caveats.push(`DQ_SCHEMA=${flavor} does not have a scope column — scope filter ignored`);
      }
      return { ...result, schema: flavor, caveats };
    }
  • Zod schema for input validation: accepts 'days' (1-365, default 14) and optional 'scope' string filter.
    export const dqScoreTrendSchema = z.object({
      days: z.coerce.number().int().min(1).max(365).default(14),
      scope: z.string().optional().describe("Scope filter (only honored when DQ_SCHEMA=generic)"),
    });
  • src/index.ts:103-103 (registration)
    Registration of the tool under the 'quality' category via the local 'tool()' helper, which registers with the registry and conditionally adds it to the MCP server.
    tool("dq-score-trend", "Time-series of the 4-axis DQ score (completeness / freshness / validity / anomaly_free) plus overall_score from DQ_SCORE_TABLE", dqScoreTrendSchema.shape, wrapToolHandler(dqScoreTrend));
  • src/index.ts:41-44 (registration)
    Import of dqScoreTrendSchema and dqScoreTrend from the quality-scores module into the main index.
    import {
      dqScoreTrendSchema, dqScoreTrend,
      dqTierStatusSchema, dqTierStatus,
    } from "./tools/quality-scores.js";
  • Helper function that executes the SQL query against the configured backend (Postgres or BigQuery) and returns typed results.
    export async function dqQuery(sql: string, params: unknown[] = []): Promise<DqQueryResult> {
      if (!config.dq.resultsTable) {
        throw new ConfigMissingError("DQ_RESULTS_TABLE", "Quality category tools");
      }
      const driver = await getDriver();
      const rows = await driver.query(sql, params);
      return { rows, rowCount: rows.length, backend: config.dq.backend, query: sql };
    }
Behavior2/5

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

No annotations are provided, so the description must cover behavioral traits. It mentions retrieving data but does not disclose if the operation is read-only, whether it requires special permissions, any rate limits, or what happens if no data exists. The description only reiterates the purpose.

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 a single sentence with no wasted words. It is concise but could be slightly improved by removing the parenthetical list or rephrasing for clarity. Still efficient overall.

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?

The description covers the core purpose but lacks output structure details. With no output schema, the agent must guess whether the result is a list of objects, a CSV, etc. Parameter defaults and behavior are not explained, leaving some ambiguity for a 2-param tool.

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

Parameters2/5

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

Schema coverage is 50% (scope has description, days does not). The tool description adds no parameter information beyond what the schema provides. It does not explain how days and scope influence the time-series output, missing an opportunity to clarify expected input behavior.

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

Purpose5/5

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

The description clearly states the tool returns a time-series of the 4-axis DQ score plus overall score from a specific table. This is specific verb ('Time-series') and resource ('DQ_SCORE_TABLE'), and distinguishes it from sibling dq tools like dq-score-snapshot or dq-failed-checks.

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 (e.g., dq-score-snapshot for a single snapshot, dq-list-checks for individual checks). It only describes what it does, without any context on prerequisites or exclusion criteria.

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/us-all/dbt-mcp-server'

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