Skip to content

Commit 8536249

Browse files
fix: corrected prompts
1 parent 38de53b commit 8536249

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

packages/core/src/muppet.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export async function muppet<
8080

8181
const hasTools = McpPrimitives.TOOLS in serverConfiguration;
8282
const hasPrompts = McpPrimitives.PROMPTS in serverConfiguration;
83+
const hasResources = false;
8384

8485
return c.json({
8586
result: {
@@ -94,7 +95,8 @@ export async function muppet<
9495
},
9596
capabilities: {
9697
tools: hasTools ? {} : undefined,
97-
prompt: hasPrompts ? {} : undefined,
98+
prompts: hasPrompts ? {} : undefined,
99+
resources: hasResources ? {} : undefined,
98100
},
99101
},
100102
});
@@ -298,8 +300,6 @@ function createToolsApp<
298300

299301
const path = config.tools?.[params.name].path;
300302

301-
c.get("logger")?.info({ path }, "Path");
302-
303303
if (!path) {
304304
throw new Error("Unable to find the path for the tool!");
305305
}
@@ -315,8 +315,6 @@ function createToolsApp<
315315

316316
const json = await res.json();
317317

318-
c.get("logger")?.info({ json }, "Response");
319-
320318
return c.json({ result: json });
321319
});
322320

@@ -328,7 +326,7 @@ function createPromptApp<
328326
S extends Schema = BlankSchema,
329327
P extends string = string,
330328
>(config: ServerConfiguration, hono: Hono<E, S, P>) {
331-
const app = new Hono().use(async (_c, next) => {
329+
const app = new Hono<BaseEnv>().use(async (_c, next) => {
332330
if (!(McpPrimitives.PROMPTS in config)) {
333331
throw new Error("No prompts available");
334332
}
@@ -346,7 +344,7 @@ function createPromptApp<
346344
});
347345
});
348346

349-
app.get("/get", sValidator("json", GetPromptRequestSchema), async (c) => {
347+
app.post("/get", sValidator("json", GetPromptRequestSchema), async (c) => {
350348
const { params } = c.req.valid("json");
351349

352350
const prompt = config.prompts?.[params.name];
@@ -366,7 +364,12 @@ function createPromptApp<
366364

367365
const json = await res.json();
368366

369-
return c.json({ description: prompt.description, messages: json });
367+
if (Array.isArray(json))
368+
return c.json({
369+
result: { description: prompt.description, messages: json },
370+
});
371+
372+
return c.json({ result: json });
370373
});
371374

372375
return app;

0 commit comments

Comments
 (0)