Skip to main content
Glama
suggestions.ts1.61 kB
import { suggestionsDataAccess } from "@repo/db/database/admin"; import { zCreateSuggestionSchema, zSearchSuggestionsSchema, zUpdateSuggestionSchema, } from "@repo/db/types"; import { adminProcedure, router } from "../../trpc"; import { z } from "zod"; export const suggestionsRouter = router({ // 创建建议 create: adminProcedure .input(zCreateSuggestionSchema) .mutation(async ({ ctx, input }) => { console.log("[suggestion] [create] input", input); return suggestionsDataAccess.create({ ...input, userId: ctx.user.id, }); }), // 更新建议 update: adminProcedure .input(zUpdateSuggestionSchema) .mutation(async ({ ctx, input }) => { const { id, ...data } = input; return suggestionsDataAccess.update(id, { ...data, id, userId: ctx.user.id, }); }), // 获取建议 getById: adminProcedure .input(z.object({ id: z.string() })) .query(async ({ input }) => { return suggestionsDataAccess.getById(input.id); }), // 搜索建议 search: adminProcedure .input(zSearchSuggestionsSchema) .query(async ({ input }) => { return suggestionsDataAccess.search(input); }), // 删除建议 delete: adminProcedure .input(z.object({ id: z.string() })) .mutation(async ({ input }) => { return suggestionsDataAccess.delete(input.id); }), getListByUserId: adminProcedure .input(z.object({ userId: z.string() })) .query(async ({ input }) => { return suggestionsDataAccess.getSuggestionsByUserId(input.userId); }), });

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/metacode0602/open-mcp'

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