-
Notifications
You must be signed in to change notification settings - Fork 126
feat(semantic-layer): add get_dimension_values tool #782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1f41d2b
feat(semantic_layer): add DimensionValuesResponse type
b-per 1ca9011
feat(semantic-layer): add get_dimension_values to SemanticLayerFetcher
b-per 09220b3
fix(semantic-layer): extract pa.Table column in get_dimension_values
b-per 094634a
fix(semantic-layer): access dimension_values column by name not index
b-per e8dfe38
feat(semantic-layer): register get_dimension_values tool name and prompt
b-per 19fa51b
feat(semantic-layer): add get_dimension_values MCP tool
b-per 14e35c1
chore: changelog and regenerated docs for get_dimension_values
b-per 09b1319
fix(semantic-layer): widen values type, add error handling and limit …
b-per 81f58a7
fix(semantic-layer): stringify dimension values for consistent list[s…
b-per 0f489f6
docs(semantic-layer): update get_dimension_values prompt example wording
b-per b685479
fix(semantic-layer): omit null dimension values instead of converting…
b-per 7eebbb7
fix(semantic-layer): case-insensitive column lookup and add get_dimen…
b-per 94959e2
refactor(tests): extract shared fixtures for get_dimension_values tes…
b-per fe36483
fix(types): tighten raw_table annotation to pa.Table in get_dimension…
b-per c7867bc
Merge branch 'main' into feat/get-dimension-values
jairus-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| kind: Bug Fix | ||
| body: 'Fix get_dimension_values: stringify dimension values to maintain list[str] type, omit nulls, add error handling, add limit >= 1 validation' | ||
| time: 2026-05-19T14:21:46.951552+02:00 |
3 changes: 3 additions & 0 deletions
3
.changes/unreleased/Enhancement or New Feature-20260519-141400.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| kind: Enhancement or New Feature | ||
| body: Add get_dimension_values tool to Semantic Layer toolset to retrieve distinct values for a dimension | ||
| time: 2026-05-19T14:14:00.872546+02:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/dbt_mcp/prompts/semantic_layer/get_dimension_values.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <instructions> | ||
| Get the distinct values for a given dimension, optionally scoped to specific metrics. | ||
|
|
||
| Use this tool to discover what values exist for a dimension before building a `where` | ||
| filter in `query_metrics`. For example, to filter by country you first call this tool | ||
| to see which country values exist, then use those values in the `where` clause. | ||
|
|
||
| If the response includes `truncated: true`, there are more values than the current | ||
| `limit`. Increase `limit` to retrieve more, or add `metrics` to narrow the scope. | ||
| </instructions> | ||
|
|
||
| <examples> | ||
| <example> | ||
| Question: "I want to filter revenue for a specific country — what countries are available?" | ||
| Thinking step-by-step: | ||
| - The user wants to know valid values for a country dimension | ||
| - I should scope to the "revenue" metric for accurate results | ||
| Parameters: | ||
| dimension="customer__country" | ||
| metrics=["revenue"] | ||
| limit=100 | ||
| </example> | ||
|
|
||
| <example> | ||
| Question: "What are the possible order statuses?" | ||
| Thinking step-by-step: | ||
| - The user wants all distinct values for an order status dimension | ||
| - No specific metric context needed | ||
| Parameters: | ||
| dimension="order__status" | ||
| metrics=null | ||
| limit=100 | ||
| </example> | ||
| </examples> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.