Skip to main content
Glama

Prisma MCP Server

Official
by prisma
test.ts3.52 kB
import { expectTypeOf } from 'expect-type' import testMatrix from './_matrix' // @ts-ignore import type { Prisma as PrismaNamespace, PrismaClient } from './generated/prisma/client' declare let prisma: PrismaClient declare let Prisma: typeof PrismaNamespace testMatrix.setupTestSuite(() => { beforeAll(async () => { await prisma.user.createMany({ data: [ { name: 'Boaty McBoatface', email: 'boat@example.com', }, { name: 'Horsey McHorseFace', email: 'horse@example.com', }, ], }) }) test('skips arguments', async () => { const result = await prisma.user.findMany({ where: Prisma.skip, orderBy: { name: 'asc' }, }) expect(result).toMatchInlineSnapshot( [{ id: expect.any(String) }, { id: expect.any(String) }], ` [ { "email": "boat@example.com", "id": Any<String>, "name": "Boaty McBoatface", }, { "email": "horse@example.com", "id": Any<String>, "name": "Horsey McHorseFace", }, ] `, ) }) test('skips input fields', async () => { const result = await prisma.user.findMany({ where: { name: Prisma.skip, }, orderBy: { name: 'asc' }, }) expect(result).toMatchInlineSnapshot( [{ id: expect.any(String) }, { id: expect.any(String) }], ` [ { "email": "boat@example.com", "id": Any<String>, "name": "Boaty McBoatface", }, { "email": "horse@example.com", "id": Any<String>, "name": "Horsey McHorseFace", }, ] `, ) }) test('skips relations in include', async () => { const result = await prisma.user.findFirstOrThrow({ include: { posts: Prisma.skip, }, }) expect(result).not.toHaveProperty('posts') expectTypeOf(result).not.toHaveProperty('posts') }) test('skips relations in select', async () => { const result = await prisma.user.findFirstOrThrow({ select: { id: true, posts: Prisma.skip, }, }) expect(result).not.toHaveProperty('posts') expectTypeOf(result).not.toHaveProperty('posts') }) test('skips fields in omit', async () => { const result = await prisma.user.findFirstOrThrow({ omit: { email: Prisma.skip, }, }) expect(result).toHaveProperty('email') expectTypeOf(result).toHaveProperty('email') }) describe('after extension', () => { test('skips relations in include', async () => { const result = await prisma.$extends({}).user.findFirstOrThrow({ include: { posts: Prisma.skip, }, }) expect(result).not.toHaveProperty('posts') expectTypeOf(result).not.toHaveProperty('posts') }) test('skips relations in select', async () => { const result = await prisma.$extends({}).user.findFirstOrThrow({ select: { id: true, posts: Prisma.skip, }, }) expect(result).not.toHaveProperty('posts') expectTypeOf(result).not.toHaveProperty('posts') }) test('skips fields in omit', async () => { const result = await prisma.$extends({}).user.findFirstOrThrow({ omit: { email: Prisma.skip, }, }) expect(result).toHaveProperty('email') expectTypeOf(result).toHaveProperty('email') }) }) })

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/prisma/prisma'

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