Skip to main content
Glama

get_task_detail

Retrieve comprehensive task details by ID, including implementation guides and verification criteria, to ensure accurate execution and planning.

Instructions

Get the complete detailed information of a task based on its ID, including unabridged implementation guides and verification criteria, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesTask ID to view details

Implementation Reference

  • The core handler function for the 'get_task_detail' tool. It fetches the task details using searchTasksWithCommand (which supports memory areas), generates a formatted prompt with getTaskDetailPrompt, and handles errors.
    export async function getTaskDetail({
      taskId,
    }: z.infer<typeof getTaskDetailSchema>) {
      try {
        // Use searchTasksWithCommand instead of getTaskById to implement memory area task search
        // Set isId to true to search by ID; page number is 1, page size is 1
        const result = await searchTasksWithCommand(taskId, true, 1, 1);
    
        // Check if the task is found
        if (result.tasks.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: `## Error\n\nTask with ID \`${taskId}\` not found. Please confirm if the task ID is correct.`,
              },
            ],
            isError: true,
          };
        }
    
        // Get the found task (the first and only one)
        const task = result.tasks[0];
    
        // Use prompt generator to get the final prompt
        const prompt = getTaskDetailPrompt({
          taskId,
          task,
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: prompt,
            },
          ],
        };
      } catch (error) {
        // Use prompt generator to get error message
        const errorPrompt = getTaskDetailPrompt({
          taskId,
          error: error instanceof Error ? error.message : String(error),
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: errorPrompt,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining the input for getTaskDetail: requires a non-empty taskId string.
    export const getTaskDetailSchema = z.object({
      taskId: z
        .string()
        .min(1, {
          message: "Task ID cannot be empty, please provide a valid task ID",
        })
        .describe("Task ID to view details"),
    });
  • src/index.ts:312-317 (registration)
    Tool registration in the MCP server's ListToolsRequest handler, specifying name, description from MD template, and JSON schema from Zod.
      name: "get_task_detail",
      description: loadPromptFromTemplate(
        "toolsDescription/getTaskDetail.md"
      ),
      inputSchema: zodToJsonSchema(getTaskDetailSchema),
    },
  • Dispatch handler in the MCP server's CallToolRequest handler: validates input with schema and calls the getTaskDetail function.
    case "get_task_detail":
      parsedArgs = await getTaskDetailSchema.safeParseAsync(
        request.params.arguments
      );
      if (!parsedArgs.success) {
        throw new Error(
          `Invalid arguments for tool ${request.params.name}: ${parsedArgs.error.message}`
        );
      }
      result = await getTaskDetail(parsedArgs.data);
      return result;
Install Server

Other Tools

Related Tools

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/liorfranko/mcp-chain-of-thought'

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