Merge pull request #22 from chad-loder/pr/auth-naming-fixes
Authentication Header Consistency Fix
This commit is contained in:
21
index.ts
21
index.ts
@ -1809,26 +1809,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
|
|
||||||
case "list_projects": {
|
case "list_projects": {
|
||||||
const args = ListProjectsSchema.parse(request.params.arguments);
|
const args = ListProjectsSchema.parse(request.params.arguments);
|
||||||
const url = new URL(`${GITLAB_API_URL}/projects`);
|
const projects = await listProjects(args);
|
||||||
|
|
||||||
// Add query parameters for filtering
|
|
||||||
Object.entries(args).forEach(([key, value]) => {
|
|
||||||
if (value !== undefined) {
|
|
||||||
url.searchParams.append(key, value.toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const response = await fetch(url.toString(), {
|
|
||||||
method: "GET",
|
|
||||||
headers: DEFAULT_HEADERS,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle errors
|
|
||||||
await handleGitLabError(response);
|
|
||||||
|
|
||||||
// Parse and return the data
|
|
||||||
const data = await response.json();
|
|
||||||
const projects = z.array(GitLabProjectSchema).parse(data);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: [{ type: "text", text: JSON.stringify(projects, null, 2) }],
|
content: [{ type: "text", text: JSON.stringify(projects, null, 2) }],
|
||||||
|
Reference in New Issue
Block a user