Skip to main content
Glama

get_prompts

Retrieve and execute specific onboarding prompts for Desktop Commander to organize files, analyze data, check system health, or create knowledge bases.

Instructions

                    Retrieve a specific Desktop Commander onboarding prompt by ID and execute it.
                    
                    SIMPLIFIED ONBOARDING V2: This tool only supports direct prompt retrieval.
                    The onboarding system presents 5 options as a simple numbered list:
                    
                    1. Organize my Downloads folder (promptId: 'onb2_01')
                    2. Explain a codebase or repository (promptId: 'onb2_02')
                    3. Create organized knowledge base (promptId: 'onb2_03')
                    4. Analyze a data file (promptId: 'onb2_04')
                    5. Check system health and resources (promptId: 'onb2_05')
                    
                    USAGE:
                    When user says "1", "2", "3", "4", or "5" from onboarding:
                    - "1" → get_prompts(action='get_prompt', promptId='onb2_01')
                    - "2" → get_prompts(action='get_prompt', promptId='onb2_02')
                    - "3" → get_prompts(action='get_prompt', promptId='onb2_03')
                    - "4" → get_prompts(action='get_prompt', promptId='onb2_04')
                    - "5" → get_prompts(action='get_prompt', promptId='onb2_05')
                    
                    The prompt content will be injected and execution begins immediately.

                    This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
promptIdYes

Implementation Reference

  • The primary handler function for the 'get_prompts' tool. Validates input parameters, handles the 'get_prompt' action by calling the helper getPrompt, and returns formatted ServerResult responses including error handling.
    export async function getPrompts(params: any): Promise<ServerResult> {
      try {
        // Validate and cast parameters
        const { action, promptId, anonymous_user_use_case } = params as GetPromptsParams;
        
        if (!action) {
          return {
            content: [{
              type: "text",
              text: "❌ Error: 'action' parameter is required. Use 'get_prompt'"
            }],
            isError: true
          };
        }
    
        // Only support get_prompt action now
        if (action === 'get_prompt') {
          if (!promptId) {
            return {
              content: [{
                type: "text",
                text: "❌ Error: promptId is required when action is 'get_prompt'"
              }],
              isError: true
            };
          }
          return await getPrompt(promptId, anonymous_user_use_case);
        }
        
        // Legacy actions return deprecation notice
        return {
          content: [{
            type: "text",
            text: "❌ Error: Only 'get_prompt' action is supported. Use promptId to get a specific prompt."
          }],
          isError: true
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `❌ Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    }
  • Zod schema for validating inputs to the get_prompts tool, requiring 'action' as 'get_prompt' and 'promptId'.
    export const GetPromptsArgsSchema = z.object({
      action: z.enum(['get_prompt']),
      promptId: z.string(),
      // Disabled to check if it makes sense or should be removed or changed
      // anonymous_user_use_case: z.string().optional(),
    });
  • Tool registration in the list_tools handler, defining the tool's name, description, input schema, and annotations for the MCP protocol.
    name: "get_prompts",
    description: `
            Retrieve a specific Desktop Commander onboarding prompt by ID and execute it.
            
            SIMPLIFIED ONBOARDING V2: This tool only supports direct prompt retrieval.
            The onboarding system presents 5 options as a simple numbered list:
            
            1. Organize my Downloads folder (promptId: 'onb2_01')
            2. Explain a codebase or repository (promptId: 'onb2_02')
            3. Create organized knowledge base (promptId: 'onb2_03')
            4. Analyze a data file (promptId: 'onb2_04')
            5. Check system health and resources (promptId: 'onb2_05')
            
            USAGE:
            When user says "1", "2", "3", "4", or "5" from onboarding:
            - "1" → get_prompts(action='get_prompt', promptId='onb2_01')
            - "2" → get_prompts(action='get_prompt', promptId='onb2_02')
            - "3" → get_prompts(action='get_prompt', promptId='onb2_03')
            - "4" → get_prompts(action='get_prompt', promptId='onb2_04')
            - "5" → get_prompts(action='get_prompt', promptId='onb2_05')
            
            The prompt content will be injected and execution begins immediately.
    
            ${CMD_PREFIX_DESCRIPTION}`,
        inputSchema: zodToJsonSchema(GetPromptsArgsSchema),
        annotations: {
            title: "Get Prompts",
            readOnlyHint: true,
        },
    }
  • Helper function to load and cache the prompts data from JSON file, used by the getPrompts handler.
    export async function loadPromptsData(): Promise<PromptsData> {
       if (cachedPromptsData) {
         return cachedPromptsData;
       }
    
      try {
        const dataPath = path.join(__dirname, '..', 'data', 'onboarding-prompts.json');
        const fileContent = await fs.readFile(dataPath, 'utf-8');
        cachedPromptsData = JSON.parse(fileContent);
        
        if (!cachedPromptsData) {
          throw new Error('Failed to parse prompts data');
        }
        
        return cachedPromptsData;
      } catch (error) {
        throw new Error(`Failed to load prompts data: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Core helper function that retrieves a specific prompt by ID, marks usage, formats the response, and returns it.
    async function getPrompt(promptId: string, anonymousUseCase?: string): Promise<ServerResult> {
      const data = await loadPromptsData();
      
      const prompt = data.prompts.find(p => p.id === promptId);
      
      if (!prompt) {
        return {
          content: [{
            type: "text",
            text: `❌ Prompt with ID '${promptId}' not found. Use action='list_prompts' to see available prompts.`
          }],
          isError: true
        };
      }
    
      // Mark prompt as used in user's onboarding state (for analytics)
      await usageTracker.markPromptUsed(promptId, prompt.categories[0] || 'uncategorized');
      
      const response = formatPromptResponse(prompt);
      
      return {
        content: [{
          type: "text",
          text: response
        }]
      };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wonderwhy-er/ClaudeComputerCommander'

If you have feedback or need assistance with the MCP directory API, please join our Discord server