put_collection
[Collections]
Create or replace collection metadata conditionally. Optional schemas can guide or strictly validate document data. Retain requestId after an ambiguous response.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| definition | json | Yes | Collection metadata: title (required) and an optional description. An optional schema adds schemaVersion (a positive integer), validationMode (descriptive guides; strict rejects documents whose declared fields do not match), and up to 32 fieldDefinitions. Each field has path (a /data pointer), type (string, number, integer, boolean, date, or instant), required, and nullable, with an optional description, unit, and up to three examples. |
| ifRevision | string | Yes | Use "absent" to create, or the current revision to replace. A stale revision returns revision_conflict. |
| key | string | Yes | Stable collection key, unique in its workspace. |
| requestId | string | Yes | A fresh UUID for each change. After an ambiguous response, retry with the same requestId and identical arguments; a changed payload returns request_conflict. |
| spaceId | string | Yes | Workspace ID from list_spaces. |
Examples
Replace the sample IDs with values from your store. Use a fresh UUID for each requestId.
Create a strict collection for tasks with a numeric estimate.
Arguments
{
"spaceId": "11111111-1111-4111-8111-111111111111",
"key": "tasks",
"definition": {
"title": "Tasks",
"schemaVersion": 1,
"validationMode": "strict",
"fieldDefinitions": [
{
"path": "/data/status",
"type": "string",
"required": true,
"nullable": false
},
{
"path": "/data/estimateHours",
"type": "number",
"required": false,
"nullable": true,
"unit": "hours"
}
]
},
"ifRevision": "absent",
"requestId": "99999999-9999-4999-8999-999999999999"
}Full MCP request
Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "put_collection",
"arguments": {
"spaceId": "11111111-1111-4111-8111-111111111111",
"key": "tasks",
"definition": {
"title": "Tasks",
"schemaVersion": 1,
"validationMode": "strict",
"fieldDefinitions": [
{
"path": "/data/status",
"type": "string",
"required": true,
"nullable": false
},
{
"path": "/data/estimateHours",
"type": "number",
"required": false,
"nullable": true,
"unit": "hours"
}
]
},
"ifRevision": "absent",
"requestId": "99999999-9999-4999-8999-999999999999"
}
}
}Create a schema-free collection for decisions.
Arguments
{
"spaceId": "11111111-1111-4111-8111-111111111111",
"key": "decisions",
"definition": {
"title": "Decisions",
"description": "Agreed project decisions"
},
"ifRevision": "absent",
"requestId": "22222222-2222-4222-8222-222222222222"
}Full MCP request
Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "put_collection",
"arguments": {
"spaceId": "11111111-1111-4111-8111-111111111111",
"key": "decisions",
"definition": {
"title": "Decisions",
"description": "Agreed project decisions"
},
"ifRevision": "absent",
"requestId": "22222222-2222-4222-8222-222222222222"
}
}
}