Skip to content

feat: add multi-project semantic layer tools#660

Draft
DevonFulcher wants to merge 8 commits intodf/multiproject-phase1-corefrom
df/multiproject-phase3-semantic-layer
Draft

feat: add multi-project semantic layer tools#660
DevonFulcher wants to merge 8 commits intodf/multiproject-phase1-corefrom
df/multiproject-phase3-semantic-layer

Conversation

@DevonFulcher
Copy link
Collaborator

Why

To support multi-project scenarios where an AI assistant needs to query metrics across different dbt projects, we need semantic layer tools that accept a project_id parameter to dynamically resolve the correct environment configuration.

What

Adds 6 multi-project semantic layer tools that mirror the existing single-project tools but accept project_id as a required first parameter:

  • list_metrics_for_project
  • list_saved_queries_for_project
  • get_dimensions_for_project
  • get_entities_for_project
  • query_metrics_for_project
  • get_metrics_compiled_sql_for_project

Each tool resolves the project's production environment via get_config_for_project() (from Phase 1) and passes the resulting config as a config_override to the existing SemanticLayerFetcher methods.

Key changes:

  • client.py: Added config_override parameter to all SemanticLayerFetcher methods and a _resolve_client() helper for SDK-based operations
  • tools_multiproject.py: New file with the 6 multi-project tool definitions and registration function
  • tool_names.py / toolsets.py: New ToolName entries and MULTI_PROJECT_SEMANTIC_LAYER toolset
  • config.py / settings.py: Enable/disable configuration for the new toolset (disabled by default)
  • Tests: Updated existing tests to account for the new toolset

Notes

Drafted by Claude Opus 4.6 under the direction of @DevonFulcher

DevonFulcher and others added 7 commits March 17, 2026 12:57
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove get_config_for_project() from all config providers. Each
multiproject semantic layer tool now calls _resolve_sl_config_for_project()
which fetches credentials, builds the platform URL/headers, calls
get_environments_for_project() directly, and returns the config via
DefaultSemanticLayerConfigProvider._build_config().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add multi_project_only_toolsets set to toolsets.py and update
generate_docs.py to skip those toolsets when generating README
and diagram documentation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
diagram.d2 is already correct (multi-project toolset excluded).
Restoring d2.png to match the unchanged diagram source.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@DevonFulcher DevonFulcher force-pushed the df/multiproject-phase3-semantic-layer branch from 5439df1 to 1fe558d Compare March 17, 2026 17:59
…ools

Multi-project server cannot run alongside single-project server, so tools
share the same names (list_metrics, not list_metrics_for_project) and are
controlled by the same env vars (DISABLE_SEMANTIC_LAYER).

Remove MULTI_PROJECT_SEMANTIC_LAYER toolset, multi_project_only_toolsets,
and multi_project_tools variables. Remove disable/enable_multi_project_semantic_layer
settings fields. Remove multi_project_only_toolsets filtering from generate_docs.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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