Skip to main content
Glama

Convex MCP server

Official
by get-convex
tables.ts1.37 kB
import { TableDefinition, defineTable } from "convex/server"; import { v } from "convex/values"; function table({ searchIndex = false, vectorIndex = false, }: { searchIndex?: boolean; vectorIndex?: boolean; }) { let t = defineTable({ author: v.string(), body: v.string(), channel: v.string(), embedding: v.array(v.float64()), }); console.log(t); if (searchIndex) { t = t.searchIndex("search_body", { searchField: "body", filterFields: ["channel"], }); } if (vectorIndex) { t = t.vectorIndex("by_embedding", { vectorField: "embedding", dimensions: 2, filterFields: ["channel"], }); } console.log("returning", t); return t; } export function tables(count: { normal: number; withSearchIndex: number; withVectorIndex: number; }) { const tables: Record<string, TableDefinition> = {}; for (let i = 0; i < count.normal; i++) { const name = `table_${i}`; tables[name] = table({ searchIndex: false, vectorIndex: false }); } for (let i = 0; i < count.withSearchIndex; i++) { const name = `table_search_${i}`; tables[name] = table({ searchIndex: true, vectorIndex: false }); } for (let i = 0; i < count.withVectorIndex; i++) { const name = `table_vector_${i}`; tables[name] = table({ searchIndex: false, vectorIndex: true }); } return tables; }

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