Research run tools (surveyPublicContext, checkSurvey)
Tool names: surveyPublicContext, checkSurvey
Scopes: knowledge:read, knowledge:write, skills:run-contained
When to use
Use these two tools to draft the Public Context documents of a business brain from public sources: the legal entity, the offer, the market position and the public footprint. surveyPublicContext starts the run. checkSurvey reports it.
The tools are in the tool list only when all of these are true:
- The instance has research runs turned on. They are off by default, and the instance's operator turns them on.
- The instance has document writing turned on, because the run saves its documents through the same path as
writeDoc. - The person who connected is a member. An admin or staff connection never gets these tools. The tools are absent, not refused.
- The connection holds
knowledge:read,knowledge:writeandskills:run-contained. The last scope is never in a default grant: it must be asked for by name when the token is made, and an administrator must allow it for the person. A connection made without it does not gain it: the person must reconnect, or mint a new token.
What a run does:
- It works in a closed folder of its own, with read-only copies of the brain's documents, the web, and no other tool. It cannot read another person's documents.
- It writes only documents that do not exist yet. It never replaces a document. For a document that already exists, it writes a suggestion into
_public-context-suggestions.mdin the brain folder, and leaves the document unchanged. - It writes a receipt,
_setup-public-context-run.md, in the brain folder. - It takes 5 to 25 minutes.
The owner must confirm who the business is before you start a run: identity is used as given.
surveyPublicContext takes:
brain: a brain id fromlistBrains,<project>/<folder>. The folder can be new, with nobrain.mdyet: the run then createsbrain.md.runId: your own id for this run, 8 to 64 characters of letters, digits,.,_or-. A UUID is good. A second call with the samerunIdreturns that run while it runs or after it succeeded. After a run that failed, timed out or endedpartial, the samerunIdstarts the next attempt, which skips the documents the earlier attempt created.identity:legalNameandwebsiteare required;tradingName,companyNumber,registry,country,leaders(a list of{ "name", "role" }) andownerNotes(up to 1,000 characters) are optional. An unknown field is refused.
It returns runId, executionId, attempt, status (running for a new run), target, and two lists of document ids: willCreate (documents that do not exist yet) and willSuggest (documents that exist, so the run can only suggest). A repeated call also returns reused: true.
checkSurvey takes runId. It returns status (running, completed, partial, failed or timeout), attempt, summary, error, the times, and, when the run has finished, receipt with created, suggested, refused (each with a path and a reason), warnings and token usage. Wait two minutes between polls.
Example
A member starts a run on their business brain:
{
"brain": "member-14/brains/business",
"runId": "9b2f4c1e-7d3a-4e8b-a0c5-3f6e1d2b4a87",
"identity": {
"legalName": "Northwind Advisory Ltd",
"website": "https://example.com",
"companyNumber": "01234567",
"registry": "Companies House",
"country": "United Kingdom"
}
}
{
"runId": "9b2f4c1e-7d3a-4e8b-a0c5-3f6e1d2b4a87",
"executionId": "3f2b9c1e-7a4d-4c3b-9a1e-0123456789ab",
"attempt": 1,
"status": "running",
"target": { "brain": "member-14/brains/business" },
"willCreate": ["brain", "legal-entity-and-ownership", "market-position-and-competitors", "public-footprint", "knowledge-synthesis", "citations"],
"willSuggest": ["offer-surface"]
}
Later, checkSurvey with the same runId (shortened):
{
"runId": "9b2f4c1e-7d3a-4e8b-a0c5-3f6e1d2b4a87",
"attempt": 1,
"status": "completed",
"summary": "setup-public-context v1: drafted 6 documents, suggested changes to 1, 2 inconsistencies",
"error": null,
"receipt": {
"created": ["brain", "legal-entity-and-ownership", "market-position-and-competitors", "public-footprint", "knowledge-synthesis", "citations"],
"suggested": ["offer-surface"],
"refused": [],
"warnings": []
}
}
Refusals and what to do
A refusal is an error result with the text Error in <tool>: <reason>.
Not found: the brain is not one this person can write, or it does not exist, or (forcheckSurvey) the run is not one of this person's runs. All of these give the same answer. Use a brain fromlistBrainsin the person's own home.rate_limited:member_run_in_progress (recoverable: …) {"retryAfterSeconds":120,"runId":"…"}: another run of this person is still running. PollcheckSurveywith therunIdnamed, and start the next run when it has finished.rate_limited:member_daily_cap,rate_limited:member_token_budget,rate_limited:instance_busyorrate_limited:instance_daily_cap, each followed by(recoverable: …)and{"retryAfterSeconds":N}: a limit is reached. Start the run again after that many seconds, with the samerunIdand the sameidentity.invalid_input:arguments_invalid (<fields>): the arguments do not match the schema, for example arunIdwith a:or an unknown field inidentity.- A finished run whose
receipt.refusedliststarget_existsis not a fault: that document already existed, so its text is in_public-context-suggestions.md. Read it withreadDoc, and change the document only when the person agrees. statusfailedwitherrorinterruptedmeans the server restarted during the run;authority_lostmeans the person's access changed during the run, so nothing was written. Start again with the samerunIdwhen that is right.- If these tools are not in your tool list, a call returns
MCP error -32602: Tool surveyPublicContext not found. One of the conditions above is not true. Read thesurveysandpermissionssections ofgetDocs. Do not tell the person that Sasha cannot do research.
Related
listBrainsandgetBraingive the brain id and the state of each document.readDocreads the documents, the suggestions file and the receipt.writeDocis the path the run saves through, under the same permissions.getDocshas thesurveysandpermissionssections.