forked from trpc-group/trpc-agent-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.py
More file actions
34 lines (27 loc) · 1.03 KB
/
Copy pathtools.py
File metadata and controls
34 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Tencent is pleased to support the open source community by making tRPC-Agent-Python available.
#
# Copyright (C) 2026 Tencent. All rights reserved.
#
# tRPC-Agent-Python is licensed under Apache-2.0.
""" Tools for the agent. """
import datetime
from mcp import StdioServerParameters
from trpc_agent_sdk.tools import MCPToolset
from trpc_agent_sdk.tools.mcp_tool import StdioConnectionParams
# 1. (可选)安装uv: curl -LsSf https://astral.sh/uv/install.sh | sh
# 2. 安装mcp: uv pip install duckduckgo-mcp-server
class DuckDuckGoSearchMCP(MCPToolset):
"""DuckDuckGoSearchMCP 搜索工具集"""
def __init__(self):
super().__init__()
self._connection_params = StdioConnectionParams(
server_params=StdioServerParameters(
command="uvx",
args=["duckduckgo-mcp-server"],
env=None,
),
timeout=10.0,
)
def get_current_date():
"""get the current date, format: YYYY-MM-DD"""
return datetime.datetime.now().strftime("%Y-%m-%d")