get_prompt
Retrieve detailed task instructions by task number to understand requirements for AI agent execution.
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 |
Implementation Reference
- src/tools/get-prompt.ts:135-171 (handler)The main handler function that executes the tool logic: validates input, calls the CodeRide API to fetch the task prompt for the given task number, and returns the prompt or handles errors.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 schema defining the input for the get_prompt tool: requires a 'number' string matching the task ID format (e.g., CRD-1).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)Instantiation of the GetPromptTool with SecureApiClient dependency injection and registration to the MCP server via the tools array and forEach register call.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); });