Change mocks with the assistant
Before you begin
- Role
- Editor or higher to ask and apply and Viewer or higher to read proposals.
- You need
- A project
The assistant answers questions about a project’s mocks and proposes changes to them, such as a header on several mocks, a delay or a fixed template. Nothing changes until you review its proposal and apply it.
-
Open the assistant in one of three ways:
- Select Assistant in the project’s header to ask about the page you are on: the mock open in the editor, the Scenarios tab, or the Data store tab and the collection open on it. Elsewhere it asks about the whole project.
- On the Mocks tab, tick up to 50 mocks and select Ask AI… to ask about those.
- On a mock whose response will not render, select Fix with AI, in its opened row on the Mocks tab or in the mock editor.
-
In Ask the assistant, write what you want, such as
Add an X-Request-Id header with a random UUID to these responses, or select one of the suggestions. -
Select Send, or press Enter.
While it works, the panel shows Reading the project…, Thinking… and Checking the answer…, with the time taken.
What the assistant looks at is shown above the box as chips, such as the mock’s name, Scenarios or Data store: books after Asking from. From Scenarios, “add a new one” means a scenario, and when the tab lists one scenario, the chip reads Scenario: and its name, such as Scenario: checkout, and “this scenario” means it; from the Data store, the collection open there. Remove the chip to ask about the whole project instead. A conversation under way keeps what it started with when you move to another page. The project’s header offers no Assistant on Chaos, Alerts, Webhooks and Settings, which it cannot change.
Ask about traffic
Section titled “Ask about traffic”The assistant can also start from requests the project received. Each of these opens the panel on the requests, with an instruction in Ask the assistant that you can change before you select Send:
| Where | Select | The assistant is asked |
|---|---|---|
| Why didn’t this match? on a request in Request logs | Explain and fix with AI, or Fix with AI on the mock that should have answered it | Why didn’t this request match, and how do I fix it? |
| The mock’s response did not render on a request in Request logs | Fix with AI | Fix this mock so that its response renders for this request. |
| A row of Unmatched requests in Insights | Mock with AI | Create mocks for these requests. |
| An endpoint on the Captures tab | Tick up to 10 and select Parameterise selected with AI, or Update with AI on a Mocked one | Give each endpoint one mock that answers every request to it. |
For a request that matched no mock, the assistant first runs Why didn’t this match? again and works from what it finds; see Find out why a mock did not match. For a request whose response did not render, it reads why, as the log kept it, and which of the mock’s responses failed when MockHub can tell: the one the request named in a request override, the step of its sequence, or its default, as long as the mock has not changed since. MockHub sends the request to the fixed mock in the sandbox before you review the proposal. For an endpoint, it reads up to three of its newest requests from the last 30 days, and for a captured one what the upstream answered. On a captured endpoint a mock already answers, it is asked to change that mock rather than add another. On the Captures tab, Keep timestamps and ids fresh and Fill with random data each add a sentence to the instruction; see Parameterise with AI.
Opened from the project’s header, the empty panel also lists, under Needs attention, how many mocks will not render, which opens them on the Mocks tab, and the week’s three endpoints with the most requests no mock answered, each with Mock with AI.
Those requests were written by whoever called your project’s address, not by you. The assistant treats them as data, but a request can still carry text meant to steer it, so read what it proposes from traffic as carefully as anything else, and look at the mocks it creates before you activate them.
Result
Section titled “Result”The assistant answers in one of three ways:
- An answer in plain text, with links to the mocks it names.
- Questions, when the request is ambiguous. Select an option or type an answer, then select Send answers.
- A proposal, shown as Proposed changes · written by AI with its summary, how many changes are ready, how many could not be included, and whether any affects a live mock. Select Review and the number of changes to open it.
If the connection drops while it works, the panel says so: a proposal it made still appears under History, and the request is not sent again.
Review and apply a proposal
Section titled “Review and apply a proposal”Review the assistant’s proposal lists the changes in groups: new mocks, changed mocks, status changes, Scenarios, Data store seeds and Data store records. Every title, label and change on the page is written by MockHub from what will actually change; only the summary is the model’s.
-
For each change, select Changes to see what it changes in each part of each mock.
-
Read the labels and warnings on each change:
Label Means Changes a live mock It changes, starts or stops a mock that answers requests now Ten or more mocks It changes ten or more mocks at once Answers like an existing mock A new mock answers the same requests as one the project has, named in its warning Over the plan limit Activating it would pass the plan’s active mock limit, so applying it is refused Not rendered MockHub could not try the response in the sandbox; its warning says why Breaks the contract The response it rendered does not match the project’s OpenAPI contract Misses a request The mock does not take one of the logged requests it was made from; its warning names the request -
Untick any change you do not want. Unticking a change also unticks the changes that need it, and ticking one ticks what it needs; the page names them.
-
Select Apply and the number of changes. The button says how many affect live mocks. With nothing ticked it is dimmed, and selecting it goes to the first change you can tick, or to the warning that none can be applied.
Changes shows each part once, marked line by line: a line marked − is in the mock Now, and a line marked + is in it After the change. Unchanged lines away from a change are folded; Show unchanged lines shows them.
A mock with several responses is shown one response at a time, each marked New response, Removed, Changed or Unchanged, with the Responses of the mock listed first. The assistant changes one response at a time by its key, so the others stay as they were. It can also give a mock, new or existing, more responses, choose which one answers by default, or set the steps of a sequence. It removes a response only when it replaces a mock’s one response with a sequence of new ones, and never one an OpenAPI import made.
A change made from logged requests says so, such as Made from: GET /orders/43, GET /orders/44. MockHub sends each of those requests to the mock in the sandbox before you review it. Misses a request means the mock does not take one of them, and its warning names the request and the rule it failed, such as “It does not take GET /orders/43, one of the requests it was made from: URL does not match”.
The changes are saved together or not at all. Each changed mock gets a new version labelled AI assistant change in its version history, and the workspace’s activity records them with you as the person who applied them.
Mocks the assistant creates are Inactive. Select Review and activate to open them on the Mocks tab, ticked, and activate them as you would generated mocks.
A response the assistant wrote that will not render is listed with a warning on its change, and so is one whose body is not the JSON or XML its Content-Type names, such as “The response of “status note” does not render as valid JSON.” Once applied, the mock is marked on the Mocks tab like a generated one, with Fix with AI.
Changes the assistant could not include are listed under Couldn’t include, each with the reason, such as a request to delete a mock. A change marked out of date changes a mock that was edited after the proposal was made: apply the rest without it, or select Ask again.
A change to a scenario is out of date once someone edits the scenario’s states, and so is a mock that attaches to a state removed since.
To ask for something different, select Refine: the panel opens on the proposal, and its new proposal replaces this one. Discard closes the proposal without applying anything.
Back, and Done once the proposal is applied, return to the page you opened the review from. After a reload the page cannot tell where that was, so the button reads Back to mocks and opens the Mocks tab.
Ask for a flow
Section titled “Ask for a flow”Ask for a flow, such as Make this a checkout flow: cart, paid, shipped, and the proposal can create a scenario with its states, or add states to one the project has, together with the mocks that move it from state to state. The scenario changes are listed under Scenarios: Changes shows the scenario’s states, and a scenario the proposal creates is marked (new).
MockHub checks the flow without sending requests: a state that no mock moves the scenario into gets a warning, such as “No mock moves “checkout” into “shipped”.” When the project already has a scenario of that name, the proposal creates one with the next free name, such as checkout-2, and its warning says so.
Applying creates the scenario and its states before the mocks that use them. The mocks are Inactive, as any mock the assistant creates; select Open scenarios to see the scenario.
Fill an empty data store collection
Section titled “Fill an empty data store collection”When the plan includes the data store and the project uses response templates, ask for records, such as Seed books so GET /books/{id} answers three books, and the proposal can seed a collection that holds no records. The seeds are listed under Data store seeds, and Changes shows every record.
A seed is not held back the way a new mock is: its records are written when you apply, and the mocks that read the collection use them at once. Read by a live mock marks a seed whose collection an active mock reads.
A seed goes only into an empty collection. The assistant cannot propose one for a collection with records, and if records arrive before you apply, applying is refused as out of date. After applying, the page says what each seed did, such as “Seeded books with 3 records.” or, when records arrived in the meantime, “books already had records, so it was not seeded.” The rest of the proposal is applied either way. If the data store does not answer, nothing is applied: try again, or untick the seeds.
Add or change records
Section titled “Add or change records”For a collection that holds records, ask for a record or a correction, such as Add Ulysses by James Joyce to books or Emma was published in 1816, correct it. From the Data store tab with a collection open, the empty panel suggests Add a record to this collection and Change a record in this collection. The assistant reads some of the collection’s records to answer, so it can also answer a question about them; see What is sent to the model.
The changes are listed under Data store records. Changes shows one record at a time by its key: New record for one the proposal adds, and Changed for one it replaces, with the record Now and After. A changed record is replaced whole, so check every field, not only the one you asked about.
Like a seed, the records are written when you apply, and the mocks that read the collection use them at once; Read by a live mock marks a change to a collection an active mock reads.
The assistant changes only a record it read whole. It cannot change one whose values were replaced before sending, or one beyond the records it read: that change is listed under Couldn’t include, and you can change the record yourself as in Edit data store records.
If a record the proposal changes is edited before you apply, applying is refused as out of date. After applying, the page says what each change did, such as “Wrote 2 records to books.” If one of its records changed, or a key it adds was taken, in the moment between the check and the write, none of that change’s records are written and the page says “books was not written to: its records changed after the assistant read them.” The rest of the proposal is applied either way.
Try to fix a proposal
Section titled “Try to fix a proposal”When some changes of a proposal you asked for failed their checks, such as a response that will not render, one that breaks the contract, a state no mock moves into, or a change under Couldn’t include because the assistant wrote it wrong, select Try to fix and the number of changes, beside Refine.
The panel opens and sends those changes back to the assistant with what MockHub found wrong with each, in the conversation the proposal came from. When it fixed something, the page opens the new proposal: changes it rewrote are tagged Changed by Try to fix, and every other change is exactly as you reviewed it.
Try to fix rewrites only the changes that failed, and never adds or drops one. A rewrite MockHub refuses leaves the change as it was, and the panel names it with the reason. When nothing was fixed, the proposal stays open as it was.
A proposal is fixed once: the new proposal offers no second Try to fix, so refine it in your own words if it still needs a change. Failures the assistant cannot act on, such as a plan limit or a request it does not do, are not sent.
Revert an applied proposal
Section titled “Revert an applied proposal”-
Select Assistant in the project’s header, then History.
-
Next to the applied proposal, select Revert…. The same button is on the proposal’s page.
-
Read the list: mocks that go back to how they were before the change, and mocks Kept as they are with the reason, such as one edited after the change.
-
Select Revert.
A mock the assistant created is deleted, unless it was changed since or a webhook fires on it. A mock it changed gets its earlier content back as a new version labelled Revert of an AI assistant change.
A scenario the assistant created is deleted, and states it added are removed, unless the scenario was edited since or a mock that stays uses them. A scenario in a removed state goes back to Started, and the list says so. A seeded collection is emptied only while it holds exactly the records the seed wrote; records anyone changed are kept, and so are all of them when the data store does not answer. Records the assistant changed get back the value they had, and records it added are removed, each only while it still holds what the assistant wrote; a record anyone changed since is kept as it is and listed under Kept as they are.
What is sent to the model
Section titled “What is sent to the model”The request is sent to a third-party AI model, only through providers that do not collect the data they receive, with:
- your request, and the earlier turns of the conversation, which your browser keeps and sends;
- the project’s name, its mock and scenario counts, and your role;
- a list of the project’s mocks by status, request and name, with how many responses each has;
- the mocks the request is about in full, and on the whole project a few that match its words, with the values of common secrets and the project’s Body keys to redact in captures replaced, as for generation.
When it starts from traffic, it also sends the logged requests: their method, path, query, headers and body as the request logs stored them, with the same values replaced, the headers and body cut short; for Explain and fix with AI what Why didn’t this match? found, for Fix with AI on a request whose response did not render the reason its log kept, and for Parameterise selected with AI and Update with AI the status, content type and body the upstream answered with. See Your data in MockHub.
When it may write to the data store, it also sends each collection’s name, how many records it holds and which mocks use it, and the first 20 records, up to 8 KB, of at most three collections: the one open on the Data store tab, those your request names and those the mocks it is about use. Common secrets and the project’s Body keys to redact in captures are replaced in each record first, and a record changed that way cannot be changed by the assistant. Records are whatever callers sent to the mocks that save them, so read a proposal made from them as carefully as one made from traffic. Try to fix sends the changes that failed with what MockHub found wrong with each, the mocks they change and the logged requests they were made from, with the same values replaced, and the names of the changes that passed.
MockHub keeps the proposal: its summary and the changes, for review and revert. It does not keep your request, what was sent or the model’s answer.
Limits
Section titled “Limits”- The assistant creates, changes, activates and deactivates mocks, sets a response header and sets a delay, creates scenarios and adds states to them, fills empty data store collections, and adds records to a collection or replaces ones it read. It never deletes anything, a record included. It does not rename or remove one of a mock’s responses, or turn its request overrides on or off; it does not rename a scenario, remove or reorder its states, or reset or set the state it is in; it does not change part of a record, only the whole of it, or a record it did not read; and it does not change project settings, webhooks or chaos profiles.
- A proposal creates at most 3 scenarios and adds at most 10 states in one change, seeds at most 3 collections and adds or changes records in at most 3, with at most 100 records each and one change per collection, within the plan’s data store limits.
- A flow is checked for states no mock reaches, not played through the sandbox.
- Try to fix runs once per proposal, and spends one AI credit like any other request.
- A proposal holds at most 25 changes, creates at most 10 mocks and changes at most 100 mocks in one change. A request is at most 2,000 characters.
- Only the person who asked can apply, refine or discard a proposal. Other members of the workspace read it.
- A proposal can be applied for 24 hours, and an applied one reverted for 14 days.
- Each change is tried in the sandbox before you review it, with a request made from its method and path, at most ten responses a proposal. A mock matched on a path pattern, or only on headers, query or body, is not tried, and neither are delays. Tries do not count towards the workspace’s requests.
- Each request to the assistant spends 1 AI credit and each AI generation 5, from one allowance the plan sets per day and per month; the limits page lists it. The AI assistant panel shows how many credits are left today, or this month once that is the smaller number. A request that fails before the AI provider charges for it gives its credit back.
- The assistant does not work through MCP or the API with a machine token.
- A refusal says why: Proposal closed, Mocks changed, AI generation paused, AI unavailable, AI switched off for this workspace or a plan limit.
- A change made from logged requests is tried with each of them too, within the same ten responses; a warning names any request left over. A request the log kept only in part is sent as it was kept, and the warning says what was left out.
- Each question about why a request matched no mock runs Why didn’t this match? again first, which uses up to six more requests to the project. A request whose request override the gateway refused is not one the assistant explains; Why didn’t this match? says why the response could not be served.
- Mock with AI, Parameterise selected with AI and Update with AI need the endpoint’s requests or captures in the request logs from the last 30 days; once they are older or deleted, the assistant says none are left.
Related
Section titled “Related”- Generate mocks with AI
- Version history
- Activate and deactivate mocks
- Connect an AI assistant, for an MCP client such as Claude Code