MCPcopy Create free account
hub / github.com/modelcontextprotocol/mcpb / promptPrompts

Function promptPrompts

src/cli/init.ts:264–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

262}
263
264export async function promptPrompts() {
265 const addPrompts = await confirm({
266 message:
267 "Does your MCP Server provide prompts you want to advertise (optional)?",
268 default: false,
269 });
270
271 const prompts: Array<{
272 name: string;
273 description?: string;
274 arguments?: string[];
275 text: string;
276 }> = [];
277 let promptsGenerated = false;
278
279 if (addPrompts) {
280 let addMore = true;
281 while (addMore) {
282 const promptName = await input({
283 message: "Prompt name:",
284 validate: (value) =>
285 value.trim().length > 0 || "Prompt name is required",
286 });
287 const promptDescription = await input({
288 message: "Prompt description (optional):",
289 });
290
291 // Ask about arguments
292 const hasArguments = await confirm({
293 message: "Does this prompt have arguments?",
294 default: false,
295 });
296
297 const argumentNames: string[] = [];
298 if (hasArguments) {
299 let addMoreArgs = true;
300 while (addMoreArgs) {
301 const argName = await input({
302 message: "Argument name:",
303 validate: (value) => {
304 if (!value.trim()) return "Argument name is required";
305 if (argumentNames.includes(value)) {
306 return "Argument names must be unique";
307 }
308 return true;
309 },
310 });
311 argumentNames.push(argName);
312
313 addMoreArgs = await confirm({
314 message: "Add another argument?",
315 default: false,
316 });
317 }
318 }
319
320 // Prompt for the text template
321 const promptText = await input({

Callers 1

initExtensionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…