Worked Example
Published 10 September 2026
This page walks through giving high level instructions to an agent, showing tool call by tool call, so you can see how the pieces from Tool reference fit together in practice. You do not need to ask for specific tool calls, the agent will figure that out from your instructions and the current state of the project.
Load the project
Every session starts here, regardless of what you ask for next.
-
load_projectwithprojectFolderset to the absolute path of the directory containingflyway.toml.Returns a
workspaceId, e.g.ws-1234—the agent reuses this in every subsequent tool call for the session.
If you edit the project's flyway.toml mid-session (for example, to add an environment), the agent should call
reload_project with the same workspaceId rather than load_project again—this keeps existing diffs and
artifacts instead of discarding them.
"Generate migration scripts for the views I've updated in my development database"
1. Capture the database changes into the schema model first
The request describes changes that exist in the database but haven't been captured into the schema model yet, so the agent starts there:
-
create_diff_schema_modelwithworkspaceId: "ws-1234".Returns a
diffId, e.g.diff-1, and a list of changed objects, e.g.[{changeId: "chg-1", object: "dbo.CustomerSummary", type: "View"}]. -
update_schema_modelwithworkspaceId: "ws-1234",diffId: "diff-1",changes: "*"(since the request said "the views I've updated", not a specific subset).Returns the list of schema model files that were updated, e.g.
["Views/dbo.CustomerSummary.sql"].
At this point the schema model reflects the database changes—nothing has touched a migration script yet.
2. Diff the schema model against the current migrations
-
create_diff_migrationswithworkspaceId: "ws-1234".Diffs the schema model against the current migration scripts (built via the shadow environment), and returns a
diffId, e.g.diff-2, with a list of changes not yet represented by a migration script—in this case, the view change just captured.
3. Generate the migration script
-
generate_migrationswithworkspaceId: "ws-1234",migrationsDiffId: "diff-2",changes: "*", and adescriptionthe agent infers from context (e.g."update customer summary view").Returns the migration folder path and the generated files, e.g.
["V1.2__update_customer_summary_view.sql"], along with any warnings raised during generation.
4. Review before finishing
-
(recommended)
review_codewithworkspaceId: "ws-1234"andfileset to the generated script's path.Returns any rule violations found, their definitions, and
total_rules_checked. A well-behaved agent surfaces these to you rather than silently ignoring them.
Four tool calls, chosen and sequenced by the agent from one sentence of instruction. A different request would
have taken a different path. For example, "apply my schema model changes to my development database" would start
from create_diff_development instead, skipping the capture and generate steps entirely.
This documentation contains proprietary information and is protected by copyright law.
Copyright © 2026 Red Gate Software Limited. All rights reserved