Skip to content

MCP tools ​

Workstate has two MCP servers. rag-corpus searches the index. rag-ledger reads and writes the ledger. This page lists every tool on each, with its parameters and what it returns.

How every tool behaves ​

  • The namespace comes from the connection, not from the tool. No tool takes a namespace argument. Each call uses the namespace in the X-RAG-Namespace header, or your oldest namespace when there is none. The header is checked against your key.
  • The author is the key's owner. Every ledger write is recorded as the person whose API key made the call. The agent's name comes from the tool's agent argument, or else from the X-RAG-Agent header.
  • Results are JSON. Each tool returns its result as text that holds JSON.
  • Errors say what to fix. For example, forbidden: no grant for namespace "ws-…" means your key cannot reach that namespace, and forbidden: principal has no workspace grants means you have not been given any namespace yet. A missing or revoked key fails before any tool runs, with HTTP 401.

rag-corpus ​

Address: https://mcp-uat.workstate.io/corpus

search_corpus ​

Searches the namespace's index: code, documents and the ledger. It returns the best-matching passages, reranked, each with where it came from.

ParameterTypeRequiredMeaning
querystringYesWhat to find, in plain words: a concept, a name, a behaviour. Must not be empty.
top_kintegerNoHow many results to return. The default is 8. Search ranks the best 50 candidates, so it never returns more than 50.
rerankbooleanNoWhether to rerank the candidates for quality. The default is true. Set it to false only for debugging.
corpusstringNoSearch only code, wiki or ledger.
repostring, or array of stringsNoSearch one repository by its exact name, or several, such as ["api", "web"].
languagestringNoSearch one language, such as rust, python or markdown.
path_prefixstringNoOnly files whose path starts with this, such as docs/. It is applied after the candidates are chosen, so a narrow prefix can return fewer results than top_k.

Returns the query, the top_k used, whether the results were reranked, and results. Each result has:

FieldMeaning
repoThe repository the passage came from.
rel_pathThe file's path in the repository.
start_line, end_lineThe lines the passage covers.
textThe passage.
corpus, languageThe corpus and the detected language.
ann_score, rerank_scoreHow close the passage was in the first pass, and its relevance after reranking.
topic_id, type, statusLedger results only: the topic, its type and its status.

Cite a result as repo/rel_path:start_line-end_line. Ignore the path field, which is Workstate's internal location for the file. Other fields, such as timings, may also appear.

reindex_corpus ​

Queues a sync of every GitHub, Confluence and Jira source in the namespace, for changes you want searchable now. It returns once the syncs are queued. Syncs usually finish within a few minutes, and unchanged files are skipped.

Anyone with access to the namespace can call it.

ParameterTypeRequiredMeaning
None

It leaves these sources alone, and says why:

ReasonMeaning
uploadAn upload source changes only when someone uploads files, and each upload syncs it.
pausedSomeone paused the source.
cancellingSomeone is stopping the source's sync, which leaves it paused.
deletingThe source is being deleted.

Returns the namespace, how many syncs were queued, and sources: each source's source_id, label and kind, with an outcome of queued or skipped. A queued source has a job_id, and created is false when a sync was already on its way. Another sync then follows it, so no change is missed. A skipped source has a reason.

rag-ledger ​

Address: https://mcp-uat.workstate.io/ledger

Searches the ledger by meaning, to find earlier decisions, incidents, defects and investigations. A topic appears at most once in the results.

ParameterTypeRequiredMeaning
querystringYes, unless archived is trueWhat to look for, such as "have we decided this before?".
top_kintegerNoHow many results. The default is 8.
repostring, or array of stringsNoOnly topics filed under this project, or these projects.
typestringNodecision, incident, defect or investigation.
statusstringNoopen, proposed, accepted, resolved, superseded, reverted or wontfix.
archivedbooleanNoSet to true to search archived topics instead. That search matches the words you give, not their meaning, and returns up to 50 topics by default. Archived topics never appear in a normal search.

