mirror of
https://github.com/upstash/context7.git
synced 2025-12-03 02:21:13 +00:00
feat: enforce minimum token limit of 5000 for library docs retrieval
This commit is contained in:
parent
1afaa5982e
commit
b199a1645e
@ -157,7 +157,7 @@ Add this to your Claude Desktop `claude_desktop_config.json` file. See [Claude D
|
||||
- `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID.
|
||||
- `context7CompatibleLibraryID` (required)
|
||||
- `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks")
|
||||
- `tokens` (optional, default 5000): Max number of tokens to return
|
||||
- `tokens` (optional, default 5000): Max number of tokens to return. Values less than 5000 are automatically increased to 5000.
|
||||
|
||||
## Development
|
||||
|
||||
|
||||
@ -81,9 +81,7 @@ server.tool(
|
||||
.describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."),
|
||||
tokens: z
|
||||
.preprocess((val) => (typeof val === "string" ? Number(val) : val), z.number())
|
||||
.refine((val) => typeof val === "number" && val >= DEFAULT_MINIMUM_TOKENS, {
|
||||
message: `Must be a number >= ${DEFAULT_MINIMUM_TOKENS}`,
|
||||
})
|
||||
.transform((val) => (val < DEFAULT_MINIMUM_TOKENS ? DEFAULT_MINIMUM_TOKENS : val))
|
||||
.optional()
|
||||
.describe(
|
||||
`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