Add structured summaries for connection groups - #373
Open
rwill128 wants to merge 1 commit into
Open
Conversation
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.
Problem
When agents use FLE through the MCP/REPL workflow,
connect_entities(...)returns rich Python objects such asBeltGroup,PipeGroup, andElectricityGroup. Those objects are useful interactively, but their default string output is hard for an agent to validate programmatically.For example, an agent can see that a route exists, but to answer basic questions like these it currently has to inspect attributes manually or parse repr text:
That makes route validation brittle in agent code and in MCP logs.
Change
This PR adds a non-breaking structured summary method to connection group models:
The existing object attributes and
__repr__/str(...)behavior are preserved. This only adds an explicit machine-readable representation for agents and tests.Implemented summaries for:
BeltGroup: connection kind, status, aggregate inventory, input/output belts, per-belt positions, directions, lane inventories, source/terminus flags, and belt countPipeGroup: connection kind, status, fluid, per-pipe positions, flow rate, contents, fluidbox IDs, and pipe countElectricityGroup: connection kind, status, electrical network ID, per-pole positions, flow rates, max flow rate, and pole countWallGroup: entity list and countWhy this shape
This does not add a new MCP tool or change the MCP protocol surface. FLE's MCP interface is already REPL-oriented, so agents receive and manipulate these Python objects inside
execute(code). Addingto_connection_dict()gives agents a stable validation surface without breaking existing callers or forcing string parsing.A separate follow-up could expose similar structured data automatically in MCP responses or add structured failure details for blocked routes. This PR focuses only on successful connection group summaries.
Example
Testing