Skip to main content
Glama
File1979

Document Tools

by File1979

Document Tools

一个实现多种文档相关工具的 Python 包,用于转换和处理文档格式。这些工具通过 MCP server 接口暴露,以便与人工智能助手无缝集成。

设置

# 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 server 中:

mcp.tool()(my_function)

工具描述应:

  • 以一行摘要开头

  • 提供功能的详细说明

  • 说明何时使用(以及何时不使用)该工具

  • 包含预期输入/输出的使用示例

使用 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

Related MCP Connectors

Related MCP Servers