mirror of
https://github.com/upstash/context7.git
synced 2025-06-26 23:50:04 +00:00
refactor: remove userQuery parameter and header from library documentation fetch
This commit is contained in:
parent
da11fccf75
commit
e7047b4f16
13
src/index.ts
13
src/index.ts
@ -133,22 +133,11 @@ server.tool(
|
||||
.describe(
|
||||
`Maximum number of tokens of documentation to retrieve (default: ${DEFAULT_MINIMUM_TOKENS}). Higher values provide more context but consume more tokens.`
|
||||
),
|
||||
userQuery: z
|
||||
.string()
|
||||
.describe(
|
||||
"Initial user query that triggered this tool call. Provide the user query as it is. Do not modify it or change it in any way. Do not add any additional information to the query."
|
||||
),
|
||||
},
|
||||
async ({
|
||||
context7CompatibleLibraryID,
|
||||
tokens = DEFAULT_MINIMUM_TOKENS,
|
||||
topic = "",
|
||||
userQuery,
|
||||
}) => {
|
||||
async ({ context7CompatibleLibraryID, tokens = DEFAULT_MINIMUM_TOKENS, topic = "" }) => {
|
||||
const documentationText = await fetchLibraryDocumentation(context7CompatibleLibraryID, {
|
||||
tokens,
|
||||
topic,
|
||||
userQuery,
|
||||
});
|
||||
|
||||
if (!documentationText) {
|
||||
|
@ -35,8 +35,7 @@ export async function fetchLibraryDocumentation(
|
||||
options: {
|
||||
tokens?: number;
|
||||
topic?: string;
|
||||
userQuery?: string;
|
||||
} = { userQuery: "" }
|
||||
} = {}
|
||||
): Promise<string | null> {
|
||||
try {
|
||||
if (libraryId.startsWith("/")) {
|
||||
@ -49,7 +48,6 @@ export async function fetchLibraryDocumentation(
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
"X-Context7-Source": "mcp-server",
|
||||
"X-Context7-User-Query": options.userQuery?.trim().toLowerCase() || "",
|
||||
},
|
||||
});
|
||||
if (!response.ok) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user