Repository navigation
Add the entity tools #2534
Copy link
Copy link
Closed
Labels
area:entitiesEntities and facts (ENT)Entities and facts (ENT)type:featureNew capabilityNew capabilityv2FluentCMS v2 (v2 branch)FluentCMS v2 (v2 branch)
Milestone
Description
Part of #2417 (F-ENT). The entity tools (MCP-01, P1): agents read facts, relations, unsourced facts and the blast radius, and propose a fact with its source or a relation, in the write-tool conventions of #2514. Entities are entries of entity types, so create_entry and update_entry (#2523) already write whole entities. These tools add the fact-level writes S1's pipeline agent needs and the reads of the earlier F-ENT slices (#2526, #2529, #2532). Listing stale facts comes with the stale slice (ENT-03), which waits for the job queue (#2531).
Scope
- Core (
FluentCMS.Core.Builtin.Tools):EntityTools, a tool provider withget_entity_facts: an entity's facts with their source, owner, validity and unsourced flag, for its latest draft or a named version (ENT-02).get_entity_relations: the entities it relates to and the entities that relate to it (ENT-01).list_unsourced_facts: the unsourced facts of the site, or of one entity type (ENT-02).get_blast_radius: the published entries a change set's entity changes affect, each with the old and new value at each path (ENT-04).set_entity_fact: proposes one fact of an entity, with its value, source, owner and validity, keeping the other facts. Every fact property it leaves out is stored as null, so a fact without a source is flagged.relate_entities: proposes a relation. It sets a single reference field, or adds to a list of references, and keeps the fact's metadata.- The two writes take
base_versionand a change set target, likeupdate_entry, and propose an update, or a create while the entity was never published.
- The propose flow
EntryToolsuses moves into a shared helper, so entry and entity writes commit a version and its operation the same way. ToolArgumentsReader.RequiredValuereads an argument that can be any JSON value but null, such as a fact's value.- The ENT rows of
McpCoverageTestslist the tools; stale facts stay open on F-ENT: Entity registry with sources, validity and blast radius #2417.
Out of scope
- Listing stale facts: with ENT-03.
- Removing a relation:
update_entrywrites the whole entity. - Opening a set from the blast radius on its own: the set holds the entity operations, and the blast radius is read from it.
Acceptance
- S1 over MCP: an agent sets the prices of two products with the export file as source, in one session's set, then reads the blast radius. It shows the published product page of each product with the old and new price. The page of an untouched product is not in it.
- A fact set without a source reads back flagged unsourced, and
list_unsourced_factslists it. relate_entitiesadds a spec to a product's specs and sets its category, andget_entity_relationsshows both directions.- A stale base version, a field the type does not have and a related id of the wrong type are refused with hints, and store nothing. Fact writes on a plain entry are refused.
- Every tool passes
ToolProviderConformanceTestsand the MCP-01 coverage test. - Everything above passes on SQLite and PostgreSQL, with no new package.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:entitiesEntities and facts (ENT)Entities and facts (ENT)type:featureNew capabilityNew capabilityv2FluentCMS v2 (v2 branch)FluentCMS v2 (v2 branch)
Activity
Add the entity tools (#2537)