Skip to content

Deep context#258

Open
kosstbarz wants to merge 3 commits intomainfrom
kosst/deep_context
Open

Deep context#258
kosstbarz wants to merge 3 commits intomainfrom
kosst/deep_context

Conversation

@kosstbarz
Copy link
Contributor

Added new tool (MCP) for Clade Agent, which works with manifest.json
Observer converts manifest to more useful format and gives depth-dependent access.

@kosstbarz kosstbarz requested a review from a team March 12, 2026 15:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Observer utility that loads and traverses a schema tree (including dbt manifest conversion).
  • Wires Observer into ClaudeCodeExecutor and ClaudeModelWrapper.
  • 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)
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.

2 participants