komrad

write_document

Write a markdown document for the person, as a type from list_document_types and following its context.

writesnot idempotentMCP toolAgent

Pass id and the version last read to rewrite one of the caller's documents. The write fails with failed_precondition when someone wrote the document since.

Calling it#

curl -X POST http://127.0.0.1:8787/komrad.agent.v1.AgentService/WriteDocument \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "<name>",
  "type": "<type>",
  "body": "<body>"
}'

Request#

WriteDocumentRequest#

FieldTypeDescription
iduuid

The document to rewrite, by id. Unset creates a document.

namestring*

at most 200 characters

must not contain control characters

The document's title.

typestring*

at most 100 characters

The name of the document's type, one list_document_types returns.

one of*

The source of the document's text.

bodystring

not empty

at most 1048576 bytes

The document's text, in markdown.

pathstring

not empty

A markdown file on the machine komrad runs on. A relative path starts at the writing agent's checkout.

versionint32

more than 0

The document's version when last read. Required on a rewrite.

agent_iduuid

The agent to write the document for, by id. An agent may name only itself.

Response#

WriteDocumentResponse#

FieldTypeDescription
documentDocument

The document as written, without its text.

Types#

Document#

Document is markdown an agent writes for the person to read.

FieldTypeDescription
iduuid*

The document's id.

agent_iduuid*

The id of the agent that owns the document.

namestring

The document's title. No two of one agent's documents share one.

typestring

The name of the document's type.

bodystring

The document's text, in markdown. Empty in a listing.

created_attimestamp

When the document was created.

updated_attimestamp

When the document was last written.

versionint32

How many times the document has been written.

task_iduuid

The id of the task the agent was on when the document was created. Unset for an orchestrator's documents.