get_theme_list
Retrieve a list of PowerPoint templates by filtering style, color, industry, or pay type. Essential for obtaining template IDs required for generating presentations using MCP-compatible servers.
Instructions
获取PPT模板列表。
使用说明:
1. 此工具用于获取可用的PPT模板列表,需先调用本工具获取template_id,后续PPT生成需用到。
2. 可通过style、color、industry等参数筛选模板。
3. 需先设置环境变量AIPPT_APP_ID和AIPPT_API_SECRET。
参数:
- pay_type: 模板付费类型,可选值:free-免费模板,not_free-付费模板。
- style: 模板风格,如:简约、商务、科技等。
- color: 模板颜色,如:红色、蓝色等。
- industry: 模板行业,如:教育培训、金融等。
- page_num: 页码,从1开始。
- page_size: 每页数量,最大100。
返回:
包含模板列表的字典,每个模板包含template_id等信息。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | ||
| industry | No | ||
| page_num | No | ||
| page_size | No | ||
| pay_type | No | not_free | |
| style | No |
Implementation Reference
- src/zwppt_mcp/server.py:41-89 (handler)The main handler function for the 'get_theme_list' tool. It is decorated with @mcp.tool(), which registers it with the MCP server. The function makes an API request to fetch the list of PPT templates based on filtering parameters and returns the response.@mcp.tool() def get_theme_list( ctx: Context, pay_type: str = "not_free", style: Optional[str] = None, color: Optional[str] = None, industry: Optional[str] = None, page_num: int = 2, page_size: int = 10 ) -> Dict[str, Any]: """ 获取PPT模板列表。 使用说明: 1. 此工具用于获取可用的PPT模板列表,需先调用本工具获取template_id,后续PPT生成需用到。 2. 可通过style、color、industry等参数筛选模板。 3. 需先设置环境变量AIPPT_APP_ID和AIPPT_API_SECRET。 参数: - pay_type: 模板付费类型,可选值:free-免费模板,not_free-付费模板。 - style: 模板风格,如:简约、商务、科技等。 - color: 模板颜色,如:红色、蓝色等。 - industry: 模板行业,如:教育培训、金融等。 - page_num: 页码,从1开始。 - page_size: 每页数量,最大100。 返回: 包含模板列表的字典,每个模板包含template_id等信息。 """ url = "https://zwapi.xfyun.cn/api/ppt/v2/template/list" headers = get_headers() params = { "payType": pay_type, "pageNum": page_num, "pageSize": page_size } if style: params["style"] = style if color: params["color"] = color if industry: params["industry"] = industry response = requests.get(url, headers=headers, params=params) if response.status_code != 200: raise Exception(f"调用失败: {response.text}") return response.text