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

dq-failed-checks-by-dataset

Group failing data quality checks by dataset, retrieving the most recent failures per dataset for quick troubleshooting.

Instructions

Group failing checks by dataset across a recent window with the latest 5 failures per dataset

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sinceHoursNo
topNNo

Implementation Reference

  • Input schema for dq-failed-checks-by-dataset: accepts 'sinceHours' (1-720, default 24) and 'topN' (1-100, default 20).
    export const dqFailedChecksByDatasetSchema = z.object({
      sinceHours: z.coerce.number().int().min(1).max(720).default(24),
      topN: z.coerce.number().int().min(1).max(100).default(20),
    });
  • Handler function that queries DQ results table, grouping by dataset where status is 'fail' or 'error' within a recent time window, ordered by failure count descending, limited by topN.
    export async function dqFailedChecksByDataset(
      args: z.infer<typeof dqFailedChecksByDatasetSchema>,
    ): Promise<unknown> {
      const flavor = getDqFlavor();
      const cols = getDqColumns(flavor);
      const backend = config.dq.backend;
    
      const sql = `
        SELECT ${cols.dataset} AS dataset,
               COUNT(*) AS failures
        FROM ${resultsTable()}
        WHERE LOWER(${cols.status}) IN ('fail', 'error')
          AND ${tableTimeWindowSql(flavor, backend, "HOUR")}
        GROUP BY ${cols.dataset}
        ORDER BY failures DESC
        LIMIT ?`;
      const params: unknown[] = [args.sinceHours, args.topN];
      return { ...(await dqQuery(sql, params)), schema: flavor };
    }
  • src/index.ts:36-40 (registration)
    Import of dqFailedChecksByDatasetSchema and dqFailedChecksByDataset from quality-results.ts.
    import {
      dqListChecksSchema, dqListChecks,
      dqGetCheckHistorySchema, dqGetCheckHistory,
      dqFailedChecksByDatasetSchema, dqFailedChecksByDataset,
    } from "./tools/quality-results.js";
  • src/index.ts:102-102 (registration)
    Registration of the tool 'dq-failed-checks-by-dataset' with its schema and handler via wrapToolHandler().
    tool("dq-failed-checks-by-dataset", "Group failing checks by dataset across a recent window with the latest 5 failures per dataset", dqFailedChecksByDatasetSchema.shape, wrapToolHandler(dqFailedChecksByDataset));
  • Imports used by the handler: dqQuery, resultsTable from dq-store, getDqColumns, getDqFlavor, tableTimeWindowSql from dq-schema, and config.
    import { z } from "zod";
    import { dqQuery, resultsTable } from "../clients/dq-store.js";
    import { getDqColumns, getDqFlavor, tableTimeWindowSql } from "../clients/dq-schema.js";
    import { config } from "../config.js";
Behavior2/5

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

With no annotations, the description must fully convey behavioral traits. It only hints at a read operation and output structure (latest 5 failures), but omits safety, authorization, or side effect information.

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 concise sentence that front-loads the primary action. However, it sacrifices necessary detail for brevity.

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 no annotations, no output schema, and two parameters with zero description coverage, the description is insufficient. It lacks information about output format, parameter usage, and how to interpret results.

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

Parameters1/5

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

Schema description coverage is 0% and the description does not explain the 'sinceHours' or 'topN' parameters. The phrase 'recent window' and 'latest 5 failures per dataset' are loosely related but do not clarify their meaning or how to use them.

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 tool groups failing checks by dataset and provides the latest 5 failures per dataset over a recent window. The verb and resource are specific, but exact time window is ambiguous without referencing 'sinceHours' parameter.

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 sibling tools like 'dq-list-checks' or 'failed-tests-summary'. There is no mention of alternatives 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