Tool Mocks
Open in CMSA tool is something your agent uses while it answers, such as looking up a book or sending a request to another system, and each time it does, that is a tool call. A mock is a scripted answer for a tool. When a scenario runs and the agent calls that tool, Qlar sends back your answer instead of contacting the real system, so the test gives the same result every time and changes nothing real. In this guide you learn how to build a mock set, how to attach it to a scenario or to one step, how several sets work together, how to turn a call you saw in a result into a mock, and how to keep your sets tidy. It takes about twenty minutes.
The example agent is Libraría, which has many tools. We use two of its tools: get_book, which looks up a book by its ISBN (its catalogue number), and create_loan, which borrows a book for a member. Your agent has other tools and names. The steps are the same. Tools in Simulations explains tool calls in more detail.
AI can help with this page: it can draft a response for you, and the agent's use of a tool in a run is generated. A drafted response and a run can differ each time, so check what you get before you rely on it.
Key terms
| Term | What it means |
|---|---|
| Mock set | A named group of mocks. One set can mock several tools. |
| Library set | A shared mock set. It is listed on the Tool Mocks screen and can be attached to any scenario of the agent. |
| Private set | A mock set that belongs to one scenario. It is not listed on the Tool Mocks screen. |
| Case | One scripted answer for one tool, used when the call matches the case's conditions. A tool's cases are checked from top to bottom. |
| Condition | A test on one detail of the call, for example "isbn is 9780000000004". A case answers only when all of its conditions hold. |
| Response | What the case gives back to the agent. |
| Otherwise | The answer for a call that matches none of a tool's cases. A set can also pass such calls on to another set. |
Before you start
- You have the Owner or Contributor role on the agent.
- Your agent has at least one tool. A mock set can only mock tools the agent has.
- Tool Mocks shows in the sidebar under Simulation only when the feature is switched on for your CMS.
- You have a scenario to attach the set to, or you will build one with Your First Simulation.
Step 1: Choose between a library set and a private set
Every mock set is one of two kinds.
| Library | Private | |
|---|---|---|
| Who can use it | Any scenario of the agent. | Only the scenario it was made in. |
| Where you build it | Simulation → Tool Mocks, with New Mock Set. | In a scenario, with Add Mock Set → Create New, or from a result with Mock This Call. |
| Where you see it | On the Tool Mocks screen, which lists library sets only. Its edit page shows a Library chip. In a scenario, its row has a book icon. | Only in its scenario, where its row has a lock icon. |
| If you change it | Every scenario that uses it changes. | Only its own scenario changes. |
Start with a private set when the answer is specific to one scenario. Make a library set when several scenarios need the same pretend system, for example "Book unavailable". You can convert one into the other later: Save to Library turns a private set into a library set, and Make a Private Copy copies a library set into one scenario so you can change it without affecting the others.
Step 2: Create a mock set
- In the sidebar, open Simulation and click Tool Mocks.
- Click New Mock Set. On an agent without sets, the empty page says No Mock Sets Yet and has the same button.
The Tool Mocks screen lists your library sets as cards. Each card shows the set's name, how many tools and cases it has, the tools, and "Used in n scenarios".

The editor opens as a page titled New Mock Set, with a Library chip. It has no name field: you name the set when you save it (step 5). An empty set says No Tools Mocked Yet. The Add Tool button, marked below, is where you go next.

- Click Add Tool. A searchable list opens. Type in Search tools… and click the tool you want. The tools are grouped by where they come from: Custom API (an API of your own, which is a way for programs to talk to each other), Plugins, MCP (tools from an MCP server, a service that offers tools to AI agents in a standard way), Other agents, A2A (agents run elsewhere that yours talks to through the A2A standard) and Built-in. Next to each tool you see what happens to it by default when it is not mocked: Blocked unless mocked, Runs live unless mocked or Simulated success. A tool already in the set shows Already in this set.
A heading can include the name of the API group, for example CUSTOM API · LIBRARY. Each row shows the HTTP method of the tool, for example GET for a tool that reads data or POST for one that sends data. The label on the right is what happens to the tool when nothing mocks it, taken from the agent's Tool Policy or the tool's built-in default. A scenario can still change it, so check the Agent Tools panel in a scenario for the final outcome.

