Skip to main content
Glama

get_template_detail

Retrieve detailed template content from the MCP server to create new development records. Provide a template name to access complete document structure and formatting.

Instructions

获取指定模板的详细内容。templateName 参数必须使用 get_template_list 返回的 templates 中的 templateName 值。这确保了参数的准确性和一致性。返回模板的完整内容,可用于创建新的开发记录文档。如果模板不存在,会返回明确的错误信息。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateNameYes模板文件名(不包含扩展名),必须使用 get_template_list 返回的 templates 中的 templateName

Implementation Reference

  • Handler for the get_template_detail tool: validates input using GetTemplateDetailSchema, checks if template file exists, reads and returns the template content as JSON, or appropriate error messages.
    case "get_template_detail": {
      const parsed = GetTemplateDetailSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments for get_template_detail: ${parsed.error}`);
      }
    
      try {
        const { templateName } = parsed.data;
        const templateDir = getTemplateDir();
        const templatePath = join(templateDir, `${templateName}.md`);
        
        if (!existsSync(templatePath)) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  success: false,
                  error: `Template '${templateName}' does not exist`,
                  templateName,
                  suggestion: "Use get_template_list to see available templates"
                }, null, 2)
              }
            ],
            isError: true,
          };
        }
    
        const content = await readFile(templatePath, "utf-8");
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: true,
                templateName,
                content,
                description: getTemplateDescription(templateName),
                message: `Successfully retrieved template '${templateName}'`
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: false,
                error: `Failed to get template detail: ${errorMessage}`,
                templateName: parsed.data?.templateName || "unknown"
              }, null, 2)
            }
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining the input for get_template_detail: requires 'templateName' string.
    const GetTemplateDetailSchema = z.object({
      templateName: z.string().describe("模板文件名(不包含扩展名),必须使用 get_template_list 返回的 templates 中的 templateName")
    });
  • src/index.ts:92-99 (registration)
    Registration of the get_template_detail tool in the ListToolsRequestHandler, including name, description, and inputSchema derived from GetTemplateDetailSchema.
    {
      name: "get_template_detail",
      description:
        "获取指定模板的详细内容。templateName 参数必须使用 get_template_list 返回的 templates 中的 templateName 值。" +
        "这确保了参数的准确性和一致性。返回模板的完整内容,可用于创建新的开发记录文档。" +
        "如果模板不存在,会返回明确的错误信息。",
      inputSchema: zodToJsonSchema(GetTemplateDetailSchema) as ToolInput,
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses that the tool returns '模板的完整内容' (complete template content) and mentions error behavior: '如果模板不存在,会返回明确的错误信息' (if template doesn't exist, returns clear error message). However, it doesn't describe authentication needs, rate limits, or other behavioral traits like response format or performance characteristics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with four sentences that each serve distinct purposes: stating the core function, specifying parameter requirements, describing the return value, and explaining error behavior. There's no wasted text, and key information appears early.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter read operation with no annotations and no output schema, the description provides good coverage: purpose, parameter constraints, return value description, and error behavior. However, it doesn't fully explain what '完整内容' (complete content) includes or the response format, leaving some ambiguity about the output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds meaningful context about the templateName parameter: it must come from get_template_list responses and ensures '参数的准确性和一致性' (parameter accuracy and consistency). This provides practical usage guidance beyond the schema's technical description, elevating the score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '获取指定模板的详细内容' (Get detailed content of a specified template). It specifies the verb ('获取' - get) and resource ('模板的详细内容' - template details). However, it doesn't explicitly differentiate from its sibling tool 'get_template_list' beyond mentioning that templateName must come from that tool's response.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: 'templateName 参数必须使用 get_template_list 返回的 templates 中的 templateName 值' (templateName parameter must use the templateName value from templates returned by get_template_list). It clearly states when to use this tool (to get template details) and references the alternative/sibling tool for obtaining valid parameter values.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/seenbefore/DevRecord'

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