Skip to main content
Glama

时间戳转换

timestamp_convert
Read-only

在秒级 Unix 时间戳与日期时间之间互相转换,可指定时区(默认 Asia/Shanghai)。用于把日志或 API 返回的时间戳转成可读日期,或把某日期转成时间戳做比较与计算。典型输入:时间戳 1700000000 或日期 2026-01-01。数据源:本地计算(JS Date,零外部依赖)。Example: {"mode":"to_date","value":1700000000,"timezone":"Asia/Shanghai"}

Input Schema

NameRequiredDescriptionDefault
modeNo转换方向:to_date 时间戳转日期 / to_ts 日期转时间戳,默认 to_dateto_date
valueYes秒级时间戳(数字,to_date 时)或日期字符串 YYYY-MM-DD(to_ts 时),如 1700000000 或 2026-01-01
timezoneNoIANA 时区名,默认 Asia/ShanghaiAsia/Shanghai

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, so safety is covered. The description adds useful context beyond that: the computation is local (JS Date, zero external dependencies) and the timezone defaults to Asia/Shanghai. It doesn't describe the output string format, which is the remaining gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded in the first sentence and follows with usage and data source in a compact block. The appended example object duplicates the schema's examples array, which is minor waste but not harmful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With read-only annotations, a fully described 3-parameter schema, and no output schema, the description covers purpose, direction, timezone default, and computation locality. The only missing piece is what the returned date/string looks like, which is minor for a simple conversion.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the enum for mode, value format, and the IANA timezone default are already fully documented in the schema. The description's '典型输入:时间戳 1700000000 或日期 2026-01-01' repeats what the schema says rather than adding new format or edge-case meaning; baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific bidirectional verb+resource: converting between second-level Unix timestamps and datetimes, with a named timezone parameter. It is clearly distinguishable from siblings such as time_now, world_time, and unit_convert, which do different jobs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete use cases ('把日志或 API 返回的时间戳转成可读日期' and '把某日期转成时间戳做比较与计算'), so the agent knows when this tool is appropriate. It never explicitly names alternatives or exclusions (e.g., vs. time_now), which keeps it short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.