The tool appears as a card with its name and a one-line summary, such as "every call 200 OK". The card opens by itself, and only one tool card is open at a time: opening another closes the first. To see what the tool does and which details the agent sends with a call, click the About This Tool button (the ⓘ) in the card's header. It shows the description and the Inputs, one line for each detail the agent sends, with the kind of value it takes, for example "text" or "number", and a star when it is required. You will use these inputs in the conditions. On a Custom API tool you may also see an input named qlarToolsActionDescription. Qlar uses it internally, so you can ignore it.

You can add more tools to the same set, up to 50, with Add Tool under the last card. Remove a tool from the set with the trash button in its card header.
Step 3: Write a case
A new tool starts with one thing only: the Every call returns block. Whatever you write there answers every call to the tool. For a Custom API tool it starts as an empty list, [], with the status 200 OK. That is enough for a quick mock. When the tool should answer differently depending on the call, add cases. A case says: when the agent calls this tool with these details, answer with this.

- Under the Otherwise block, click Add Case. The new case opens with its first condition already there, on the tool's first required input, and an empty response. The Otherwise block is now titled Otherwise, every other call returns. Type a label in Label this case (optional), for example "Known book".
- Under When all of these match, choose the input in the first dropdown, a comparison in the second, and type the value in the third. For example: isbn, is,
9780000000004.

The second dropdown lists the comparisons. The value field has no label of its own, because the input is already chosen on its left.

The finished condition reads isbn is 9780000000004.

- Under the conditions, write the answer. Step 4 shows how.
- Add more cases for other situations, for example "Unknown ISBN". Click Add Case again.
Cases are checked from the top to the bottom, and the first one that matches answers. Once there are two or more cases, a drag handle appears at the left of each one and a hint says "Cases are checked from top to bottom. The first one that matches answers. Drag to reorder." Drag a case to change the order. A closed case shows its label (or "Untitled case"), a short summary of its conditions and, on a Custom API tool, its status. Click the trash button on a case to delete it. If the case has content, Qlar asks first. The arrow at the right opens or closes the case, and only one case or the Otherwise block is open at a time. The ? next to Add Case opens How Cases Work, a short reminder of this order.
Conditions
A condition is three parts: an input, a comparison and a value. The comparisons you can choose depend on the kind of input.
| Kind of input | Comparisons |
|---|---|
| Text, and also lists, objects and anything Qlar cannot classify | is, is not, contains, starts with, ends with, matches pattern (a regular expression, a short pattern that describes text, such as "starts with 978 followed by digits"), is one of (a comma-separated list), is empty, is not empty |
| Number | =, ≠, <, ≤, >, ≥, is between (a Min and a Max, both included) |
| Yes or no | is, then true or false |
Good to know:
- A case answers only when all its conditions hold. Each input can have one condition. An input that already has one shows "(has a condition)" in the other rows' dropdowns, and an input with no condition accepts any value.
- When every input has a condition, Add Condition is greyed out. Point at it to see why (on a phone, tap the ? beside it). To accept more than one value for an input, use is one of, or add another case: separate cases work as "or".
- A case keeps at least one condition, so the last × (the delete button at the end of the row) is greyed out. To answer every call, use the Otherwise block instead.
- Text comparisons ignore upper and lower case. The Aa button appears for the text comparisons where it matters: click it to turn on Match case (on) and compare exactly.
- If a condition shows a highlight, the input it names is no longer an input of the tool, perhaps because the tool changed. Fix or remove the condition, or it will not match.
- A case with no conditions at all would answer every call, so Qlar warns you that the cases below it and the Otherwise are never used.
- Under Advanced — Match Raw Arguments you can add an extra match on the raw details of the call, written as JSON, a plain-text way to write structured data, such as
{"isbn": "9780000000004"}. Most cases do not need it. It opens by itself when it already has text.
Step 4: Write the response
The response is what the agent receives. A new case starts with an empty response, and the box says "Pick a Template, ask for a Suggestion, or type the response." The controls sit around the response box. Suggest is marked in the picture.

