Skip to content

Commit 60eb7c2

Browse files
authored
feat: add day of week to time result (#2580)
1 parent d59cb83 commit 60eb7c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/time/src/mcp_server_time/server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class TimeTools(str, Enum):
2222
class TimeResult(BaseModel):
2323
timezone: str
2424
datetime: str
25+
day_of_week: str
2526
is_dst: bool
2627

2728

@@ -64,6 +65,7 @@ def get_current_time(self, timezone_name: str) -> TimeResult:
6465
return TimeResult(
6566
timezone=timezone_name,
6667
datetime=current_time.isoformat(timespec="seconds"),
68+
day_of_week=current_time.strftime("%A"),
6769
is_dst=bool(current_time.dst()),
6870
)
6971

@@ -104,11 +106,13 @@ def convert_time(
104106
source=TimeResult(
105107
timezone=source_tz,
106108
datetime=source_time.isoformat(timespec="seconds"),
109+
day_of_week=source_time.strftime("%A"),
107110
is_dst=bool(source_time.dst()),
108111
),
109112
target=TimeResult(
110113
timezone=target_tz,
111114
datetime=target_time.isoformat(timespec="seconds"),
115+
day_of_week=target_time.strftime("%A"),
112116
is_dst=bool(target_time.dst()),
113117
),
114118
time_difference=time_diff_str,

0 commit comments

Comments
 (0)