Skip to main content
Glama
lumile

Promptopia MCP

by lumile

get_prompt

Retrieve a specific prompt from Promptopia MCP using its unique ID to access stored prompt content for reuse.

Instructions

Gets a prompt by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the prompt to retrieve

Implementation Reference

  • MCP tool handler execution for 'get_prompt': extracts 'id' from input arguments, calls PromptsService.getPrompt(id), and returns the result serialized as JSON text content in MCP format.
    case 'get_prompt': {
      const { id } = args
      const result = await this.promptsService.getPrompt(id)
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      }
    }
  • Registration of the 'get_prompt' tool in listTools(), including name, description, and input JSON schema requiring 'id' parameter.
    {
      name: 'get_prompt',
      description: 'Gets a prompt by its ID',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'ID of the prompt to retrieve'
          }
        },
        required: ['id']
      }
    },
  • JSON schema definition for 'get_prompt' tool input, specifying object with required 'id' string property.
    inputSchema: {
      type: 'object',
      properties: {
        id: {
          type: 'string',
          description: 'ID of the prompt to retrieve'
        }
      },
      required: ['id']
    }
  • Supporting method in PromptsService that implements the core retrieval logic: validates ID, reads prompt JSON from filesystem, and throws appropriate errors if not found.
    async getPrompt(id: string): Promise<Prompt> {
      if (!id || !id.trim()) {
        throw new ValidationError('Prompt ID is required')
      }
    
      try {
        const filePath = path.join(this.promptsDir, `${id}.json`)
        return await this.fileSystemService.readJSONFile<Prompt>(filePath)
      } catch (error) {
        if (error instanceof Error && error.message.includes('not found')) {
          throw new NotFoundError(`Prompt not found: ${id}`)
        }
        throw error
      }
    }

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/lumile/promptopia-mcp'

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