Skip to main content
Glama
sanggggg

Record MCP Server

by sanggggg

add_review_record

Add a new review record to a custom type for storing evaluations of items like coffee, whisky, or wine, using defined schemas to organize data.

Instructions

Add a new review record to a type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNameYesName of the review type
dataYesReview data matching the type schema

Implementation Reference

  • The `addRecord` function that executes the core tool logic: validates parameters, checks type existence, validates data against schema, generates record ID, appends to storage, and returns success info.
    export async function addRecord(
      storage: StorageProvider,
      params: AddRecordParams
    ): Promise<AddRecordResult> {
      // Validate type name
      const typeName = validateTypeName(params.typeName);
    
      // Check if type exists
      const exists = await storage.typeExists(typeName);
      if (!exists) {
        throw new Error(`Review type "${typeName}" does not exist`);
      }
    
      // Read existing type data
      const typeData = await storage.readType(typeName);
    
      // Validate record against schema
      validateRecordAgainstSchema(params.data, typeData.schema);
    
      // Create new record
      const recordId = generateId();
      const newRecord: ReviewRecord = {
        id: recordId,
        data: params.data as Record<string, string | number | boolean>,
        createdAt: getCurrentTimestamp(),
      };
    
      // Add record to type
      typeData.records.push(newRecord);
      typeData.updatedAt = getCurrentTimestamp();
    
      // Save updated type data
      await storage.writeType(typeName, typeData);
    
      return {
        success: true,
        typeName,
        recordId,
        message: `Record added to "${typeName}" with ID: ${recordId}`,
      };
    }
  • Input schema definition for the `add_review_record` tool, specifying `typeName` and `data` parameters.
    inputSchema: {
      type: "object",
      properties: {
        typeName: {
          type: "string",
          description: "Name of the review type",
        },
        data: {
          type: "object",
          description: "Review data matching the type schema",
        },
      },
      required: ["typeName", "data"],
    },
  • src/index.ts:107-124 (registration)
    Registration of the `add_review_record` tool in the TOOLS array, including name, description, and input schema.
    {
      name: "add_review_record",
      description: "Add a new review record to a type",
      inputSchema: {
        type: "object",
        properties: {
          typeName: {
            type: "string",
            description: "Name of the review type",
          },
          data: {
            type: "object",
            description: "Review data matching the type schema",
          },
        },
        required: ["typeName", "data"],
      },
    },
  • src/index.ts:220-234 (registration)
    Dispatch handler in the CallToolRequest switch statement that invokes `addRecord` with parsed arguments and formats the response.
    case "add_review_record": {
      const params = args as { typeName: string; data: Record<string, unknown> };
      if (!params?.typeName || !params?.data) {
        throw new Error("typeName and data are required");
      }
      const result = await addRecord(storage, params);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/sanggggg/record-mcp'

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