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

Function getPromptForCommand

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected