Skip to main content
Glama

Convex MCP server

Official
by get-convex
replaceDocument.ts873 B
import { ConvexError, GenericId } from "convex/values"; import { v } from "convex/values"; import { mutationGeneric } from "../server"; export default mutationGeneric({ args: { id: v.string(), document: v.any(), componentId: v.optional(v.union(v.string(), v.null())), }, handler: async ( { db }, args, ): Promise<{ success: false; error: string } | { success: true }> => { const id = args.id as GenericId<string>; const document = args.document; const doc = await db.get(id); if (doc === null) { return { success: false, error: "Document does not exist.", }; } try { await db.replace(id, document); } catch (e: any) { // Rewrapping this error because it could be a schema validation error. throw new ConvexError(e.message); } return { success: true }; }, });

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