dbt-list-sources
List dbt sources from manifest.json filtered by source group name or source table substring, enabling quick introspection of project data sources.
Instructions
List dbt sources from manifest.json with optional source-group / name filters
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sourceName | No | Filter by source group name | |
| search | No | Substring match against source table name | |
| limit | No |
Implementation Reference
- src/tools/dbt-sources.ts:10-32 (handler)The main handler function for dbt-list-sources. Loads the dbt manifest, iterates over sources filtered by optional sourceName and search, and returns a list of sources with their metadata.
export async function dbtListSources(args: z.infer<typeof dbtListSourcesSchema>): Promise<unknown> { const manifest = loadManifest(); const out: Array<Record<string, unknown>> = []; const search = args.search?.toLowerCase(); for (const src of Object.values(manifest.sources)) { if (args.sourceName && src.source_name !== args.sourceName) continue; if (search && !src.name.toLowerCase().includes(search)) continue; out.push({ uniqueId: src.unique_id, sourceName: src.source_name, tableName: src.name, identifier: src.identifier ?? src.name, database: src.database, schema: src.schema, loader: src.loader, loadedAtField: src.loaded_at_field, hasFreshness: !!src.freshness?.error_after || !!src.freshness?.warn_after, tags: src.tags ?? [], }); if (out.length >= args.limit) break; } return { count: out.length, sources: out }; } - src/tools/dbt-sources.ts:4-8 (schema)Zod schema defining input parameters for dbt-list-sources: optional sourceName (filter by source group), optional search (substring match on table name), and limit (default 500, max 2000).
export const dbtListSourcesSchema = z.object({ sourceName: z.string().optional().describe("Filter by source group name"), search: z.string().optional().describe("Substring match against source table name"), limit: z.coerce.number().int().min(1).max(2000).default(500), }); - src/index.ts:81-81 (registration)Registration of dbt-list-sources tool with its schema and wrapped handler on the MCP server, under the 'dbt' category.
tool("dbt-list-sources", "List dbt sources from manifest.json with optional source-group / name filters", dbtListSourcesSchema.shape, wrapToolHandler(dbtListSources));