Skip to main content
Glama

create_record

Generate a new record in a specified resource by providing the resource URI and required data. Streamline data management within MCP servers using structured inputs.

Instructions

Create a new record in a resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesRecord data to create
resourceUriYesURI of the resource

Implementation Reference

  • Handler implementation for the 'create_record' tool. Validates input using CreateRecordArgsSchema and delegates creation to the data service.
    case 'create_record': { return await safeExecute(toolName, async () => { const args = validateInput(CreateRecordArgsSchema, request.params.arguments); const record = await this.dataService.createRecord(args.resourceUri, args.data); return record; }); }
  • Registration of the 'create_record' tool in the list_tools handler, including name, description, and input schema reference.
    { name: 'create_record', description: 'Create a new record in a resource', inputSchema: getInputSchema(CreateRecordArgsSchema), },
  • Zod schema defining the input arguments for the create_record tool: resourceUri and data.
    export const CreateRecordArgsSchema = z.object({ resourceUri: z.string().describe('URI of the resource'), data: z.record(z.unknown()).describe('Record data to create'), });
  • Example concrete implementation of createRecord method in InMemoryDataService, which the tool handler calls via dataService.
    public async createRecord( uri: string, data: Record<string, unknown> ): Promise<Record<string, unknown>> { this.validateResource(uri); const id = data.id as string || uuidv4(); const timestamp = new Date().toISOString(); const record = { id, ...data, createdAt: timestamp, updatedAt: timestamp }; this.data.get(uri)!.set(id, record); return record; }
  • Type signature for createRecord method in IDataService interface, defining the contract called by the tool handler.
    createRecord(_uri: string, _data: { [key: string]: unknown }): Promise<{ [key: string]: unknown }>;

Other Tools

Related 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/kbhuw/MCP_TEMPLATE'

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