Returns matching topics, best first. Each has its topic_id, type and status, the passage that matched, and, where available, its title, summary and when it was last updated (updated_at). Read a topic in full with ledger_get.

ledger_get ​

Fetches one topic with its complete record. It works for archived topics too.

ParameterTypeRequiredMeaning
topic_idstringYesThe topic's id, such as payments-0012.

Returns the topic: its topic_id, type, repo, title, fixed summary, current_state and status; who created it and when (creator_email, creator_agent, created_at) and when it was last updated (updated_at); its tags; whether it is archived; its full history as events; and links to the topics it supersedes or is superseded by. Each event has its time (ts), its author (author_email, author_agent), its kind and body, and any new state or status it set.

If the topic was moved to another project, it returns a pointer instead, {"moved": true, "moved_to": "<new id>", …}. Fetch the new id.

If there is no such topic in the namespace, it returns ledger topic … not found.

ledger_create ​

Opens a new topic for one decision, incident, defect or investigation. Create one topic per decision or finding, even when you make several in one task.

ParameterTypeRequiredMeaning
typestringYesdecision, incident, defect or investigation.
titlestringYesA one-line title.
summarystringYesThe original framing of the decision, bug or incident. It never changes.
initial_statestringYesWhere the topic stands now, in brief. It becomes the first entry in the history.
repostringYes, on WorkstateThe project to file the topic under, such as a repository's name. It can use letters, digits, dots, hyphens and underscores, and it becomes the start of the topic's id.
statusstringNoThe starting status. The default is proposed for a decision, and open for the other types.
tagsarray of stringsNoTags for the topic.
agentstringNoThe agent's name, such as "Claude Code". Without it, the X-RAG-Agent header is used.

Returns the new topic, including its topic_id, such as payments-0012: the project name, then a number that counts up within that project. ledger_get finds a new topic at once. Search finds it shortly after it is written.

If repo is missing, it returns repo not given and could not be inferred from a git repo.

ledger_append ​

Adds an entry to a topic's history, to move that same topic on: a change of state or status, a correction, or the outcome. A new, separate decision or finding belongs in a new topic, made with ledger_create.

ParameterTypeRequiredMeaning
topic_idstringYesThe topic to add to.
bodystringYesWhat happened, what was learned, or what changed.
kindstringNoThe kind of entry: note (the default), state_change, status_change or correction.
set_statestringNoThe topic's new current state. Keep it a short status, not a growing report.
set_statusstringNoThe topic's new status, such as accepted, resolved or reverted.
supersedesstringNoThe id of an older topic that this topic replaces. It links the two both ways, and marks the older topic superseded. The older topic must be in the same namespace.
agentstringNoThe agent's name. Without it, the X-RAG-Agent header is used.

Returns the new history entry: its event_id, time (ts), author, kind, body, and any new state or status.

History is append-only. No tool edits or deletes an entry. If the topic was moved, it returns topic … was moved to …; append to that id instead.

ledger_move ​

Refiles a topic under another project. The topic gets a new id in that project, with a new number. Its whole history and its links move with it, and an entry in the history records the move.

ParameterTypeRequiredMeaning
topic_idstringYesThe topic to move.
repostringYesThe project to move it to.
agentstringNoThe agent's name. Without it, the X-RAG-Agent header is used.

Returns the topic under its new id. The old id no longer names a topic: ledger_get on it returns a pointer to the new id.

ledger_archive ​

Archives a topic, or restores an archived one. Archiving is a soft delete, for noise or obsolete topics. An archived topic keeps its history, but it disappears from ledger_search and from search_corpus. ledger_get still fetches it, and ledger_search with archived: true finds it.

ParameterTypeRequiredMeaning
topic_idstringYesThe topic to archive or restore.
archivedbooleanNotrue, the default, archives the topic. false restores it.
agentstringNoThe agent's name. Without it, the X-RAG-Agent header is used.

Returns the topic, with its archived state.

Workstate is built by Nerdstorm Pty Ltd, Sydney.