# Server instructions (/mcp/instructions)

Heuristic turns a product's customer feedback into what customers ask for, per feature of the product. You act as the person who connected you, with exactly their access.

How it is organised
- An organization holds people (Admins manage everything; Users get Owner or Viewer access per product) and products.
- A product has a knowledge base: its public documentation site. A knowledge base read crawls it and turns each documentation page into at most one feature. Reads run in the background (see Long-running work).
- The product hierarchy is the product's tree of categories and features. A category holds either subcategories or features, never both. Features not placed yet sit outside any category. Product Owners change it only with `apply_hierarchy_changes`: a single edit is a list of one step, a restructure many steps. Preview them first (`dryRun`, which also says how many insights each delete or merge would move), then save them as one hierarchy change.
- Feedback arrives as source records (a message, a call note, a ticket), sent with `send_feedback`: with a feedback endpoint's key, or as the person (product Owners only). Each source record is split into insights: one short statement with its verbatim quote, a type (feature request, bug or problem, praise, complaint, question) and a sentiment. Each insight is linked to the feature it is about, or to New opportunity when it matches none. Insights are grouped into topics under their feature or New opportunity. Product Owners correct insights and topics (an insight's type, sentiment or place; renaming or merging topics) only with `apply_feedback_changes`: a single correction is a list of one step, sorting many insights many steps. Preview them first (`dryRun`), then save them as one feedback change. Feedback reads answer `meta.feedbackVersion`; send it as `expectedVersion` with a feedback change so it is refused if someone changed the feedback since.
- Every saved hierarchy change and feedback change is in the product's change history: `list_changes` lists it, `get_change` reads it in full and one `undo_change` reverses it, each told the `area` (`hierarchy` or `feedback`). Undoing a hierarchy undo redoes the change; a feedback undo can't be undone.
- API keys: the person creates personal API keys in the web app for their own scripts; each acts as them in one organization, Full access or Read only. You can list and revoke them, never create one or see a key; you keep connecting by signing in. Admins also list and revoke members' keys and the organization's own keys, and can stop members' keys without expiry.

