mcpField
D
data-query

data-query

github.com/vikiboss生产力4772 次安装34 周前更新
代码仓库

关于 data-query

Data Query Skill 通过 API 查询汇率、农历日期、历史事件、百科内容、油价、金价及化学元素信息,适用于回答日常资料查询的助手或小型工具。

主要功能

  1. 01查询货币汇率
  2. 02转换农历日期
  3. 03查询历史上的今天
  4. 04搜索中文百科
  5. 05查询油价、金价与元素信息

适用场景

  1. 01构建货币换算机器人
  2. 02在日历组件中显示农历
  3. 03发送历史事件提醒
  4. 04查询油价或元素详情

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/vikiboss/60s-skills --skill data-query

安装后在 Claude Code 中输入/data-query确认已加载。

详细介绍

数据查询技能

查询各种数据和信息,包括汇率、日历、历史、百科和价格。

可用查询

  1. 汇率 - 货币兑换汇率
  2. 农历 - 公历与中国农历的转换
  3. 历史上的今天 - 历史事件
  4. 百科(Baike) - 搜索中文百科
  5. 燃油价格 - 中国汽油/柴油价格
  6. 黄金价格 - 当前黄金价格
  7. 化学元素 - 元素信息

API 端点

查询类型端点方法
汇率/v2/exchange-rateGET
农历/v2/lunarGET
历史/v2/today-in-historyGET
百科/v2/baikeGET
燃油价格/v2/fuel-priceGET
黄金价格/v2/gold-priceGET
化学/v2/chemicalGET

快速示例

汇率
import requests

# Get exchange rate
params = {'from': 'USD', 'to': 'CNY'}
response = requests.get('https://60s.viki.moe/v2/exchange-rate', params=params)
rate = response.json()

print(f"💱 1 {rate['from']} = {rate['rate']} {rate['to']}")
print(f"更新时间:{rate['update_time']}")
农历
# Get today's lunar date
response = requests.get('https://60s.viki.moe/v2/lunar')
lunar = response.json()

print(f"📅 公历:{lunar['solar_date']}")
print(f"🏮 农历:{lunar['lunar_date']}")
print(f"🐲 生肖:{lunar['zodiac']}")
print(f"🌾 节气:{lunar['solar_term']}")

# Specific date
params = {'date': '2024-01-15'}
response = requests.get('https://60s.viki.moe/v2/lunar', params=params)
历史上的今天
# Get today's historical events
response = requests.get('https://60s.viki.moe/v2/today-in-history')
history = response.json()

print(f"📜 历史上的今天 ({history['date']})")
for event in history['events'][:5]:
    print(f"{event['year']}年:{event['title']}")

# Specific date
params = {'month': 1, 'day': 15}
response = requests.get('https://60s.viki.moe/v2/today-in-history', params=params)
百科搜索
# Search encyclopedia
params = {'keyword': 'Python编程'}
response = requests.get('https://60s.viki.moe/v2/baike', params=params)
result = response.json()

print(f"📖 {result['title']}")
print(f"📝 {result['summary']}")
print(f"🔗 {result['url']}")
燃油价格
# Get fuel prices
params = {'province': '北京'}
response = requests.get('https://60s.viki.moe/v2/fuel-price', params=params)
prices = response.json()

print(f"⛽ {prices['province']} 油价")
print(f"92号汽油:{prices['92号汽油']} 元/升")
print(f"95号汽油:{prices['95号汽油']} 元/升")
print(f"98号汽油:{prices['98号汽油']} 元/升")
print(f"0号柴油:{prices['0号柴油']} 元/升")
黄金价格
# Get current gold prices
response = requests.get('https://60s.viki.moe/v2/gold-price')
gold = response.json()

print(f"💰 黄金价格")
print(f"国际金价:{gold['国际金价']} 美元/盎司")
print(f"国内金价:{gold['国内金价']} 元/克")
print(f"更新时间:{gold['update_time']}")
化学元素
# Search chemical element
params = {'query': 'H'}  # Can be symbol, name, or atomic number
response = requests.get('https://60s.viki.moe/v2/chemical', params=params)
element = response.json()

print(f"⚛️ {element['name']} ({element['symbol']})")
print(f"原子序数:{element['atomic_number']}")
print(f"原子量:{element['atomic_mass']}")
print(f"元素类别:{element['category']}")

使用场景

货币转换机器人
def convert_currency(amount, from_currency, to_currency):
    params = {'from': from_currency, 'to': to_currency}
    response = requests.get('https://60s.viki.moe/v2/exchange-rate', params=params)
    rate = response.json()
    
    converted = amount * float(rate['rate'])
    return f"{amount} {from_currency} = {converted:.2f} {to_currency}"

# Usage
print(convert_currency(100, 'USD', 'CNY'))  # 100 USD = 725.50 CNY
历史事件提醒
def get_today_history():
    response = requests.get('https://60s.viki.moe/v2/today-in-history')
    history = response.json()
    
    message = f"📜 历史上的今天 ({history['date']})\n\n"
    for event in history['events'][:3]:
        message += f"· {event['year']}年:{event['title']}\n"
    
    return message
农历日历小组件
def get_lunar_info():
    response = requests.get('https://60s.viki.moe/v2/lunar')
    lunar = response.json()
    
    return f"""
📅 今日日历

公历:{lunar['solar_date']} {lunar['weekday']}
农历:{lunar['lunar_date']}
生肖:{lunar['zodiac']}
节气:{lunar['solar_term'] or '无'}
    """

交互示例

用户:“美元兑人民币汇率是多少?”
params = {'from': 'USD', 'to': 'CNY'}
response = requests.get('https://60s.viki.moe/v2/exchange-rate', params=params)
rate = response.json()
print(f"💱 1 美元 = {rate['rate']} 人民币")
用户:“今天农历是几月几号?”
lunar = requests.get('https://60s.viki.moe/v2/lunar').json()
print(f"🏮 今天是农历 {lunar['lunar_date']}")
print(f"🐲 生肖:{lunar['zodiac']}")
用户:“查询一下氢元素的信息”
params = {'query': '氢'}
element = requests.get('https://60s.viki.moe/v2/chemical', params=params).json()
print(f"⚛️ {element['name']} (H)")
print(f"原子序数:{element['atomic_number']}")
print(f"元素类别:{element['category']}")

相关资源

评论

支持 Markdown