Content
word 34
A server for creating and editing Microsoft Word documents via MCP.
upload_word_document
上传Word文档到服务器进行处理 参数: - file_url: Word文档的URL地址(支持 .doc, .docx 格式) 返回: - file_id: 文件唯一标识,后续操作时使用此ID 使用示例: upload_word_document(file_url="https://example.com/document.docx")
download_word_document
下载处理完成的Word文档,获取下载链接 参数: - file_id: 文件唯一标识(通过 upload_word_document 或 create_document 获取) 返回: - 文件下载URL 使用示例: download_word_document(file_id="a1b2c3d4")
list_word_documents
列出当前用户所有缓存的Word文档 返回: - 文件列表,包含 file_id 和文件信息 使用示例: list_word_documents()
No parameters required
delete_word_document
删除指定的Word文档 参数: - file_id: 要删除的文件ID 返回: - 删除结果 使用示例: delete_word_document(file_id="a1b2c3d4")
create_document
创建新的Word文档 参数: - filename: 文件名 - title: 文档标题(可选) - author: 作者(可选) 返回: - file_id: 新建文件的唯一标识 使用示例: create_document(filename="my_document.docx", title="My Document", author="John Doe")
get_document_info
获取Word文档的元数据信息 参数: - file_id: 文件ID 返回: - JSON格式的文档属性(标题、作者、创建日期等) 使用示例: get_document_info(file_id="a1b2c3d4")
get_document_text
提取Word文档的所有文本内容 参数: - file_id: 文件ID 返回: - 文档的纯文本内容 使用示例: get_document_text(file_id="a1b2c3d4")
get_document_outline
获取Word文档的结构大纲 参数: - file_id: 文件ID 返回: - JSON格式的文档结构(段落、标题、表格等) 使用示例: get_document_outline(file_id="a1b2c3d4")
find_text_in_document
在文档中查找指定文本 参数: - file_id: 文件ID - text_to_find: 要查找的文本 - match_case: 是否区分大小写(默认True) - whole_word: 是否全字匹配(默认False) 返回: - 查找结果列表 使用示例: find_text_in_document(file_id="a1b2c3d4", text_to_find="重要", match_case=False)
search_and_replace
在文档中搜索并替换文本 参数: - file_id: 文件ID - find_text: 要查找的文本 - replace_text: 替换为的文本 返回: - 替换结果 使用示例: search_and_replace(file_id="a1b2c3d4", find_text="旧文本", replace_text="新文本")
add_paragraph
向文档添加段落 参数: - file_id: 文件ID - text: 段落文本 - style: 段落样式名称(可选) - font_name: 字体名称(如 'Arial') - font_size: 字体大小(磅) - bold: 是否加粗 - italic: 是否斜体 - color: 文本颜色(十六进制,如 '000000') 返回: - 操作结果 使用示例: add_paragraph(file_id="a1b2c3d4", text="这是一个段落", bold=True, font_size=12)
add_heading
向文档添加标题 参数: - file_id: 文件ID - text: 标题文本 - level: 标题级别(1-9) - font_name: 字体名称 - font_size: 字体大小(磅) - bold: 是否加粗 - italic: 是否斜体 - border_bottom: 是否添加底部边框 返回: - 操作结果 使用示例: add_heading(file_id="a1b2c3d4", text="第一章", level=1, border_bottom=True)
insert_header_near_text
在指定文本或段落附近插入标题 参数: - file_id: 文件ID - target_text: 目标文本(与target_paragraph_index二选一) - header_title: 标题文本 - position: 位置('before' 或 'after') - header_style: 标题样式(默认 'Heading 1') - target_paragraph_index: 目标段落索引 返回: - 操作结果 使用示例: insert_header_near_text(file_id="a1b2c3d4", target_text="第一节", header_title="新标题", position="after")
insert_line_or_paragraph_near_text
在指定文本或段落附近插入段落 参数: - file_id: 文件ID - target_text: 目标文本 - line_text: 要插入的文本 - position: 位置('before' 或 'after') - line_style: 段落样式 - target_paragraph_index: 目标段落索引 返回: - 操作结果 使用示例: insert_line_or_paragraph_near_text(file_id="a1b2c3d4", target_text="第一段", line_text="新段落", position="after")
insert_numbered_list_near_text
在指定文本或段落附近插入列表 参数: - file_id: 文件ID - target_text: 目标文本 - list_items: 列表项(字符串列表) - position: 位置('before' 或 'after') - target_paragraph_index: 目标段落索引 - bullet_type: 列表类型('bullet' 或 'number') 返回: - 操作结果 使用示例: insert_numbered_list_near_text(file_id="a1b2c3d4", target_text="目录", list_items=["项目1", "项目2"], bullet_type="number")
add_table
向文档添加表格 参数: - file_id: 文件ID - rows: 行数 - cols: 列数 - data: 表格数据(二维列表,可选) 返回: - 操作结果 使用示例: add_table(file_id="a1b2c3d4", rows=3, cols=3, data=[["A1","B1","C1"], ["A2","B2","C2"]])
format_table
格式化表格 参数: - file_id: 文件ID - table_index: 表格索引(从0开始) - border_style: 边框样式 - has_header_row: 是否有表头行 - shading: 阴影颜色列表(十六进制) 返回: - 操作结果 使用示例: format_table(file_id="a1b2c3d4", table_index=0, has_header_row=True)
set_table_cell_shading
设置表格单元格阴影 参数: - file_id: 文件ID - table_index: 表格索引 - row_index: 行索引 - col_index: 列索引 - fill_color: 填充颜色(十六进制) - pattern: 填充模式(默认 'clear') 返回: - 操作结果 使用示例: set_table_cell_shading(file_id="a1b2c3d4", table_index=0, row_index=0, col_index=0, fill_color="CCCCCC")
merge_table_cells
合并表格单元格 参数: - file_id: 文件ID - table_index: 表格索引 - start_row: 起始行 - start_col: 起始列 - end_row: 结束行 - end_col: 结束列 返回: - 操作结果 使用示例: merge_table_cells(file_id="a1b2c3d4", table_index=0, start_row=0, start_col=0, end_row=0, end_col=2)
set_table_column_width
设置表格列宽 参数: - file_id: 文件ID - table_index: 表格索引 - col_index: 列索引 - width: 宽度值 - width_type: 宽度类型('points' 或 'inches') 返回: - 操作结果 使用示例: set_table_column_width(file_id="a1b2c3d4", table_index=0, col_index=0, width=2.0, width_type="inches")
add_picture
向文档添加图片 参数: - file_id: 文件ID - image_path: 图片路径或URL - width: 图片宽度(英寸,可选) 返回: - 操作结果 使用示例: add_picture(file_id="a1b2c3d4", image_path="/path/to/image.png", width=4.0)
add_page_break
向文档添加分页符 参数: - file_id: 文件ID 返回: - 操作结果 使用示例: add_page_break(file_id="a1b2c3d4")
format_text
格式化段落中的特定文本范围 参数: - file_id: 文件ID - paragraph_index: 段落索引 - start_pos: 起始位置 - end_pos: 结束位置 - font_name: 字体名称 - font_size: 字体大小 - bold: 是否加粗 - italic: 是否斜体 - underline: 是否下划线 - color: 文本颜色(十六进制) 返回: - 操作结果 使用示例: format_text(file_id="a1b2c3d4", paragraph_index=0, start_pos=0, end_pos=10, bold=True, color="FF0000")
create_custom_style
创建自定义样式 参数: - file_id: 文件ID - style_name: 样式名称 - base_style: 基础样式 - font_name: 字体名称 - font_size: 字体大小 - bold: 是否加粗 - italic: 是否斜体 - color: 文本颜色 返回: - 操作结果 使用示例: create_custom_style(file_id="a1b2c3d4", style_name="MyStyle", font_size=14, bold=True)
delete_paragraph
删除指定段落 参数: - file_id: 文件ID - paragraph_index: 段落索引 返回: - 操作结果 使用示例: delete_paragraph(file_id="a1b2c3d4", paragraph_index=5)
get_paragraph_text_from_document
获取指定段落的文本 参数: - file_id: 文件ID - paragraph_index: 段落索引 返回: - 段落文本 使用示例: get_paragraph_text_from_document(file_id="a1b2c3d4", paragraph_index=0)
replace_paragraph_block_below_header
替换标题下方的段落块 参数: - file_id: 文件ID - header_text: 标题文本 - new_paragraphs: 新段落列表 - detect_block_end_fn: 块结束检测函数(可选) 返回: - 操作结果 使用示例: replace_paragraph_block_below_header(file_id="a1b2c3d4", header_text="第一章", new_paragraphs=["新段落1", "新段落2"])
replace_block_between_manual_anchors
替换两个锚点之间的内容 参数: - file_id: 文件ID - start_anchor_text: 起始锚点文本 - new_paragraphs: 新段落列表 - end_anchor_text: 结束锚点文本(可选) - match_fn: 匹配函数(可选) - new_paragraph_style: 新段落样式(可选) 返回: - 操作结果 使用示例: replace_block_between_manual_anchors(file_id="a1b2c3d4", start_anchor_text="开始", end_anchor_text="结束", new_paragraphs=["新内容"])
add_footnote_to_document
向指定段落添加脚注 参数: - file_id: 文件ID - paragraph_index: 段落索引 - footnote_text: 脚注文本 返回: - 操作结果 使用示例: add_footnote_to_document(file_id="a1b2c3d4", paragraph_index=0, footnote_text="这是一个脚注")
get_all_comments
获取文档中的所有批注 参数: - file_id: 文件ID 返回: - 批注列表 使用示例: get_all_comments(file_id="a1b2c3d4")
get_comments_by_author
获取指定作者的批注 参数: - file_id: 文件ID - author: 作者名称 返回: - 批注列表 使用示例: get_comments_by_author(file_id="a1b2c3d4", author="张三")
protect_document
为文档添加密码保护 参数: - file_id: 文件ID - password: 密码 返回: - 操作结果 使用示例: protect_document(file_id="a1b2c3d4", password="mypassword")
unprotect_document
移除文档的密码保护 参数: - file_id: 文件ID - password: 密码 返回: - 操作结果 使用示例: unprotect_document(file_id="a1b2c3d4", password="mypassword")
convert_to_pdf
将Word文档转换为PDF格式 参数: - file_id: 文件ID - output_filename: 输出PDF文件名(可选,默认为原文件名.pdf) 返回: - 新PDF文件的file_id和下载信息 注意: - 需要安装 python-docx2pdf 或 LibreOffice - 转换后的PDF会作为新文件注册,原Word文档保持不变 使用示例: convert_to_pdf(file_id="a1b2c3d4", output_filename="report.pdf")