| Control | What it does |
|---|---|
| Status | For your own APIs only: the HTTP status code the tool returns. This is a number a web service sends with its answer: 200 means OK, 404 means not found, and a code starting with 5, such as 500, means the service failed. 200 OK is the default. A 5xx code reaches the agent as an empty result, as a real failing API does. |
| Content / MCP error | For MCP tools only: whether the answer is normal content or an error. |
| JSON / Text | For tools with no form, such as your own APIs: the format of the response. Choose JSON, a plain-text way to write structured data such as {"title": "Cosmos"}, or Text for a plain sentence. |
| Form / JSON or Form / Text | For tools that have a form (see the table below): Form gives fields that fit the tool, and the other choice shows the raw text. MCP tools switch between Form and Text. The tool of another agent has no switch, because its form is just the reply text. |
| Template | A menu of ready-made answers for the kind of tool, grouped under Success and Error. For an API, for example, Empty list ([]), Not found (404), Unauthorized (401) or Rate limited (429). For a table query, No rows found or Query fails. Picking one fills the response once, and you can change it afterwards. The button is hidden when the tool has none. |
| Suggest | Asks AI to draft a response for this case, using the tool's description and the case's conditions, so "genre is history" gives history items. The draft opens in a Suggested Response window and nothing changes until you click Use This Suggestion. Try Again asks for another draft. A green dot on the button means a draft is ready to look at. It differs every time, so read it and correct it. |
| Use a Real Response | Makes one real call and lets you keep its answer. See below. |
| Format | Tidies the JSON. Shown when the response is JSON, and greyed out while it has an error. |

Use a Real Response appears only for tools that are safe to call: your own APIs that use GET, and the plugin tools that only read data (the database reader, the data table and public documents). A window opens with one field for each input of the tool, already filled from the case's is conditions. Change them if you like, click Call, and the real answer appears. For your own API, click Use This Response to copy its status and body in, even an error status, which is useful for an error mock. For a table query, choose Use Columns Only to keep the column names, or Use Columns and Rows to keep the data too. You can close the window while the call runs: a green dot shows when the answer is ready, and Call Again refreshes it if you change an input. The call really reaches the real system and the answer may contain real data, so use it only on tools that are safe to call.

Here is the finished case "Known book" for get_book: one condition and a JSON response that gives the book's details.

The Form adapts to the kind of tool, so you rarely type JSON by hand.
| Kind of tool | What the form asks for |
|---|---|
| A table query (a database reader, a data table) | Query succeeds or Query fails. For success: the columns, and a grid of rows. For failure: an Error message. |
| Searching documents | A list of hits, each with a Title, Text and Section. |
| A conversational form | Submitted or Validation errors, and a Message. |
| A reminder | Created or Failed, and a Message. |
| An escalation | The Status (Pending, InProgress or Completed) and the Response message. Other values are filled in for you. |
| Another agent | A Reply text: the reply that agent sends back. |
| An MCP tool | The Content it returns, or an MCP error message. |
Values marked as filled in automatically, such as an ID or a time, come from the call itself and cannot be typed.
Step 5: Decide what happens to every other call, try it and save
The Otherwise block sits under the cases. It decides what happens to a call that matches none of the tool's cases. It holds a response, written the same way as a case's. Click More Options to say how this set works next to other mock sets on the same scenario. The heading reads "If another mock set on the scenario also mocks this tool", and you choose one of three:
| Option | What it does |
|---|---|
| Use only when no other set answers | The usual choice, and the default. The Otherwise answers calls that no case in any attached set matched. If several sets answer this way, the one listed first wins. |
| Use ahead of sets listed below | The Otherwise answers every call this tool's cases did not match, before the cases of the sets listed below this one and before every set's Otherwise. Sets listed above still check their cases first. Choose it when the set should fully replace the tool. |
| Don’t answer; pass to the next set | The set answers only what its cases match. Other calls go to the next attached set, and then to the Tool Policy and the tool's built-in default. The response box is hidden, and your response is kept in case you switch back. |
More Options opens by itself when the set uses one of the last two. A tool that uses one of them also shows a chip, Ahead of sets below or Passes to next set, under its name. The closed card shows a summary such as "1 case · otherwise 200 OK" or "2 cases · otherwise passes on". The next step explains how the sets of a scenario work together.
The picture shows the Otherwise block with More Options open (marked) and the three options.

