Repository navigation
Add the entity tools - #2537
Merged
Merged
Add the entity tools#2537
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.
Closes #2534
What
The F-ENT (#2417) entity tools (MCP-01, P1). Agents read facts, relations, unsourced facts and the blast radius, and propose one fact with its source, or a relation, in the write-tool conventions of #2514.
EntityTools(FluentCMS.Core.Builtin.Tools):get_entity_facts(source, owner, validity and the unsourced flag, for the latest draft or a version),get_entity_relations(both directions),list_unsourced_facts(the site or one entity type) andget_blast_radius(the published entries a set's entity changes affect, with old and new values per path).set_entity_factproposes one fact with its value, source, owner and validity, and keeps the other facts. A property left out is stored as null, so a fact without a source is flagged unsourced.relate_entitiesproposes a relation. It sets a single reference field, or adds to a list of references without duplicates, and keeps the field's metadata. A field that is not a reference field is refused with the newfield_not_relation. A plain entry is refused withentry_not_entity.base_version, change it in a copy, and propose an update from the published version, or a create while the entity was never published, asupdate_entrydoes.ProposedEntryWrite: the propose flowEntryToolsused, moved into a shared helper with the update rule and the hints, so entry and entity writes commit a version and its operation the same way.ToolArgumentsReadergainsRequiredValue, for an argument that can be any JSON value but null (a fact's value), andOptionalObject.ToolJsonrenders facts, flags, relations and the blast radius. The ENT rows ofMcpCoverageTestslist the new tools; stale facts stay open on F-ENT: Entity registry with sources, validity and blast radius #2417.Why
S1's pipeline agent changes one fact per product, with the export as its source. With
update_entryalone it would have to resend each whole entity.set_entity_factandrelate_entitieschange only the fact or relation they name, and go through the same validation, reference checks, fact index and change set as any entry write. The reads make the earlier F-ENT slices (#2528, #2530, #2533) reachable over MCP.Choices worth a look:
update_entry.Tests
Unit (Core):
EntityToolsConformanceTests;McpCoverageTestswith the new rows.Integration over MCP, each on SQLite and PostgreSQL:
list_unsourced_facts.relate_entitiesadds a spec and sets a category;get_entity_relationsshows both outgoing, and the spec shows the product incoming.The full suite ran locally against a
postgres:17container as well as SQLite. No migration, no new package and no new project reference.Checklist
v2