create_outline_by_doc
Generate structured PPT outlines from uploaded documents in formats like PDF, DOC, TXT, or MD. Ideal for streamlining presentation preparation by extracting key content and creating a draft framework for subsequent PPT creation.
Instructions
从文档创建PPT大纲。
使用说明:
1. 用于根据文档内容生成PPT大纲。
2. 支持通过file_url或file_path上传文档。
3. 文档格式支持:pdf(不支持扫描件)、doc、docx、txt、md。
4. 文档大小限制:10M以内,字数限制8000字以内。
5. 生成的大纲可用于create_ppt_by_outline工具。
6. 需先设置环境变量AIPPT_APP_ID和AIPPT_API_SECRET。
参数:
- file_name: 文档文件名,必须包含文件后缀名。
- file_url: 文档文件的URL地址,与file_path二选一必填。
- file_path: 文档文件的本地路径,与file_url二选一必填。
- text: 补充的文本内容,用于指导大纲生成。
- language: 大纲生成的语言,目前支持cn(中文)。
- search: 是否联网搜索,True表示联网搜索补充内容,False表示不联网。
返回:
包含生成的大纲内容的字典。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_name | Yes | ||
| file_path | No | ||
| file_url | No | ||
| language | No | cn | |
| search | No | ||
| text | Yes |
Implementation Reference
- src/zwppt_mcp/server.py:215-265 (handler)The complete handler implementation for the 'create_outline_by_doc' tool, including the @mcp.tool() decorator for registration, function signature serving as schema, and the logic to call the external API for generating PPT outline from a document.@mcp.tool() def create_outline_by_doc( ctx: Context, file_name: str, text: str, file_url: Optional[str] = None, file_path: Optional[str] = None, language: str = "cn", search: bool = False ) -> Dict[str, Any]: """ 从文档创建PPT大纲。 使用说明: 1. 用于根据文档内容生成PPT大纲。 2. 支持通过file_url或file_path上传文档。 3. 文档格式支持:pdf(不支持扫描件)、doc、docx、txt、md。 4. 文档大小限制:10M以内,字数限制8000字以内。 5. 生成的大纲可用于create_ppt_by_outline工具。 6. 需先设置环境变量AIPPT_APP_ID和AIPPT_API_SECRET。 参数: - file_name: 文档文件名,必须包含文件后缀名。 - file_url: 文档文件的URL地址,与file_path二选一必填。 - file_path: 文档文件的本地路径,与file_url二选一必填。 - text: 补充的文本内容,用于指导大纲生成。 - language: 大纲生成的语言,目前支持cn(中文)。 - search: 是否联网搜索,True表示联网搜索补充内容,False表示不联网。 返回: 包含生成的大纲内容的字典。 """ url = "https://zwapi.xfyun.cn/api/ppt/v2/createOutlineByDoc" fields = { "fileName": file_name, "query": text, "language": language, "search": str(search) } if file_url: fields["fileUrl"] = file_url elif file_path: fields["file"] = (file_name, open(file_path, 'rb'), 'text/plain') form_data = MultipartEncoder(fields=fields) headers = get_headers(form_data.content_type) response = requests.post(url, data=form_data, headers=headers) if response.status_code != 200: raise Exception(f"调用失败: {response.text}") return response.text