@@ -18,6 +18,7 @@ import {
1818 SlashCommandDescWithSource ,
1919 Tool ,
2020} from "../../" ;
21+ import { stringifyMcpPrompt } from "../../commands/slash/mcpSlashCommand" ;
2122import { MCPManagerSingleton } from "../../context/mcp/MCPManagerSingleton" ;
2223import CurrentFileContextProvider from "../../context/providers/CurrentFileContextProvider" ;
2324import MCPContextProvider from "../../context/providers/MCPContextProvider" ;
@@ -216,15 +217,39 @@ export default async function doLoadConfig(options: {
216217 } ) ) ;
217218 newConfig . tools . push ( ...serverTools ) ;
218219
220+ // Fetch MCP prompt content during config load
219221 const serverSlashCommands : SlashCommandDescWithSource [ ] =
220- server . prompts . map ( ( prompt ) => ( {
221- name : prompt . name ,
222- description : prompt . description ?? "MCP Prompt" ,
223- source : "mcp-prompt" ,
224- isLegacy : false ,
225- mcpServerName : server . name , // Used in client to retrieve prompt
226- mcpArgs : prompt . arguments ,
227- } ) ) ;
222+ await Promise . all (
223+ server . prompts . map ( async ( prompt ) => {
224+ let promptContent : string | undefined ;
225+
226+ try {
227+ // Fetch the actual prompt content from the MCP server
228+ const mcpPromptResponse = await mcpManager . getPrompt (
229+ server . name ,
230+ prompt . name ,
231+ { } , // Empty args for now - TODO: handle prompt arguments
232+ ) ;
233+ promptContent = stringifyMcpPrompt ( mcpPromptResponse ) ;
234+ } catch ( error ) {
235+ console . warn (
236+ `Failed to fetch MCP prompt content for ${ prompt . name } from server ${ server . name } :` ,
237+ error ,
238+ ) ;
239+ // Keep promptContent as undefined so the UI can show a fallback
240+ }
241+
242+ return {
243+ name : prompt . name ,
244+ description : prompt . description ?? "MCP Prompt" ,
245+ source : "mcp-prompt" ,
246+ isLegacy : false ,
247+ prompt : promptContent , // Store the actual prompt content
248+ mcpServerName : server . name , // Used in client to retrieve prompt
249+ mcpArgs : prompt . arguments ,
250+ } ;
251+ } ) ,
252+ ) ;
228253 newConfig . slashCommands . push ( ...serverSlashCommands ) ;
229254
230255 const submenuItems = server . resources
0 commit comments