Where to start
- Many tools take an `action` that picks what they do; each tool's description lists its actions and the fields each needs. Tools that only read are separate from tools that change things.
- `get_me` says who you act for and lists their organizations, roles and the products they can open, in one call. `read_organization` and `read_product` read organizations, people and products; `manage_organization`, `manage_product` and `update_me` with action `update` change them.
- To find a category, feature or topic the person names, use `search`. To see how a product is organised, read `get_hierarchy` with `view: compact`; `categoryId` reads one branch.
- To see what customers ask for and the revenue behind it, read the feedback counts with `get_feedback_counts`: customers (each counted once per row and once per topic, so topics add up to more) and ARR per feature, category and New opportunity, and each row's `topics`, and `product`, the whole product's total with each customer counted once (summing the categories counts a customer once per category), filtered by customer status (`customer` or `prospect`) and period. ARR comes from a CRM connection's ARR field (by default the sum of the CRM's standard ARR on each company's won deals; `read_crm` with action `arr_fields`, `manage_crm` with action `set_arr_field`) or from `arr` or `mrr` sent with `send_feedback` (MRR counts as 12 times it). When `noArr` is true no counted customer has ARR yet: say so and where ARR comes from, rather than reporting zero revenue. Rank features with `sort` (`customers`, `arr` or `change`): `sort: arr, limit: 10` is the top 10 by revenue, `sort: change` the fastest growing first. Drill down with `list_topics` (`scope` `feature` with `featureId`, `category` with `categoryId`, `unplaced` or `new_opportunity`; narrow it by `type`, `sentiment` and `source`, or list one `view`: `growing`, `new` or `shrinking`; `from` and `to`, inclusive UTC days in place of `period`, read chosen days, such as a `series` entry's) and `list_topic_insights` (the same filters); see who is behind a number (each customer once, with its ARR and topics; find one by name with `query`, then what one said with `list_topic_insights` and its `customerKind` and `customerId`) with `list_customers`, scoped the same way; see how feedback is coming in with `get_feedback_counts` with `view: overview`; read the feedback itself with `list_source_records` and `get_source_record`.
- Trends and changes follow the product's reporting unit, `unit` (week, month or quarter; `read_product` `get` answers it as `reporting` with Auto's reason, Owners set `reportBy` with `manage_product` `update`). Counts reads answer `periods` (each trend unit's first day, the unfinished one last) and `window`: `latest`, the last complete 4 weeks, 3 months or 2 quarters, and `before`. `trend` counts customers per unit, once a unit; `change` counts each window's customers, once a window, and ignores `period`. When both are under 5, people see the two numbers, not a percent: report them so. Each counts total's `changeState` names its change: `growing` or `shrinking` (10% or more), `new` (none in the window before) or `flat`. Filter the counts as people do with `change`, `minCustomers` and `minArr`, read for `type` and the status and period: only matching features are listed, categories while they hold one (full totals); `product`, `unplaced` and `newOpportunity` keep theirs, `newOpportunityMatches` says if New opportunity matches. In tree order a filtered next page is refused as stale when a row's match changed: read again from the first page.
- How to use Heuristic itself: Heuristic documentation, https://docs-staging.heuristic.app/; its MCP section (/mcp/) has a page per tool, and /llms.txt lists every page as Markdown.

Rules across tools
- Ids are uuids, accepted in any case; anything else answers `validation_error`. Take them from earlier results; never guess them.
- Lists and large reads return one page at a time: pass `meta.nextCursor` back as `cursor` until it is null, to the same tool and action that answered it. Each tool's `limit` says its default and maximum; the default page fits your answer.
- A source record too long for one answer comes in parts: `part` null is the whole record; else it gives the characters of the text (`textFrom` to `textTo` of `textLength`) and the insights (`insightsFrom` to `insightsTo` of `insightsTotal`) this answer holds, insights once the text is done. Read on with `get_source_record` and `part.next`'s `textFrom` and `insightsFrom` until it is null, also for a cut record from another tool; `textFrom` at `textLength` reads only insights. If `meta.feedbackVersion` changes between parts, start again.
- Writes need the right role: Admins for organizations, members and products; product Owners for a product's hierarchy, feedback corrections and feedback endpoints. Viewers only read.
- `get_hierarchy` answers the tree's `version`. Send it as `expectedVersion` with hierarchy changes so that a change planned from an older read is refused instead of landing on someone else's.
- Every hierarchy and feedback change names the person who made it (`createdBy`, null once they left the organization) and where it was made (`via`): in Heuristic's web app, through an app or agent (`app`: its `clientId` and name), or `not_recorded` for older changes whose app is not known. Tell the person who did what as "\<person> via \<app name>" ("a former member via \<app name>" when `createdBy` is null), the person alone for the web app, and the person with "app not recorded" for `not_recorded`. `get_me` names the app you are; filter `list_changes` with `app` (a `clientId`, `any` or `web`) to find one app's changes.
- Creates that take an `id` you choose are safe to retry with the same id: a repeat answers what the first call made.
- A refused call answers an error result with `status` and `error`: a `code`, a plain `message`, and `details`. A `validation_error` lists every invalid field at once; a refused rule (`conflict` and similar codes) names the rule in `details.rule` and, where it helps, the allowed choices in `details.allowed` or when to try again in `details.retryAfter` (seconds).
- Actions marked destructive cannot be undone, or delete or merge data. For those that cannot be undone Heuristic asks the person itself: your app shows them the question when it can; otherwise the call answers `confirmation_required` with the question: ask the person exactly that and, only after they say yes, call again with the same arguments and `confirm: true`. For deletes and merges that can be undone, ask the person before you call them.
- Calls are limited per person across all apps: 120 a minute and 10,000 a UTC day, and calls that start AI runs or knowledge base reads (creating an organization, starting a knowledge base read, rebuilding categories, retrying topics or rechecking) 10 a minute and 200 a UTC day. Over a limit, a call answers `rate_limited` and changes nothing; wait `details.retryAfter` seconds and repeat it.
- When Heuristic can't reach its data, every call answers `database_unavailable` at once (the connection itself may fail with it). Nothing is wrong with your call: wait `details.retryAfter` seconds and call again. A change you sent just before may or may not have been saved, so read first to check whether it already happened before sending it again.

Long-running work
- Reading the knowledge base (`manage_knowledge_base` with action `start_read`, also started by `manage_organization` with action `create`) takes minutes: check `read_knowledge_base` with action `read` every 30 seconds until its status is completed, failed (it needs attention) or stopped.
- Rebuilding the categories (`rebuild_hierarchy`) takes about a minute: check `get_hierarchy` every 30 seconds until its `build` status is completed or failed.
- New feedback is processed in the background: a source record is received, then processed or needs_attention.
