Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new “deep context” schema-observer capability to the Claude Code executor, exposing schema navigation via a new MCP tool intended to work off manifest.json-like inputs.
Changes:
- Introduces a new
Observerutility that loads and traverses a schema tree (including dbt manifest conversion). - Wires
ObserverintoClaudeCodeExecutorandClaudeModelWrapper. - Adds an MCP tool (
get_data_schema) to query schema nodes by path/depth, plus a new agent config field for the schema file path.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
databao/agent/executors/observer.py |
New observer implementation for loading/converting schema and serving depth-limited views |
databao/agent/executors/claude_code/executor.py |
Instantiates Observer from agent config and passes it into the Claude wrapper |
databao/agent/executors/claude_code/claude_model_wrapper.py |
Adds observer param and registers the get_data_schema MCP tool when present |
databao/agent/configs/agent.py |
Adds schema_yaml_path configuration field |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| Supported by OpenAI models only.""" | ||
|
|
||
| schema_yaml_path: Path | None = None | ||
| """Path to a YAML file containing the schema of the datasource.""" |
Comment on lines
+40
to
+54
| schemas: Node = cast(Node, db_node["schemas"]) | ||
| if schema not in schemas: | ||
| schemas[schema] = {"tables": {}} | ||
| tables: Node = cast(Node, schemas[schema]) | ||
|
|
||
| table_entry: dict[str, Any] = {"columns": {}} | ||
| description = node.get("description", "") | ||
| if description: | ||
| table_entry["description"] = description | ||
| for col_name, col in node.get("columns", {}).items(): | ||
| col_data = {k: v for k, v in col.items() if k != "name" and v} | ||
| table_entry["columns"][col_name] = col_data | ||
|
|
||
| tables[table] = cast(Node, table_entry) | ||
|
|
| if "nodes" in data: | ||
| self.context = self.convert_from_manifest(data) | ||
| else: | ||
| self.context = data |
Comment on lines
+71
to
+87
| def get_node(self, path: list[str], depth: int = 0) -> str: | ||
| if self.context is None: | ||
| return "Data is not available." | ||
| if not path: | ||
| answer = "Result for empty path - root:\n" | ||
| res: str | Node | int = self.context | ||
| else: | ||
| res = self.get_value(path, self.context) | ||
| answer = f"Result for path: {'/'.join(path)}, depth {depth}\n" | ||
| if res: | ||
| if isinstance(res, dict): | ||
| if depth == 0: | ||
| return answer + self.get_auto_depth(res) | ||
| return answer + self.get_with_depth(res, depth) | ||
| else: | ||
| return answer + str(res) | ||
| return "Path not found." |
Comment on lines
+89
to
+97
| def get_value(self, path: list[str], current_node: Node) -> str | Node | int: | ||
| if path[0] not in current_node: | ||
| return f"Node {path[0]} not found." | ||
| value = current_node[path[0]] | ||
| if len(path) == 1: | ||
| return value | ||
| if not isinstance(value, dict): | ||
| return f"Node {path[0]} is not a dict." | ||
| return self.get_value(path[1:], value) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added new tool (MCP) for Clade Agent, which works with manifest.json
Observer converts manifest to more useful format and gives depth-dependent access.