Skip to content

Commit b0f7728

Browse files
authored
bug(runtime): Ensure runtime and other parameters is sanitised (#28)
1 parent 6ae0022 commit b0f7728

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const fetchDocSchema = z.object({
2727
url: z.string().url(),
2828
});
2929

30-
const server = new Server(
30+
export const server = new Server(
3131
{
3232
name: "powertools-mcp-server",
3333
version: "0.6.0",
@@ -77,10 +77,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
7777
if (!parsed.success) {
7878
throw new Error(`Invalid arguments for search_docs: ${parsed.error}`);
7979
}
80-
const search = parsed.data.search;
81-
const runtime = parsed.data.runtime;
82-
const version = parsed.data.version || 'latest';
80+
const search = parsed.data.search.trim();
81+
const runtime = parsed.data.runtime.trim().toLowerCase();
82+
const version = parsed.data.version?.trim().toLowerCase() || 'latest';
8383

84+
8485
// do the search
8586
const idx = await searchIndexes.getIndex(runtime, version);
8687
if (!idx) {

0 commit comments

Comments
 (0)