Skip to content

Add structured content output to get_lineage tool#646

Open
jgiuffrida wants to merge 3 commits intomainfrom
jgiu/add-lineage-structured-content
Open

Add structured content output to get_lineage tool#646
jgiuffrida wants to merge 3 commits intomainfrom
jgiu/add-lineage-structured-content

Conversation

@jgiuffrida
Copy link
Collaborator

Summary

  • Return a LineageGraph model via structuredContent on CallToolResult, enabling MCP hosts to consume lineage as typed nodes and edges
  • Raw JSON nodes are still returned in content for backwards compatibility
  • Add unit tests for the structured output transformation (graph shape, edge filtering, empty results, missing parentIds)

Test plan

  • task check passes (ruff, mypy, all linters)
  • task test:unit passes (452 tests including 7 new)
  • Manual verification with MCP Inspector

🤖 Generated with Claude Code

Return a LineageGraph model via structuredContent on CallToolResult,
enabling MCP hosts to consume lineage data programmatically. The text
content still contains the raw JSON nodes for backwards compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove unused imports (LineageEdge, LineageGraph, LineageNode) and
apply ruff formatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
) -> list[dict]:
return await context.lineage_fetcher.fetch_lineage(
) -> Annotated[CallToolResult, LineageGraph]:
nodes = await context.lineage_fetcher.fetch_lineage(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps fetch_lineage should return the pydantic model? Less dicts and more typed objects in general are better.

Copy link
Collaborator

@DevonFulcher DevonFulcher left a comment

Choose a reason for hiding this comment

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

Nice!

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