save_json_doc
Saves a JSON document to the mcp-database-server, a fireproof ledger database supporting multi-user synchronization. Ensures secure storage and accessibility for structured data.
Instructions
Save a JSON document
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | JSON document to save |
Input Schema (JSON Schema)
{
"properties": {
"doc": {
"description": "JSON document to save",
"type": "object"
}
},
"required": [
"doc"
],
"type": "object"
}
Implementation Reference
- src/index.ts:101-118 (handler)The handler for the 'save_json_doc' tool. It extracts the 'doc' from arguments, validates it, saves it to the Fireproof database with a 'created' timestamp, and returns a message with the saved document's ID.case "save_json_doc": { const doc = request.params.arguments?.doc; if (!doc) { throw new Error("Document is required"); } const response = await db.put({ ...doc, created: Date.now() }); return { content: [{ type: "text", text: `Saved document with ID: ${response.id}` }] }; }
- src/index.ts:39-52 (registration)The tool registration in the ListTools response, defining name, description, and input schema for 'save_json_doc'.{ name: "save_json_doc", description: "Save a JSON document", inputSchema: { type: "object", properties: { doc: { type: "object", description: "JSON document to save" } }, required: ["doc"] } },
- src/index.ts:42-51 (schema)Input schema for the 'save_json_doc' tool, requiring a 'doc' object.inputSchema: { type: "object", properties: { doc: { type: "object", description: "JSON document to save" } }, required: ["doc"] }