# doc_agent **Repository Path**: yujinlazyf/doc_agent ## Basic Information - **Project Name**: doc_agent - **Description**: 本次开发本地文档 + 天气综合 AI 智能体,基于 MCP 模型上下文协议实现工具调度,内置 3 个独立可调用工具: read_file 工具: write_summary 工具 query_weather 工具 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-20 - **Last Updated**: 2026-06-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Doc Agent An intelligent document processing agent powered by LLM with MCP (Model Context Protocol) support. ## Overview Doc Agent is an AI-powered document agent system that combines LLM decision-making capabilities with file operations and weather API tools. It uses the Model Context Protocol to orchestrate various tools and provide intelligent responses to user queries. ## Features - **LLM-Powered Decision Making**: Uses large language models to analyze queries and decide appropriate actions - **File Operations**: Read and write files with summary generation capabilities - **Weather API Integration**: Query weather information by city name or geographic coordinates - **MCP Server**: Implements Model Context Protocol for tool orchestration ## Project Structure ``` doc_agent/ ├── agent_main.py # Main agent logic with LLM decision functions ├── mcp_server.py # MCP server implementation and tool definitions ├── tools/ │ ├── file_reader.py # File reading functionality │ ├── file_writer.py # File writing and summary generation │ └── weather_api.py # Weather query API (supports China and international) ├── system_prompt.md # System prompts for LLM └── doc_summary.txt # Document summaries storage ``` ## Installation ```bash # Install dependencies pip install -r requirements.txt ``` ## Usage ### Starting the Agent ```python from agent_main import agent_run # Run the agent agent_run() ``` ### Using MCP Tools ```python from mcp_server import mcp_call_tool, list_available_tools # List available tools tools = list_available_tools() print(tools) # Call a specific tool result = mcp_call_tool("read_file", {"file_path": "example.txt"}) ``` ### Tool Examples **Read File:** ```python from tools.file_reader import read_file content = read_file("path/to/file.txt") ``` **Write Summary:** ```python from tools.file_writer import write_summary write_summary("output.txt", "Summary content here") ``` **Query Weather:** ```python from tools.weather_api import query_cn_weather, query_weather # Query by city name (China) weather = query_cn_weather("北京") # Query by coordinates weather = query_weather(city_lat=39.9042, city_lon=116.4074) ``` ## Available Tools | Tool | Description | |------|-------------| | read_file | Read content from a specified file | | write_summary | Write summary content to a file | | query_cn_weather | Query weather by Chinese city name | | query_weather | Query weather by latitude and longitude | ## Dependencies - Python 3.10+ - pydantic (for data validation) - requests (for API calls) - llm SDK (for LLM integration) ## License MIT License ## Contributing Contributions are welcome! Please submit pull requests or open issues for any improvements.