Back to MCP directory
publicPublicdnsLocal runtime

simple_agent_api_tool

一个Langflow的日期时间工具组件,提供带时区支持的当前日期时间和周数获取功能。

article

README

🚀 日期时间工具组件用于Langflow

本组件是一个简单的自定义组件,为Langflow提供了带时区支持的日期时间相关工具,能有效满足用户在不同时区下对日期时间的获取需求。

🚀 快速开始

本组件旨在为Langflow提供日期时间工具,使用前需完成安装步骤,安装完成后即可使用相关功能。

✨ 主要特性

  • 支持获取当前日期和时间,并带有时区支持。
  • 支持获取当前周数,并带有时区支持。
  • 具备简单错误处理功能,可针对无效时区进行处理。

📦 安装指南

  1. 复制langflow_component.py文件中的内容。
  2. 打开Langflow。
  3. 点击“+自定义组件”。
  4. 将代码粘贴到编辑器中。
  5. 点击“检查并保存”。

💻 使用示例

基础用法

获取当前日期时间

datetime_tools = DateTimeTools()
current_time = datetime_tools.get_current_datetime("America/New_York")
# 返回值: "2024-03-20T10:30:00-04:00"

获取周数

datetime_tools = DateTimeTools()
week_num = datetime_tools.get_week_number("America/New_York")
# 返回值: 12

📚 详细文档

时区支持

该组件支持IANA时间区数据库中的所有时区。常见的时区标识符包括:

  • UTC
  • America/New_York
  • America/Los_Angeles
  • Europe/London
  • Asia/Tokyo
  • Australia/Sydney

要获取完整的时区列表,请参考IANA时间区数据库

错误处理

  • 对于无效的时区,将返回错误消息。
  • 周数将返回 -1(当出现无效时区或错误时)。

依赖项

此组件需要以下Python包:

  • pytz
  • datetime(内置模块)

请确保在您的Langflow环境中已安装这些包。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client