Skip to content

Commit bf477a6

Browse files
committed
Update get-documentation.ts
1 parent 0f54824 commit bf477a6

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

packages/mcp-server/src/mcp/handlers/tools/get-documentation.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ export function get_documentation(server: SvelteMcp) {
4949
const results = await Promise.all(
5050
sections.map(async (requestedSection) => {
5151
const matchedSection = availableSections.find(
52-
s => s.title.toLowerCase() === requestedSection.toLowerCase() ||
53-
s.url === requestedSection
52+
(s) =>
53+
s.title.toLowerCase() === requestedSection.toLowerCase() ||
54+
s.url === requestedSection,
5455
);
5556

5657
if (matchedSection) {
@@ -60,19 +61,28 @@ export function get_documentation(server: SvelteMcp) {
6061
const content = await response.text();
6162
return { success: true, content: `## ${matchedSection.title}\n\n${content}` };
6263
} else {
63-
return { success: false, content: `## ${matchedSection.title}\n\nError: Could not fetch documentation (HTTP ${response.status})` };
64+
return {
65+
success: false,
66+
content: `## ${matchedSection.title}\n\nError: Could not fetch documentation (HTTP ${response.status})`,
67+
};
6468
}
6569
} catch (error) {
66-
return { success: false, content: `## ${matchedSection.title}\n\nError: Failed to fetch documentation - ${error}` };
70+
return {
71+
success: false,
72+
content: `## ${matchedSection.title}\n\nError: Failed to fetch documentation - ${error}`,
73+
};
6774
}
6875
} else {
69-
return { success: false, content: `## ${requestedSection}\n\nError: Section not found.` };
76+
return {
77+
success: false,
78+
content: `## ${requestedSection}\n\nError: Section not found.`,
79+
};
7080
}
71-
})
81+
}),
7282
);
7383

74-
const hasAnySuccess = results.some(result => result.success);
75-
let finalText = results.map(r => r.content).join('\n\n---\n\n');
84+
const hasAnySuccess = results.some((result) => result.success);
85+
let finalText = results.map((r) => r.content).join('\n\n---\n\n');
7686

7787
if (!hasAnySuccess) {
7888
const formattedSections = availableSections

0 commit comments

Comments
 (0)