Skip to main content
Glama

compose_full_template_v1

Generate structured document templates with placeholder sections for academic writing based on outline IDs.

Instructions

生成全文结构模板

返回按顺序排列的章节和 markdown 模板(带占位符)。

Args: outline_id: 大纲 ID

Returns: ordered_sections[], template_markdown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outline_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for compose_full_template_v1, decorated with @mcp.tool(). Queries the review_outlines and review_outline_sections tables to fetch the outline and ordered sections, then generates a markdown template with section headers and placeholders.
    def compose_full_template_v1(outline_id: str) -> dict[str, Any]:
        """生成全文结构模板
    
        返回按顺序排列的章节和 markdown 模板(带占位符)。
    
        Args:
            outline_id: 大纲 ID
    
        Returns:
            ordered_sections[], template_markdown
        """
        try:
            # 获取 outline
            outline = query_one(
                "SELECT outline_id, topic, outline_style FROM review_outlines WHERE outline_id = %s",
                (outline_id,),
            )
            if not outline:
                return {"error": f"Outline not found: {outline_id}"}
    
            # 获取 sections
            sections = query_all(
                """
                SELECT section_id, title, description, ord
                FROM review_outline_sections
                WHERE outline_id = %s
                ORDER BY ord
                """,
                (outline_id,),
            )
    
            ordered_sections = [
                {
                    "section_id": s["section_id"],
                    "title": s["title"],
                    "description": s["description"],
                    "ord": s["ord"],
                }
                for s in sections
            ]
    
            # 生成 markdown 模板
            template_lines = [
                f"# {outline['topic']}",
                "",
            ]
    
            for section in sections:
                template_lines.extend([
                    f"## {section['title']}",
                    "",
                    f"<!-- SECTION: {section['section_id']} -->",
                    f"<!-- {section['description']} -->",
                    "",
                    "[请在此处插入章节内容]",
                    "",
                ])
    
            template_lines.extend([
                "## 参考文献",
                "",
                "<!-- REFERENCES -->",
                "",
            ])
    
            return {
                "outline_id": outline_id,
                "topic": outline["topic"],
                "outline_style": outline["outline_style"],
                "ordered_sections": ordered_sections,
                "template_markdown": "\n".join(template_lines),
            }
    
        except Exception as e:
            return {"error": str(e)}
  • Invocation of register_review_tools on the MCP instance, which defines and registers the compose_full_template_v1 tool via its @mcp.tool() decorator.
    register_review_tools(mcp)
  • Docstring providing input/output schema description for the tool, used by FastMCP for schema inference.
    """生成全文结构模板
    
    返回按顺序排列的章节和 markdown 模板(带占位符)。
    
    Args:
        outline_id: 大纲 ID
    
    Returns:
        ordered_sections[], template_markdown
    """
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates and returns data, implying a read-only operation, but doesn't clarify if it's idempotent, has side effects, requires specific permissions, or handles errors. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is appropriately concise and front-loaded, with the purpose stated first followed by brief details on args and returns. There's no wasted text, though the structure could be slightly improved by integrating the parameter and return information more seamlessly rather than as separate labeled sections.

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

Completeness3/5

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

Given the tool has an output schema (implied by 'Returns'), the description doesn't need to detail return values, which is adequate. However, with no annotations, 0% schema coverage, and complexity from generating structured templates, the description is incomplete—it lacks context on dependencies, error handling, or example usage, leaving gaps for the agent.

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

Parameters3/5

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

The description adds minimal semantics beyond the input schema. It mentions 'outline_id: 大纲 ID' (outline ID), which restates the parameter name without explaining what an outline ID is, how to obtain it, or its format. With 0% schema description coverage and 1 parameter, the baseline is 4, but the description fails to compensate adequately, providing only basic labeling.

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: '生成全文结构模板' (generate full-text structure template) and specifies it returns ordered sections and markdown templates with placeholders. This is a specific verb+resource combination that distinguishes it from siblings like 'draft_lit_review_v1' or 'draft_section'. However, it doesn't explicitly differentiate from 'get_outline_templates' which might be a related sibling.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing outline), exclusions, or comparisons to siblings like 'get_outline_templates'. The agent must infer usage from the purpose alone, which is insufficient for optimal tool selection.

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/h-lu/paperlib-mcp'

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