文档工具
一个Python包,实现了各种与文档相关的工具,用于转换和处理文档格式。这些工具通过MCP服务器接口公开,以便与AI助手无缝集成。
设置```bash
Create a virtual env and activate it
uv venv
source .venv/bin/activate
Install the package in development mode
uv pip install -e .
## 跑步```bash
# Start the MCP server
uv run main.py
测试```bash
Run all tests
uv run pytest
## 发展
### 工具定义
工具被定义为Python函数,并在MCP服务器上注册:```python
mcp.tool()(my_function)
工具说明应:
- 以一行摘要开始
- 提供详细的功能说明
- 解释何时使用(和不使用)该工具
- 包括预期输入/输出的使用示例
使用 Field 来自pydantic的参数描述:```python
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
```
