Skip to content

feat(discovery): enrich get_lineage with description; remove get_model_parents/children#817

Open
theyostalservice wants to merge 1 commit into
mainfrom
patricky/di-4002-dbt-mcp-lineage-enrich
Open

feat(discovery): enrich get_lineage with description; remove get_model_parents/children#817
theyostalservice wants to merge 1 commit into
mainfrom
patricky/di-4002-dbt-mcp-lineage-enrich

Conversation

@theyostalservice

Copy link
Copy Markdown
Contributor

Why

get_model_parents and get_model_children are redundant with get_lineage(depth=1). Every registered tool name + description ships as context overhead on every turn; removing two tools reduces token cost for any harness using the Discovery toolset.

get_lineage lacked the description field that the parents/children tools returned per node, so we enrich it first to preserve information parity.

What

  • Add description to the lineage node selection in get_full_lineage.gql so callers can read node descriptions without a separate details call
  • Update get_lineage.md prompt to document the new field and note that depth=1 replaces the removed tools
  • Remove get_model_parents and get_model_children tools, prompt files, GraphQL queries, and client methods
  • Update enum/toolset/README mappings in lockstep

Refs

DI-4002


Drafted by Claude Opus 4.8 under the direction of @theyostalservice

…description

get_lineage(depth=1) already covers the immediate-parent/child use case.
Adding description to lineage nodes preserves the information that was
available via the removed tools. Removes ~200 LOC of dead client code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@theyostalservice theyostalservice force-pushed the patricky/di-4002-dbt-mcp-lineage-enrich branch from 4417bdf to ad7ae8e Compare June 22, 2026 19:12
@theyostalservice theyostalservice marked this pull request as ready for review June 22, 2026 19:16
Copilot AI review requested due to automatic review settings June 22, 2026 19:16
@theyostalservice theyostalservice requested review from a team, b-per and jairus-m as code owners June 22, 2026 19:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces Discovery toolset overhead by removing the redundant get_model_parents / get_model_children tools and enriching get_lineage so it continues to provide description parity via the lineage node selection.

Changes:

  • Added description to the GetFullLineage GraphQL selection and documented the new field in the get_lineage prompt.
  • Removed get_model_parents / get_model_children from tool registration, enums/toolsets, GraphQL query constants, and integration tests.
  • Updated README + README mapping strings and added unit coverage to ensure the lineage query includes/preserves description.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/discovery/test_lineage_fetcher.py Adds unit tests asserting the lineage query selects description and that results preserve it.
tests/integration/discovery/test_discovery.py Removes integration tests for the deleted parents/children fetcher methods.
src/dbt_mcp/tools/toolsets.py Removes parents/children tools from the Discovery toolset mapping.
src/dbt_mcp/tools/tool_names.py Removes tool name enum entries for parents/children.
src/dbt_mcp/tools/readme_mappings.py Updates the human description for get_lineage to mention depth=1.
src/dbt_mcp/prompts/discovery/get_model_parents.md Deletes the removed tool prompt.
src/dbt_mcp/prompts/discovery/get_model_children.md Deletes the removed tool prompt.
src/dbt_mcp/prompts/discovery/get_lineage.md Documents the new description field and positions depth=1 as the replacement.
src/dbt_mcp/discovery/tools.py Removes tool definitions/registration for parents/children.
src/dbt_mcp/discovery/tools_multiproject.py Removes multiproject tool definitions/registration for parents/children.
src/dbt_mcp/discovery/graphql/get_full_lineage.gql Adds description to the lineage node selection.
src/dbt_mcp/discovery/client.py Removes the parents/children GraphQL query strings and client fetch methods.
README.md Updates the Discovery tool list to reflect the removal and depth=1 guidance.
.changes/unreleased/Enhancement or New Feature-20260622-103011.yaml Adds a changelog entry describing the tool removal and lineage enrichment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
- `get_exposure_details`: Gets exposure details including owner, parents, and freshness status.
- `get_exposures`: Gets all exposures (downstream dashboards, apps, or analyses).
- `get_lineage`: Gets full lineage graph (ancestors and descendants) with type and depth filtering.
- `get_lineage`: Gets full lineage graph (ancestors and descendants) with type and depth filtering; use depth=1 to get immediate parents or children.
ToolName.GET_MODEL_HEALTH: "Gets health signals: run status, test results, and upstream source freshness.",
ToolName.GET_MODEL_PERFORMANCE: "Gets execution history for a model; option to include test results.",
ToolName.GET_LINEAGE: "Gets full lineage graph (ancestors and descendants) with type and depth filtering.",
ToolName.GET_LINEAGE: "Gets full lineage graph (ancestors and descendants) with type and depth filtering; use depth=1 to get immediate parents or children.",
- `description`: A description of the resource
- `parentIds`: List of unique IDs that this resource directly depends on

**Getting immediate parents or children:** use `depth=1`. This returns the target node plus its direct upstream dependencies and direct downstream dependents.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with the above! get_lineage does not return parent or child but does both . Many references may need to be updated to make "or" --> "and". Or maybe we can update get_lineage to return either parents or children to maintain the "or".

Comment on lines +47 to +48
# Get only immediate parents and children (replaces get_model_parents / get_model_children)
get_lineage(unique_id="model.analytics.customers", depth=1)
- `description`: A description of the resource
- `parentIds`: List of unique IDs that this resource directly depends on

**Getting immediate parents or children:** use `depth=1`. This returns the target node plus its direct upstream dependencies and direct downstream dependents.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with the above! get_lineage does not return parent or child but does both . Many references may need to be updated to make "or" --> "and". Or maybe we can update get_lineage to return either parents or children to maintain the "or".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this would be considered a breaking change? One of the examples actually (if you Ctrl + F for the deleted tools), actually refers to both get_model_parents and get_model_children in examples/ag2_agent/main_multiagent.py which is a solid case of potentially existing references to these tools that would break

cc @b-per thoughts here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Same as the other PR. This should be a breaking change. We need an approach to

  • potentially move dbt-mcp to 2.x
  • plan the steps required to keep the openai and anthropic apps working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants