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

dbt-list-runs

Retrieve recent dbt run history from run_results.json files in target/ and DBT_RUN_HISTORY_DIR directories.

Instructions

List recent dbt invocations from run_results.json files in target/ and DBT_RUN_HISTORY_DIR

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • Main handler function for dbt-list-runs. Calls listRunHistory(), computes pass/error counts and success rate per run.
    export async function dbtListRuns(args: z.infer<typeof dbtListRunsSchema>): Promise<unknown> {
      const runs = listRunHistory(args.limit);
      return {
        count: runs.length,
        runs: runs.map((r) => {
          const total = r.results.length;
          const errored = r.results.filter((x) => x.status === "error" || x.status === "fail").length;
          const passed = r.results.filter((x) => x.status === "pass" || x.status === "success").length;
          return {
            invocationId: r.invocationId,
            generatedAt: r.generatedAt,
            filePath: r.filePath,
            totalNodes: total,
            passed,
            errored,
            successRate: total === 0 ? null : Math.round(((total - errored) / total) * 1000) / 10,
          };
        }),
      };
    }
  • Zod schema for dbt-list-runs: accepts optional limit (1-200, default 20).
    export const dbtListRunsSchema = z.object({
      limit: z.coerce.number().int().min(1).max(200).default(20),
    });
  • src/index.ts:86-86 (registration)
    Tool registration in index.ts using tool() with name 'dbt-list-runs', description, schema and handler.
    tool("dbt-list-runs", "List recent dbt invocations from run_results.json files in target/ and DBT_RUN_HISTORY_DIR", dbtListRunsSchema.shape, wrapToolHandler(dbtListRuns));
  • src/index.ts:30-35 (registration)
    Import of dbtListRunsSchema and dbtListRuns from src/tools/dbt-runs.js
    import {
      dbtListRunsSchema, dbtListRuns,
      dbtGetRunResultsSchema, dbtGetRunResults,
      dbtFailedTestsSchema, dbtFailedTests,
      dbtSlowModelsSchema, dbtSlowModels,
    } from "./tools/dbt-runs.js";
  • Helper function listRunHistory() that reads run_results.json files from DBT_RUN_HISTORY_DIR and target/, deduplicates by invocation_id, sorts by generatedAt desc, and applies limit.
    export function listRunHistory(limit = 20): ArchivedRun[] {
      const out: ArchivedRun[] = [];
      const dirs: string[] = [];
      if (config.dbt.runHistoryDir && existsSync(config.dbt.runHistoryDir)) {
        dirs.push(config.dbt.runHistoryDir);
      }
      if (config.dbt.targetDir && existsSync(config.dbt.targetDir)) {
        dirs.push(config.dbt.targetDir);
      }
      const seenInvocationIds = new Set<string>();
      for (const dir of dirs) {
        let entries: string[];
        try {
          entries = readdirSync(dir);
        } catch {
          continue;
        }
        for (const entry of entries) {
          if (!entry.endsWith(".json")) continue;
          if (!entry.includes("run_results")) continue;
          const filePath = join(dir, entry);
          try {
            const data = readArtifact<DbtRunResultsFile>(filePath);
            const invocationId = data.metadata?.invocation_id;
            if (invocationId && seenInvocationIds.has(invocationId)) continue;
            if (invocationId) seenInvocationIds.add(invocationId);
            out.push({
              filePath,
              fileName: basename(entry),
              generatedAt: data.metadata?.generated_at ?? "",
              invocationId,
              results: data.results ?? [],
            });
          } catch {
            // skip unreadable
          }
        }
      }
      out.sort((a, b) => (b.generatedAt > a.generatedAt ? 1 : -1));
      return out.slice(0, limit);
    }
Behavior3/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. It discloses the data sources (target/ and environment variable) but omits safety information (e.g., read-only nature, side effects, required permissions).

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?

A single sentence that front-loads the purpose and data source. No superfluous words.

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

Completeness4/5

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

For a simple one-parameter list tool without output schema, the description adequately covers purpose and data origin. It could mention return format or ordering but is nearly complete.

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 coverage is 0% (no descriptions in schema) and the description does not mention the only parameter 'limit', leaving its purpose and constraints completely unexplained.

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 action ('list recent dbt invocations'), the data source ('run_results.json files in target/ and DBT_RUN_HISTORY_DIR'), and effectively distinguishes from siblings like dbt-get-run-results.

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 on when to use this tool versus alternatives like dbt-get-run-results or other list tools. With many siblings, explicit when-to-use or exclusionary conditions are missing.

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