mirror of
https://github.com/upstash/context7.git
synced 2025-11-11 07:17:28 +00:00
feat: string-to-number conversion for tokens parameter
This commit is contained in:
parent
c1a4a1a21c
commit
ae1a7c44fa
@ -80,8 +80,10 @@ server.tool(
|
|||||||
.optional()
|
.optional()
|
||||||
.describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."),
|
.describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."),
|
||||||
tokens: z
|
tokens: z
|
||||||
.number()
|
.preprocess((val) => (typeof val === "string" ? Number(val) : val), z.number())
|
||||||
.min(DEFAULT_MINIMUM_TOKENS)
|
.refine((val) => typeof val === "number" && val >= DEFAULT_MINIMUM_TOKENS, {
|
||||||
|
message: `Must be a number >= ${DEFAULT_MINIMUM_TOKENS}`,
|
||||||
|
})
|
||||||
.optional()
|
.optional()
|
||||||
.describe(
|
.describe(
|
||||||
`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`
|
`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user