文档工具
一个 Python 包,实现了各种用于转换和处理文档格式的文档相关工具。这些工具通过 MCP 服务器接口暴露,以便与 AI 助手无缝集成。
设置
# Create a virtual env and activate it
uv venv
source .venv/bin/activate
# Install the package in development mode
uv pip install -e .
Related MCP server: Document Tools
运行
# Start the MCP server
uv run main.py
测试
# Run all tests
uv run pytest
开发
工具定义
工具被定义为 Python 函数,并注册到 MCP 服务器:
工具说明应:
以一句话摘要开头
提供功能的详细说明
解释何时使用(以及何时不使用)该工具
包含带有预期输入/输出的用法示例
使用 pydantic 中的 Field 来描述参数:
from pydantic import Field
def my_tool(
param1: str = Field(description="Detailed description of this parameter"),
param2: int = Field(description="Explain what this parameter does")
) -> ReturnType:
"""Comprehensive docstring here"""
# Implementation