-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
enhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supported
Description
I've been trying to compile any example provided in the Readme with no success.
Typescript is making my life miserable. I cannot decipher the types for this part of the code:
const inputSchema = { sql: z.string() }
const outputSchema = {
rows: z.array(z.record(z.any(), z.any())),
rowCount: z.number(),
}
type InputSchema = z.infer<typeof inputSchema>
type OutputSchema = z.infer<typeof outputSchema>
server.registerTool<InputSchema, OutputSchema>(
'query',
{
title: 'SQL Query',
description: 'Execute SQL queries on the database',
inputSchema,
outputSchema,
},
async ({ sql }) => {
// ...
}
)
I found out about z.infer by searching for a fix, but still it doesn't work.
Can someone please explain how to fix those types?
Thanks.
Metadata
Metadata
Assignees
Labels
enhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supported