# Working with Entries

Entry operations are available in all three modes. The AI uses the `execute_activity` and `diagnose_entry` guided prompts to walk through the correct tool sequence automatically.

## List and Filter Entries

Ask the AI to query entries in plain language. You can filter by state, field values, or free text.

{% tabs %}
{% tab title="Example prompts" %}

> "Show me all open purchase orders."

> "List invoices created this week sorted by amount."

> "Find all entries assigned to me in the Leave Request module."
> {% endtab %}

{% tab title="What the AI does" %}

1. Calls `list_modules` to confirm the module name
2. Calls `list_entries` with your filters, sort, and pagination settings
3. Returns a summarized list with key fields

Filters support equality, ranges, contains, date comparisons, and more. The AI translates your natural language into the correct filter syntax.
{% endtab %}
{% endtabs %}

## View a Single Entry

{% tabs %}
{% tab title="Example prompts" %}

> "Show me entry INV-1042."

> "What's the current state of leave request LR-0088?"
> {% endtab %}

{% tab title="What the AI does" %}

1. Calls `get_entry` with the module name and entry ID
2. Returns current field values, state, and available next activities
   {% endtab %}
   {% endtabs %}

## Create an Entry

{% tabs %}
{% tab title="Example prompts" %}

> "Create a new purchase order for supplier Acme Corp, amount RM 5,000."

> "Raise a leave request for John Tan from 10 June to 14 June."
> {% endtab %}

{% tab title="What the AI does" %}

1. Calls `get_form` for the `create` activity to discover required fields and their types
2. Maps your details to the form fields
3. Calls `submit_activity` with the prepared input and an AI traceability record
4. Confirms the new entry ID
   {% endtab %}
   {% endtabs %}

{% hint style="warning" %}
The AI will always call `get_form` before submitting. If required fields cannot be confidently filled from your prompt, it will ask you for the missing information rather than guessing.
{% endhint %}

## Edit an Entry

{% tabs %}
{% tab title="Example prompts" %}

> "Update the amount on PO-0234 to RM 7,500."

> "Change the supplier on invoice INV-1042 to Beta Supplies."
> {% endtab %}

{% tab title="What the AI does" %}

1. Calls `get_form` for the `edit` activity on the specific entry
2. Applies your changes on top of the current values
3. Calls `submit_activity` to save
   {% endtab %}
   {% endtabs %}

## Delete an Entry

{% tabs %}
{% tab title="Example prompts" %}

> "Delete leave request LR-0099."
> {% endtab %}

{% tab title="What the AI does" %}
Calls `submit_activity` with activity `delete` and the entry ID. This is a permanent action.
{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Deletion cannot be undone. The AI will confirm with you before proceeding.
{% endhint %}

## Run a Custom Activity

Workflow modules have custom activities such as "Approve", "Reject", "Escalate", or "Submit for Review". Ask the AI to run any of them.

{% tabs %}
{% tab title="Example prompts" %}

> "Approve leave request LR-0055."

> "Escalate PO-0234 to the finance manager."
> {% endtab %}

{% tab title="What the AI does" %}

1. Calls `get_form` for the named activity to discover its fields and confidence threshold
2. Prepares input and assesses its confidence
3. Calls `submit_activity`. If confidence is below the activity's threshold, the entry is flagged for human review instead of transitioning state
   {% endtab %}
   {% endtabs %}

## Bulk Operations

To create or update many entries at once, ask the AI to do them in a single batch rather than one by one.

{% tabs %}
{% tab title="Example prompts" %}

> "Create these 10 purchase orders all at once." *(with a list or table)*

> "Mark all these leave requests as approved."
> {% endtab %}

{% tab title="What the AI does" %}
Calls `submit_activities` with all items in a single request instead of making a separate `submit_activity` call for each. Returns per-item results so you can see which succeeded and which failed.

Max 100 items per batch. For larger sets the AI will chunk automatically.
{% endtab %}
{% endtabs %}

## View Entry History

Every entry has a full audit trail of who did what and when, including field-level change details and the AI reasoning behind automated actions.

{% tabs %}
{% tab title="Example prompts" %}

> "Show me the history of invoice INV-1042."

> "Who approved leave request LR-0055 and when?"

> "Why was PO-0234 escalated?"
> {% endtab %}

{% tab title="What the AI does" %}

1. Calls `get_entry` for current state
2. Calls `get_entry_history` for the full chronological audit trail
3. Summarizes the timeline, including AI confidence scores and reasoning for automated steps
   {% endtab %}
   {% endtabs %}

## AI Traceability

Every write operation (create, edit, delete, custom activity) is automatically logged with:

* **Reasoning** — why the AI chose this action
* **Model** — which AI model performed the action
* **Confidence** — the AI's self-assessed confidence (0–1)
* **Sources** — any documents or context the AI referenced

This appears in the entry history and is visible to all workspace users.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://inistate.gitbook.io/home/mcp-integration/working-with-entries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
