Skip to content

Add additional MCP tools#1811

Merged
shangyian merged 2 commits intoDataJunction:mainfrom
shangyian:more-mcp-tools
Mar 1, 2026
Merged

Add additional MCP tools#1811
shangyian merged 2 commits intoDataJunction:mainfrom
shangyian:more-mcp-tools

Conversation

@shangyian
Copy link
Collaborator

@shangyian shangyian commented Mar 1, 2026

Summary

This PR enhances the DJ MCP server and Claude Code integration with several new features:

New MCP Tool: get_query_plan

This tool calls GET /sql/measures/v3/ to expose the DJ query execution plan. This shows how a set of metrics decomposes into grain groups (sets of metrics that share a dimensional grain and are computed in one SQL query), the atomic aggregation components within each group, and the combiner expressions that reassemble them into final metric values. This is useful for debugging unexpected results, understanding multi-metric query structure, and validating semantic model design.

Enhanced search_nodes

Added five new filters, all wired through to findNodes in the GraphQL API:

  • tags: filter to nodes tagged with all specified tag names
  • statuses: filter by validity status (valid/invalid)
  • mode: filter by published or draft
  • owned_by: filter to nodes owned by a specific user/email
  • has_materialization: return only nodes with materializations configured

get_common (replaces get_common_dimensions)

Bidirectional semantic compatibility lookup in a single tool:

  • Pass metrics: GraphQL commonDimensions query: what dimensions are shared across all those metrics?
  • Pass dimensions: REST GET /dimensions/common/?node_type=metric: what metrics can be queried by all those dimensions?

dj setup-claude subagent installation

setup-claude now also installs a Claude Code subagent at ~/.claude/agents/dj.md with the datajunction skill preloaded. Controlled with --agents / --no-agents flags (default: on). The subagent surfaces the full DJ skill to any Claude Code session automatically.

Skill documentation updates

  • Corrected cube partition YAML spec
  • Clarified how partition filter pushdown works (eg because upstream nodes share the same dimension link)
  • Updated the temporal filters section to reference get_query_plan instead of build_metric_sql

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

@netlify
Copy link

netlify bot commented Mar 1, 2026

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit 4fc0352
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/69a4aaa44fc2e30008351336

@shangyian shangyian marked this pull request as ready for review March 1, 2026 21:08
@shangyian shangyian merged commit 2f07d51 into DataJunction:main Mar 1, 2026
17 checks passed
@shangyian shangyian deleted the more-mcp-tools branch March 1, 2026 21:15
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.

1 participant