MCPcopy Create free account
hub / github.com/freecodexyz/free-code / getPromptForCommand

Function getPromptForCommand

src/services/mcp/client.ts:2075–2096  ·  view source on GitHub ↗
(args: string)

Source from the content-addressed store, hash-verified

2073 argNames,
2074 source: 'mcp',
2075 async getPromptForCommand(args: string) {
2076 const argsArray = args.split(' ')
2077 try {
2078 const connectedClient = await ensureConnectedClient(client)
2079 const result = await connectedClient.client.getPrompt({
2080 name: prompt.name,
2081 arguments: zipObject(argNames, argsArray),
2082 })
2083 const transformed = await Promise.all(
2084 result.messages.map(message =>
2085 transformResultContent(message.content, connectedClient.name),
2086 ),
2087 )
2088 return transformed.flat()
2089 } catch (error) {
2090 logMCPError(
2091 client.name,
2092 `Error running command '${prompt.name}': ${errorMessage(error)}`,
2093 )
2094 throw error
2095 }
2096 },
2097 }
2098 })
2099 } catch (error) {

Callers

nothing calls this directly

Calls 4

ensureConnectedClientFunction · 0.85
transformResultContentFunction · 0.85
logMCPErrorFunction · 0.85
errorMessageFunction · 0.50

Tested by

no test coverage detected