A tool that passes calls on shows Mocked for some inputs · otherwise … in the Agent Tools panel, so you can see what the rest will do.
Try a call before you save
Next to Add Case, the Try a Call button opens a small panel that shows which case would answer a call like the one you describe, without sending anything to the real tool. Enter the details in the fields, or switch Enter as to JSON, and click Test. The answer reads "Matches case 1: Known book", "No case matched — the Otherwise answered." or "Otherwise: Blocked" (the tool's policy outcome) when your set passes the call on. Cases that were skipped say why. Try a Call checks this one tool in this set only. In a run, a matching case in another attached set answers first.

Save the set
Click Save at the top. On a new set, a dialog titled Save Mock Set opens. It says "We named it after its tools. Change it if you like." The name comes from the tools: one tool gives its name, two tools "A and B", more "A + 2 more". Change the Name (required) and add a Description if you like, then click Save. You see "Mock set created successfully", and the page takes you back to the Tool Mocks screen.

When you edit a set that exists, the page starts with a Mock Set Information card with its Name and Description. Save then asks "Save changes to “…”?" and, if scenarios use the set, adds "It’s used in n scenarios, and all of them will get these answers." You see "Mock set saved successfully", and the page takes you back to the list. If someone else changed the set at the same time, Qlar says "Someone else changed this set. Reload?" and you click Reload.
After saving, the set shows on the Tool Mocks screen as a card, here "1 tool · 1 case" with the tool get_book and "Used in 0 scenarios".

On a phone the editor works the same way, and its pop-up panels (for example Template, Suggest and About This Tool) open from the bottom of the screen.
Step 6: Attach the set to a scenario
A mock set does nothing until a scenario uses it.
- Open a scenario, or click New Scenario.
- Open Tool Mocks in the scenario's setup. On a wide screen the setup starts as a narrow bar at the left of the form: click its Tool Mocks button, or Show Advanced Setup to open the whole pane. On a narrow screen, open the Advanced Setup card below the steps and click Tool Mocks. The section lists Mock sets attached (n). with the note "Used by every step. A step’s own mock sets are checked before these."
- Click Add Mock Set. A menu opens with two choices.
- From Library… ("Reuse a shared set."). The panel Add from library opens. Type in Search mock sets or tools…, tick the sets you want and click the button at the bottom. It reads Add 1 mock set for one set, Add 2 mock sets for two, and so on.
- Create New ("Private to this scenario."). The editor opens in a side panel titled Create mock set. Build it as in steps 2 to 5, then click Apply. A private set has no name field: Qlar names it after its tools. When you open it again, a Mock Set Information card lets you rename it.
- Click Save on the scenario.
The Add Mock Set menu has the two choices:

The Add from library panel with one set ticked:

A new private set in the Create mock set panel, here a set that holds the tool create_loan. It has the same tool cards as the page, and the Apply button at the top:

Each attached set is a row with a book or lock icon, its name, a count such as "2 tools · 5 cases" and the names of its tools. Use the pencil to edit it, and the ⋮ menu for Make a Private Copy, Save to Library or Remove. Save to Library is greyed out until you save the scenario. Remove takes the set off this scenario. A library set stays in the library. A private set only lives in this scenario, so it is gone once you save, unless you chose Save to Library first.
In the picture, the book icon (marked) means a library set and the lock icon (marked) means a private set. A private set you have just created shows an Unsaved changes chip until you save the scenario.

Step 7: Attach a set to one step, and see which set answers
Sometimes only one step needs a pretend answer, for example the third step, where the user asks to borrow a book that has no copies left.
- In the scenario form, open the step's card and click its Tool Mocks (n) heading to expand it. It is collapsed by default.
- Click Add Mock Set and choose From Library… or Create New, as in step 6.
- A line under the heading explains what this step now does, for example "Cases in this step’s 1 set are checked first, then the scenario’s 2 sets; the highest set’s Otherwise answers calls no case matches." when the step has a set of its own and the scenario has sets too, or "This step uses the scenario’s 2 sets." when the step has none. The link What will each tool do in this step? opens the panel What the agent’s tools will do on this step.
The heading reads Tool Mocks (0) while the step has no set of its own, as here:

Which set answers first
When several sets mock the same tool, Qlar answers one call in this order:
- Every set's cases, one after the other. First the step's own sets, from the top of the list to the bottom, then the scenario's sets, from the top to the bottom. The first case that matches answers. The order is what counts, not how specific a case is, so the most specific cases belong near the top.
- Then the Otherwise of the first set that answers. If no case matched, the first set, in the same order, whose Otherwise is Use only when no other set answers gives its response. A set that is set to Don’t answer; pass to the next set is skipped. A set set to Use ahead of sets listed below never gets here, because its Otherwise already answered in the first round, like a case that matches every call.
- Then the policy. If every set passes the call on, the scenario's Allow Live setting, the Tool Policy and the built-in default decide, as in Tools in Simulations.
This means one set's Otherwise never hides another set's cases. A small step set can add a few special cases on top of a bigger scenario set, and everything else still reaches the scenario's cases. When a step must replace the tool completely, give its set the option Use ahead of sets listed below: its Otherwise then answers every call before anything below it. If a set's Otherwise could never be reached, the What the agent’s tools will do panel says so, for example that “Book unavailable” has an Otherwise for get_book, but it’s never used, and suggests the fix.
When two sets in the same list mock the same tool, a number and a drag handle appear on each row, and a notice, for example "2 sets mock get_book.", says which set is higher in the list. Drag a row to reorder.
The panel What the agent’s tools will do shows the order for each tool under Checked in this order: every case of every attached set, numbered, with the sets in their order and, last, whether a set's Otherwise or the tool's policy answers the rest. A set that can never answer a tool is crossed out.

Step 8: Create a mock from a result
The easiest mock to write is the one for a call you just saw. After a run, open its result and find the call under Tool calls (n). Read the Results shows where.
- For a call that was Blocked, click Mock This Call. For a call that was Mocked or Live, click Save as Case.
In this picture a Mocked call has Save as Case (marked). The line under its arguments starts with the status code, then names the case that answered (the first part of its id, then its label), the mock set, and whether that is a Step-level mock set or a Scenario-level mock set.

- A menu asks where the mock should go.
- New Private Set for This Step: "Only used when this exact step runs."
- New Private Set for This Scenario: "Used by every step in this scenario."
- Existing Set…: "Pick a set once the scenario opens." The panel Add this case to a mock set then lists the sets attached to the step and to the scenario. Pick one, and the case is added to it, above that tool's last always-answering case if it has one.
The menu looks like this:

- The scenario opens with the mock editor already filled in. The conditions are copied from the details the agent sent, as "is" tests. For a Blocked call the response is empty and you write it. For a Mocked or Live call the response is copied from what came back.
- Check the response, click Apply, and save the scenario.
Two warnings can appear:
- A Live response may contain real data, so Qlar asks "This call ran live and may contain real data. Saving it as a case stores that response as the mock. Continue?" before it copies it.
- If the response was too large to copy, Qlar says so and you fill it in yourself.
A Blocked call has Mock This Call in the same place, marked here. The line under its arguments says why it was blocked: Tool policy when a rule decided, or Built-in default when no rule covers the tool.

Step 9: See where a library set is used, and delete it
- In Simulation → Tool Mocks, a mock set card shows how many scenarios use it, for example "Used in 3 scenarios". In List View, the columns are Name, Tools · cases, Used in and Updated.
- Open a set and click Used in n scenarios to see the scenarios, and the steps, that use it.
A dialog titled Used in says "Attached in 1 place:" and lists each scenario, with "Scenario level" or "Step n". Click Close when you are done.

- To remove a set, open its ⋮ menu and choose Delete, then confirm.
If a set is still attached to scenarios, Qlar does not delete it quietly. The dialog This mock set is in use lists where, each as a scenario with "Step n" or "Scenario level". Its confirm button, Remove from n scenarios and delete, detaches the set everywhere and then deletes it. Those scenarios will then fall back to the next rule for that tool, and might show Blocked. The menu also has Duplicate, which creates a copy of a set.
Editing a library set from inside a scenario changes it for everyone. The panel says "Library set, used in n scenarios. Saving changes all of them." with a link Make a Private Copy Instead when you came from Save as Case.
Check the result
Run the scenario and open its result. See Run Simulations if you need the steps.
You made it if:
- The call to the tool shows Mocked, and its line ends with Step-level mock set or Scenario-level mock set.
- The explanation under it names your case and set, for example "Case e74f130e… 'Known book' · Book lookup: happy path". The code is the start of the case's id.
- The agent's answer uses the information in your response.
Expand the call to see Checked before the answer: the cases that were looked at and did not match, each with the reason, for example which condition failed. Runs recorded before the current rule was introduced show the note "Answered under the previous mock rule: a set's Otherwise ended the search."

If you see something else:
- The call says "No case matched, used Otherwise". No case in any attached set matched, so the Otherwise of the first set that answers replied. Check the conditions.
- The call still shows Blocked. The set is not attached to this scenario, you did not save the scenario, or the call matched no case while every set was set to Don’t answer; pass to the next set. Open Agent Tools and Review Tools to see what the tool will do.
- A different case answered. An earlier case, in this set or in a set above it, matched first. Cases of every attached set are checked before any Otherwise, so a case in a set lower down can also win over a higher set's Otherwise. Reorder, or make the earlier one more specific.
- A banner says what is shown may differ from runs. The CMS and the simulation service use different mock-matching versions at the moment, so Try a Call and the panels may not match a real run exactly. Ask your administrator to bring them to the same version.
- Add Tool shows no tools. The picker says "This agent has no tools in its catalog." when the agent has none, or "Failed to load the tool catalog. Close and reopen Add Tool to retry." when loading failed. It lists the tools of the draft and the published agent together.
Good practice
- Name sets by the situation they create, such as "Book unavailable", not by the tool.
- Write the most specific case first and the general case last.
- Keep each case to one idea. Several small cases are easier to fix than one long one.
- Cover failures too. An error case shows whether your agent says something sensible when a tool is down.
- Use real response shapes. Copy one from Use a Real Response on a safe tool, so your mock looks like the real thing.
- Use a library set for answers that many scenarios share, and a private set for one-off cases.
- Use Try a Call to check a case before you save the set.
- Mocks only change simulations. They do not change your live agent, so there is nothing to publish.
Next steps
- Previous in this section: Tools in Simulations.
- Next in this section: Tool Policy sets what each tool does when no mock answers.
- As part of building Atlas: Test Tools Safely with Mocks.
- Field-by-field reference: Tool Mocks and Scenarios.