mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-14 03:56:55 +03:00
refactor(core): parse MCP prompt arguments once (#45646)
This commit is contained in:
committed by
GitHub
Unverified
parent
d432823515
commit
6bbf2e34e7
@@ -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}`))
|
||||
|
||||
Reference in New Issue
Block a user