Skip to main content
Glama

Convex MCP server

Official
by get-convex
sendExpiringMessage.ts1.25 kB
import { Id } from "./_generated/dataModel"; import { mutation } from "./_generated/server"; import { api } from "./_generated/api"; // @snippet start self-destructing-message function formatMessage(body: string, secondsLeft: number) { return `${body} (This message will self-destruct in ${secondsLeft} seconds)`; } export default mutation( async ( { db, scheduler }, { body, author }: { body: string; author: string }, ) => { const id = await db.insert("messages", { body: formatMessage(body, 5), author, }); await scheduler.runAfter(1000, api.sendExpiringMessage.update, { messageId: id, body, secondsLeft: 4, }); }, ); export const update = mutation( async ( { db, scheduler }, { messageId, body, secondsLeft, }: { messageId: Id<"messages">; body: string; secondsLeft: number }, ) => { if (secondsLeft > 0) { await db.patch(messageId, { body: formatMessage(body, secondsLeft) }); await scheduler.runAfter(1000, api.sendExpiringMessage.update, { messageId, body, secondsLeft: secondsLeft - 1, }); } else { await db.delete(messageId); } }, ); // @snippet end self-destructing-message

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/get-convex/convex-backend'

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