Skip to main content
Glama
jimpick

MCP JSON Document Collection Server

by jimpick

load_json_doc_from_db

Retrieve a JSON document from a database by specifying its unique ID. This tool accesses stored documents for viewing or processing within the MCP JSON Document Collection Server.

Instructions

Load a JSON document by ID from a document database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of document to load
databaseNameNoname of document database to load from

Implementation Reference

  • Handler for the 'load_json_doc_from_db' tool. Parses arguments using the schema, retrieves or initializes the Fireproof database, fetches the document by ID using db.get(), logs it, and returns the document as a JSON string in the tool response.
    case "load_json_doc_from_db": {
      const parsed = LoadJsonDocFromDbArgsSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments for load_json_doc_from_db: ${parsed.error}`);
      }
    
      const dbName = parsed.data.databaseName;
      if (!dbs[dbName]) {
        const newDb = fireproof(dbName);
        dbs[dbName] = { db: newDb };
      }
      const db = dbs[dbName].db;
    
      const doc = await db.get(parsed.data.id);
      console.error("doc", doc);
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(doc),
          },
        ],
      };
    }
  • Zod schema defining input arguments for the load_json_doc_from_db tool: databaseName (string) and id (string). Used for validation in the handler.
    const LoadJsonDocFromDbArgsSchema = z.object({
      databaseName: z.string(),
      id: z.string(),
    });
  • src/index.ts:153-170 (registration)
    Tool registration in the ListToolsResponse. Defines name, description, and inputSchema (hardcoded JSON schema equivalent to the Zod schema, with id required).
    {
      name: "load_json_doc_from_db",
      description: "Load a JSON document by ID from a document database",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "ID of document to load",
          },
          databaseName: {
            type: "string",
            description: "name of document database to load from",
          },
        },
        // properties: zodToJsonSchema(LoadJsonDocFromDbArgsSchema),
        required: ["id"],
      },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but lacks details on permissions, error handling (e.g., what happens if the ID doesn't exist), return format, or rate limits. This is inadequate for a tool that likely involves data access and potential failures.

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 front-loads the core action ('Load a JSON document by ID') without unnecessary words. Every part earns its place by specifying the resource and source, making it highly concise and well-structured.

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 database read operation with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., the JSON document content or error messages), behavioral traits, or usage context, leaving significant gaps for an AI agent to rely on.

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%, so the schema already documents both parameters ('id' and 'databaseName') fully. The description implies loading by ID but doesn't add any syntax, format, or contextual details beyond what the schema provides, meeting the baseline for high coverage.

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 verb 'Load' and the resource 'JSON document by ID from a document database', making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'query_json_docs_from_db' or 'save_json_doc_to_db', which would require more specific language about retrieval vs. querying or saving.

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 (e.g., needing an existing database), exclusions (e.g., not for querying multiple documents), or refer to sibling tools like 'query_json_docs_from_db' for broader searches, leaving usage context unclear.

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