Skip to main content
Glama
jimpick

MCP JSON Document Collection Server

by jimpick

connect_json_doc_database_to_cloud

Connect a JSON document database to cloud sync for sharing and collaboration across devices.

Instructions

Connect a JSON document database to cloud sync service

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNameNoname of document database to connect to cloud

Implementation Reference

  • The main handler for the 'connect_json_doc_database_to_cloud' tool. Validates input using ConnectDbToCloudArgsSchema, retrieves the database, connects it to the cloud using the 'connect' function from fireproof-cloud, extracts remoteName and dashboardUrl, updates the metadata, and returns a success message with the dashboard URL.
    case "connect_json_doc_database_to_cloud": {
      const parsed = ConnectDbToCloudArgsSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments for connect_json_doc_database_to_cloud: ${parsed.error}`);
      }
      const dbName = parsed.data.databaseName;
      const results = await localJsonDbCollection.query<string, JsonDocDb>(
        "name",
        {
          range: [
            dbName,
            dbName
          ]
        });
      if (results.rows.length != 1) {
        throw new Error(`Database not found: ${dbName}`);
      }
      const doc = results.rows[0].doc!;
      if (!dbs[dbName]) {
        const newDb = fireproof(dbName);
        dbs[dbName] = { db: newDb };
      }
      const db = dbs[dbName].db;
      const connection = await connect(db);
      const remoteName = connection.dashboardUrl?.getParam("remoteName");
      // console.error("connection.dashboardUrl.remoteName", connection.dashboardUrl?.getParam("remoteName"));
      const dashboardUrl = connection.dashboardUrl?.toString();
      // console.error("dashboardUrl", dashboardUrl);
      await localJsonDbCollection.put({...doc, remoteName, dashboardUrl});
    
      return {
        content: [
          {
            type: "text",
            text: `Connected JSON document database to cloud: ${dbName}, dashboard URL: ${dashboardUrl}`,
          }
        ]
      }
    }
  • Zod schema definition for the input arguments of the connect_json_doc_database_to_cloud tool, requiring a 'databaseName' string.
    const ConnectDbToCloudArgsSchema = z.object({
      databaseName: z.string(),
    });
  • src/index.ts:111-116 (registration)
    Tool registration in the ListToolsRequestHandler, including name, description, input schema derived from ConnectDbToCloudArgsSchema, and required fields.
    {
      name: "connect_json_doc_database_to_cloud",
      description: "Connect a JSON document database to cloud sync service. Show the dashboard URL after connecting.",
      inputSchema: zodToJsonSchema(ConnectDbToCloudArgsSchema) as ToolInput,
      required: ["databaseName"],
    },
  • src/index.ts:189-201 (registration)
    Duplicate tool registration in ListToolsRequestHandler with inline input schema.
    {
      name: "connect_json_doc_database_to_cloud",
      description: "Connect a JSON document database to cloud sync service",
      inputSchema: {
        type: "object",
        properties: {
          databaseName: {
            type: "string",
            description: "name of document database to connect to cloud",
          },
        }
      },
    },

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