refactor(core): parse MCP prompt arguments once (#45646)

This commit is contained in:
Kit Langton
2026-08-27 19:26:40 -04:00
committed by GitHub
Unverified
parent d432823515
commit 6bbf2e34e7
+2 -4
View File
@@ -58,14 +58,12 @@ export const Plugin = define({
description: prompt.description,
execute: (input) =>
Effect.gen(function* () {
const args = parseArguments(input.prompt.text)
const result = yield* mcp.prompt({
server: prompt.server,
name: prompt.name,
args: Object.fromEntries(
(prompt.arguments ?? []).map((argument, index) => [
argument.name,
parseArguments(input.prompt.text)[index] ?? "",
]),
(prompt.arguments ?? []).map((argument, index) => [argument.name, args[index] ?? ""]),
),
})
if (!result) return yield* Effect.fail(new Error(`MCP prompt not found: ${prompt.server}:${prompt.name}`))