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

dbt-get-test

Retrieve a single dbt test's definition, parameters, attached models, and latest run result by providing its unique identifier.

Instructions

Get a single dbt test: definition, parameters, attached models, latest run result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uniqueIdYesdbt unique_id of the test (e.g. 'test.proj.unique_users_id')

Implementation Reference

  • Main handler for dbt-get-test. Loads the manifest, looks up the test by uniqueId, and returns the test definition, parameters, attached nodes, and latest run result from run_results.json.
    export async function dbtGetTest(args: z.infer<typeof dbtGetTestSchema>): Promise<unknown> {
      const manifest = loadManifest();
      const node = manifest.nodes[args.uniqueId];
      if (!node || !isTest(node)) throw new Error(`Test not found: ${args.uniqueId}`);
    
      let latestResult: unknown = null;
      try {
        const runResults = loadRunResults();
        const result = runResults.results.find((r) => r.unique_id === args.uniqueId);
        if (result) {
          latestResult = {
            status: result.status,
            executionTime: result.execution_time,
            message: result.message,
            failures: result.failures,
            generatedAt: runResults.metadata.generated_at,
            invocationId: runResults.metadata.invocation_id,
          };
        }
      } catch {
        // run_results.json may be absent
      }
    
      return {
        uniqueId: node.unique_id,
        name: node.name,
        package: node.package_name,
        kind: node.test_metadata ? "generic" : "singular",
        testDefinition: node.test_metadata?.name,
        testKwargs: node.test_metadata?.kwargs,
        column: node.column_name,
        severity: node.severity,
        attachedNodes: node.depends_on?.nodes ?? [],
        tags: node.tags ?? node.config?.tags ?? [],
        rawCode: node.raw_code,
        latestResult,
      };
    }
  • Zod schema for dbt-get-test input validation. Requires a single string parameter 'uniqueId'.
    export const dbtGetTestSchema = z.object({
      uniqueId: z.string().describe("dbt unique_id of the test (e.g. 'test.proj.unique_users_id')"),
    });
  • src/index.ts:80-80 (registration)
    Registration of the 'dbt-get-test' tool with the MCP server, wiring it to the schema and handler.
    tool("dbt-get-test", "Get a single dbt test: definition, parameters, attached models, latest run result", dbtGetTestSchema.shape, wrapToolHandler(dbtGetTest));
  • src/index.ts:17-20 (registration)
    Import of the dbtGetTest handler and schema from the dbt-tests module into the main index file.
    import {
      dbtListTestsSchema, dbtListTests,
      dbtGetTestSchema, dbtGetTest,
    } from "./tools/dbt-tests.js";
  • Helper function used by dbtGetTest (and dbtListTests) to check if a node is a test resource.
    function isTest(node: DbtNode): boolean {
      return node.resource_type === "test";
    }
Behavior2/5

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

No annotations are provided, and the description only states 'Get' without disclosing behavioral traits such as read-only nature, authentication requirements, or side effects. The description does not fulfill the burden of transparency beyond the basic operation.

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, front-loaded sentence that efficiently communicates the tool's purpose and output, with no wasted 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 tool without an output schema, the description covers the essential return information. It could mention error handling (e.g., missing test), but it is generally complete.

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 coverage is 100% and the parameter has a description. The tool description adds no additional meaning beyond the schema, so baseline score of 3 is appropriate.

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 retrieves a single dbt test and enumerates the returned data (definition, parameters, attached models, latest run result), distinguishing it from sibling tools like dbt-list-tests and dbt-get-model.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a single test by uniqueId is needed, but does not explicitly mention when not to use it or provide alternatives. Usage context is only implied.

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