Skip to main content
Glama
Alex-Smith-1234

讯飞智文PPT生成服务MCP Server

create_ppt_by_outline

Generate PowerPoint presentations from outlines using predefined templates. Automatically insert images, speaker notes, and optional web-sourced content for comprehensive, professional slides.

Instructions

根据大纲创建PPT。 使用说明: 1. 用于根据已生成的大纲创建PPT。 2. 大纲需通过create_outline或create_outline_by_doc工具生成。 3. template_id需通过get_theme_list工具获取。 4. 工具会返回任务ID(sid),需用get_task_progress轮询查询进度。 5. 任务完成后,可从get_task_progress结果中获取PPT下载地址。 6. 需先设置环境变量AIPPT_APP_ID和AIPPT_API_SECRET。 参数: - text: PPT生成的内容描述,用于指导PPT生成。 - outline: 大纲内容,需从create_outline或create_outline_by_doc工具返回的JSON响应中提取['data']['outline']字段的值。该字段包含生成的大纲内容,格式为dict。 - template_id: PPT模板ID,需通过get_theme_list工具获取。 - author: PPT作者名称,将显示在生成的PPT中。 - is_card_note: 是否生成PPT演讲备注,True表示生成,False表示不生成。 - search: 是否联网搜索,True表示联网搜索补充内容,False表示不联网。 - is_figure: 是否自动配图,True表示自动配图,False表示不配图。 - ai_image: AI配图类型,仅在is_figure为True时生效。可选值:normal-普通配图(20%正文配图),advanced-高级配图(50%正文配图)。 返回: 成功时返回包含sid的字典,失败时抛出异常。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ai_imageNonormal
authorNoXXXX
is_card_noteNo
is_figureNo
outlineYes
searchNo
template_idYes
textYes

Implementation Reference

  • The core handler function for the 'create_ppt_by_outline' tool. It is decorated with @mcp.tool() for automatic registration and schema inference from type hints and docstring. Makes POST request to the iFlytek API to generate PPT from provided outline.
    @mcp.tool() def create_ppt_by_outline( ctx: Context, text: str, outline: dict, template_id: str, author: str = "XXXX", is_card_note: bool = True, search: bool = False, is_figure: bool = True, ai_image: str = "normal" ) -> Dict[str, Any]: """ 根据大纲创建PPT。 使用说明: 1. 用于根据已生成的大纲创建PPT。 2. 大纲需通过create_outline或create_outline_by_doc工具生成。 3. template_id需通过get_theme_list工具获取。 4. 工具会返回任务ID(sid),需用get_task_progress轮询查询进度。 5. 任务完成后,可从get_task_progress结果中获取PPT下载地址。 6. 需先设置环境变量AIPPT_APP_ID和AIPPT_API_SECRET。 参数: - text: PPT生成的内容描述,用于指导PPT生成。 - outline: 大纲内容,需从create_outline或create_outline_by_doc工具返回的JSON响应中提取['data']['outline']字段的值。该字段包含生成的大纲内容,格式为dict。 - template_id: PPT模板ID,需通过get_theme_list工具获取。 - author: PPT作者名称,将显示在生成的PPT中。 - is_card_note: 是否生成PPT演讲备注,True表示生成,False表示不生成。 - search: 是否联网搜索,True表示联网搜索补充内容,False表示不联网。 - is_figure: 是否自动配图,True表示自动配图,False表示不配图。 - ai_image: AI配图类型,仅在is_figure为True时生效。可选值:normal-普通配图(20%正文配图),advanced-高级配图(50%正文配图)。 返回: 成功时返回包含sid的字典,失败时抛出异常。 """ url = "https://zwapi.xfyun.cn/api/ppt/v2/createPptByOutline" headers = get_headers() if isinstance(outline, str): outline = json.loads(outline) body = { "query": text, "outline": outline, "templateId": template_id, "author": author, "isCardNote": is_card_note, "search": search, "isFigure": is_figure, "aiImage": ai_image } response = requests.post(url, json=body, headers=headers) if response.status_code != 200: raise Exception(f"调用失败: {response.text}") resp = json.loads(response.text) if resp['code'] == 0: return {"sid": resp['data']['sid']} else: raise Exception(f"根据大纲创建PPT失败: {response.text}")
  • Helper function to generate authentication headers using app ID, secret, timestamp, and signature. Called by create_ppt_by_outline to prepare API request headers.
    def get_headers(content_type: str = "application/json; charset=utf-8") -> dict: if not AIPPT_APP_ID or not AIPPT_API_SECRET: raise Exception("请先设置环境变量AIPPT_APP_ID和AIPPT_API_SECRET") timestamp = int(time.time()) signature = get_signature(AIPPT_APP_ID, AIPPT_API_SECRET, timestamp) return { "appId": AIPPT_APP_ID, "timestamp": str(timestamp), "signature": signature, "Content-Type": content_type }
  • Supporting helper to compute the API signature used in get_headers for authentication.
    def get_signature(app_id: str, api_secret: str, ts: int) -> str: """生成讯飞API签名""" auth = hashlib.md5((app_id + str(ts)).encode('utf-8')).hexdigest() return base64.b64encode( hmac.new(api_secret.encode('utf-8'), auth.encode('utf-8'), hashlib.sha1).digest() ).decode('utf-8')
  • The @mcp.tool() decorator registers the create_ppt_by_outline function as an MCP tool, inferring schema from parameters.
    @mcp.tool()

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/Alex-Smith-1234/zwppt-mcp'

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