create
Add new records to SurrealDB tables with auto-generated IDs, timestamps, and schema validation. Specify table name and field data to create structured database entries.
Instructions
Create a new record in a SurrealDB table with the specified data.
This tool creates a new record with an auto-generated ID. The system will automatically:
Generate a unique ID for the record
Add created/updated timestamps
Validate the data against any defined schema
Args: table: The name of the table to create the record in (e.g., "user", "product") data: A dictionary containing the field values for the new record. Examples: - {"name": "Alice", "email": "alice@example.com", "age": 30} - {"title": "Laptop", "price": 999.99, "category": "electronics"}
Returns: A dictionary containing: - success: Boolean indicating if creation was successful - data: The created record including its generated ID and timestamps - id: The ID of the newly created record (convenience field) - error: Error message if creation failed (only present on failure)
Examples: >>> await create("user", {"name": "Alice", "email": "alice@example.com"}) { "success": true, "data": {"id": "user:ulid", "name": "Alice", "email": "alice@example.com", "created": "2024-01-01T10:00:00Z"}, "id": "user:ulid" }
Note: If you need to specify a custom ID, use the 'upsert' tool instead.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
data | Yes | ||
table | Yes |