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
| Name | Required | Description | Default |
|---|---|---|---|
| outline_id | Yes |
Implementation Reference
- src/paperlib_mcp/tools/review.py:823-898 (handler)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)}
- src/paperlib_mcp/server.py:47-47 (registration)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 """