get_prompt
Retrieve detailed task instructions or prompts using a unique task identifier (e.g., 'CRD-1') to clarify requirements for AI agents on the coderide MCP server.
Instructions
Retrieves the specific instructions or prompt for a given task, identified by its unique task number (e.g., 'CRD-1'). This is typically used to understand the detailed requirements or context for an AI agent to work on the task.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number | Yes | The unique identifier for the task (e.g., 'CRD-1'). Must follow the format: three uppercase letters, a hyphen, and one or more digits. |
Implementation Reference
- src/tools/get-prompt.ts:135-171 (handler)The `execute` method implements the core handler logic for the 'get_prompt' tool. It fetches the task prompt from the CodeRide API endpoint `/task/number/{taskNumber}/prompt`, handles errors, and returns the `taskPrompt` or an error response.async execute(input: GetPromptInput): Promise<unknown> { logger.info('Executing get-prompt tool', input); try { // Use the injected API client to get task prompt if (!this.apiClient) { throw new Error('API client not available - tool not properly initialized'); } // Get the task prompt using the specific endpoint /task/number/:taskNumber/prompt const taskNumber = input.number.toUpperCase(); // Convert to uppercase for consistency const url = `/task/number/${taskNumber}/prompt`; logger.debug(`Making GET request to: ${url}`); const responseData = await this.apiClient.get<TaskApiResponse>(url) as unknown as TaskApiResponse; if (!responseData) { logger.warn(`No response data received for task number ${taskNumber} from ${url}. This might indicate the task has no prompt or an API issue.`); return { taskPrompt: '' }; // Output camelCase, return empty if no data } // User confirmed API returns 'taskPrompt' (camelCase) for this endpoint. // TaskApiResponse interface has been updated accordingly. return { taskPrompt: responseData.taskPrompt || '' // Access camelCase, output camelCase }; } catch (error) { const errorMessage = (error instanceof Error) ? error.message : 'An unknown error occurred'; logger.error(`Error in get-prompt tool: ${errorMessage}`, error instanceof Error ? error : undefined); return { isError: true, content: [{ type: "text", text: errorMessage }] }; } }
- src/tools/get-prompt.ts:14-19 (schema)Zod input schema `GetPromptSchema` for the 'get_prompt' tool, validating the required 'number' parameter in the format 'ABC-123'.const GetPromptSchema = z.object({ // Task number (e.g., "CRD-1") number: z.string({ required_error: "Task number is required" }).regex(/^[A-Za-z]{3}-\d+$/, { message: "Task number must be in the format ABC-123 (e.g., CRD-1 or crd-1). Case insensitive." }), }).strict();
- src/index.ts:315-330 (registration)Registration of the 'get_prompt' tool in the MCP server: instantiation of `GetPromptTool` with `secureApiClient` dependency injection, addition to the tools array, and registration via `tool.register(server)` in the production server setup.const tools: any[] = [ new StartProjectTool(secureApiClient), new GetPromptTool(secureApiClient), new GetTaskTool(secureApiClient), new GetProjectTool(secureApiClient), new UpdateTaskTool(secureApiClient), new UpdateProjectTool(secureApiClient), new ListProjectsTool(secureApiClient), new ListTasksTool(secureApiClient), new NextTaskTool(secureApiClient), ]; // Register each tool with the server tools.forEach(tool => { tool.register(server); });