Skip to main content
Glama
jimpick

MCP JSON Document Collection Server

by jimpick

save_json_doc_to_db

Store JSON documents in a document database for persistent storage, enabling data management and retrieval within the MCP JSON Document Collection Server.

Instructions

Save a JSON document to a document database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docYesJSON document to save
databaseNameYesdocument database to save to

Implementation Reference

  • Handler for the 'save_json_doc_to_db' tool: validates args with schema, ensures DB exists, saves the JSON doc to Fireproof DB with timestamp, returns saved ID.
    case "save_json_doc_to_db": {
      const parsed = SaveJsonDocToDbArgsSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments for save_json_doc_to_db: ${parsed.error}`);
      }
      const doc = request.params.arguments?.doc;
      if (!doc) {
        throw new Error("Document is required");
      }
    
      const dbName = parsed.data.databaseName;
      if (!dbs[dbName]) {
        const newDb = fireproof(dbName);
        dbs[dbName] = { db: newDb };
      }
      const db = dbs[dbName].db;
      const response = await db.put({
        ...doc,
        created: Date.now(),
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Saved document with ID: ${response.id} to database: ${dbName}`,
          }
        ]
      }
    }
  • Zod schema defining input for save_json_doc_to_db: databaseName (string), doc (any object).
    const SaveJsonDocToDbArgsSchema = z.object({
      databaseName: z.string(),
      doc: z.object({})
    });
  • src/index.ts:128-145 (registration)
    Tool registration in listTools handler: defines name, description, and JSON input schema for save_json_doc_to_db.
    {
      name: "save_json_doc_to_db",
      description: "Save a JSON document to a document database",
      inputSchema: {
        type: "object",
        properties: {
          doc: {
            type: "object",
            description: "JSON document to save",
          },
          databaseName: {
            type: "string",
            description: "document database to save to",
          },
        },
        required: ["doc", "databaseName"],
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Save' implies a mutation, but it doesn't specify if this creates new documents, updates existing ones, requires authentication, has rate limits, or what happens on failure. This leaves critical behavioral traits unaddressed for a write operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly. Every word earns its place in conveying the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a write operation with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects like error handling, return values, or dependencies (e.g., database connectivity). For a mutation tool in this context, more information is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for both parameters ('doc' and 'databaseName'). The description adds no additional meaning beyond the schema, such as format constraints or examples. With high schema coverage, the baseline score of 3 is appropriate, as the schema adequately documents the parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Save') and resource ('JSON document to a document database'), making the purpose immediately understandable. It distinguishes from siblings like 'load_json_doc_from_db' and 'delete_json_doc_from_db' by specifying the write operation. However, it doesn't explicitly mention that this creates or updates a document, which could be more specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites like needing a connected database or differentiate from 'create_json_doc_database' for setup. Without context on use cases or exclusions, the agent must infer usage from sibling names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jimpick/mcp-json-db-collection-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server