Skip to content

[Feature Request]: Add resources and prompts/prompt templates to time server #404

@crivetimihai

Description

@crivetimihai

Add Resources and Prompts to Time Server

Overview

This document outlines the resources and prompt templates to be added to the fast-time-server MCP implementation.

Resources to Add

1. Timezone Information Resource

URI: timezone://info
Description: Static resource providing comprehensive timezone information
Content Structure:

{
  "timezones": [
    {
      "id": "America/New_York",
      "name": "Eastern Time",
      "offset": "-05:00",
      "dst": true,
      "abbreviation": "EST/EDT",
      "major_cities": ["New York", "Toronto", "Montreal"],
      "population": 141000000
    },
    {
      "id": "Europe/London",
      "name": "Greenwich Mean Time",
      "offset": "+00:00",
      "dst": true,
      "abbreviation": "GMT/BST",
      "major_cities": ["London", "Dublin", "Lisbon"],
      "population": 67000000
    },
    {
      "id": "Asia/Tokyo",
      "name": "Japan Standard Time",
      "offset": "+09:00",
      "dst": false,
      "abbreviation": "JST",
      "major_cities": ["Tokyo", "Osaka", "Yokohama"],
      "population": 127000000
    }
  ],
  "timezone_groups": {
    "us_timezones": ["America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles"],
    "europe_timezones": ["Europe/London", "Europe/Paris", "Europe/Berlin", "Europe/Moscow"],
    "asia_timezones": ["Asia/Tokyo", "Asia/Shanghai", "Asia/Singapore", "Asia/Dubai"]
  }
}

2. Current World Times Resource

URI: time://current/world
Description: Dynamic resource showing current time in major cities
Content Example:

{
  "last_updated": "2024-01-15T12:00:00Z",
  "times": {
    "New York": "2024-01-15 07:00:00 EST",
    "London": "2024-01-15 12:00:00 GMT",
    "Paris": "2024-01-15 13:00:00 CET",
    "Tokyo": "2024-01-15 21:00:00 JST",
    "Sydney": "2024-01-15 23:00:00 AEDT",
    "Dubai": "2024-01-15 16:00:00 GST",
    "Los Angeles": "2024-01-15 04:00:00 PST"
  }
}

3. Time Format Examples Resource

URI: time://formats
Description: Examples of supported time formats for parsing and display
Content:

{
  "input_formats": [
    "2006-01-02 15:04:05",
    "2006-01-02T15:04:05Z",
    "2006-01-02T15:04:05-07:00",
    "Jan 2, 2006 3:04 PM",
    "Monday, January 2, 2006",
    "02/01/2006 15:04"
  ],
  "output_formats": {
    "iso8601": "2006-01-02T15:04:05Z07:00",
    "rfc3339": "2006-01-02T15:04:05Z",
    "rfc822": "Mon, 02 Jan 2006 15:04:05 MST",
    "unix": "1136214245",
    "human_readable": "Monday, January 2, 2006 at 3:04 PM",
    "short": "1/2/06 3:04 PM"
  },
  "examples": [
    {
      "format": "ISO 8601",
      "example": "2024-01-15T14:30:00-05:00",
      "description": "Standard international format with timezone"
    },
    {
      "format": "Unix Timestamp",
      "example": "1705339800",
      "description": "Seconds since January 1, 1970 UTC"
    }
  ]
}

4. Business Hours Resource

URI: time://business-hours
Description: Standard business hours across different regions
Content:

{
  "regions": {
    "north_america": {
      "standard_hours": "9:00 AM - 5:00 PM",
      "lunch_break": "12:00 PM - 1:00 PM",
      "working_days": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
    },
    "europe": {
      "standard_hours": "9:00 AM - 6:00 PM",
      "lunch_break": "1:00 PM - 2:00 PM",
      "working_days": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
    },
    "asia_pacific": {
      "standard_hours": "9:00 AM - 6:00 PM",
      "lunch_break": "12:00 PM - 1:00 PM",
      "working_days": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
    }
  },
  "holidays": {
    "global": ["New Year's Day", "Christmas Day"],
    "regional": {
      "us": ["Independence Day", "Thanksgiving"],
      "uk": ["Boxing Day", "Spring Bank Holiday"],
      "japan": ["Golden Week", "Obon"]
    }
  }
}

Prompt Templates to Add

1. Time Zone Comparison Prompt

Name: compare_timezones
Description: Compare current times across multiple time zones
Arguments:

  • timezones: List of timezone IDs to compare
  • reference_time: Optional reference time (defaults to now)

Template:

Compare the current time across these time zones: {{timezones}}.
{{#if reference_time}}
Use {{reference_time}} as the reference time.
{{else}}
Use the current system time.
{{/if}}

Show:
1. The current time in each timezone
2. The time difference from the first timezone
3. Whether it's business hours (9 AM - 5 PM)
4. The day of the week

2. Meeting Scheduler Prompt

Name: schedule_meeting
Description: Find optimal meeting time across multiple time zones
Arguments:

  • participants: List of participant locations/timezones
  • duration: Meeting duration in minutes
  • preferred_hours: Preferred time range (e.g., "9 AM - 5 PM")
  • date_range: Date range to consider

Template:

Find the best meeting time for participants in these locations:
{{#each participants}}
- {{this}}
{{/each}}

Meeting details:
- Duration: {{duration}} minutes
- Preferred hours: {{preferred_hours}} local time for each participant
- Date range: {{date_range}}

Consider:
1. Business hours overlap across all timezones
2. Avoid very early morning (before 8 AM) or late evening (after 7 PM)
3. Account for any timezone transitions (DST changes)
4. Suggest top 3 meeting times with pros/cons for each

3. Time Zone Converter Prompt

Name: convert_time_detailed
Description: Convert time with detailed context
Arguments:

  • time: Time to convert
  • from_timezone: Source timezone
  • to_timezones: List of target timezones
  • include_context: Whether to include contextual information

Template:

Convert {{time}} from {{from_timezone}} to:
{{#each to_timezones}}
- {{this}}
{{/each}}

{{#if include_context}}
Also provide:
1. Day of week in each timezone
2. Whether it's a business day
3. Any relevant holidays or observances
4. Time until/since this moment (relative to now)
5. Sunrise/sunset times if significantly different days
{{/if}}

4. Time Travel Calculator Prompt

Name: travel_time_adjustment
Description: Calculate time differences for travel planning
Arguments:

  • departure_city: Departure city/timezone
  • departure_time: Local departure time
  • arrival_city: Arrival city/timezone
  • flight_duration: Flight duration in hours and minutes

Template:

Calculate arrival time for travel:
- Departing: {{departure_city}} at {{departure_time}} local time
- Flying to: {{arrival_city}}
- Flight duration: {{flight_duration}}

Provide:
1. Arrival time in destination timezone
2. Arrival time in departure timezone
3. Total time zone change
4. Jet lag impact (hours ahead/behind)
5. Recommended adjustment tips

5. Deadline Tracker Prompt

Name: deadline_tracker
Description: Track deadline across multiple timezones
Arguments:

  • deadline: The deadline time and timezone
  • tracked_timezones: Timezones to track the deadline in
  • reminder_intervals: When to send reminders (e.g., "1 day", "1 hour")

Template:

Track this deadline: {{deadline}}

Show the deadline in these timezones:
{{#each tracked_timezones}}
- {{this}}
{{/each}}

Calculate:
1. Exact deadline time in each timezone
2. Current time remaining from now
3. Reminder times: {{reminder_intervals}} before deadline
4. Whether deadline falls during business hours
5. Any timezone transitions before the deadline

6. Global Team Sync Prompt

Name: team_sync
Description: Coordinate activities across distributed team
Arguments:

  • team_locations: Map of team member names to their timezones
  • activity: Activity to coordinate (e.g., "standup meeting", "deployment")
  • constraints: Any specific constraints

Template:

Coordinate {{activity}} for team members:
{{#each team_locations}}
- {{@key}} in {{this}}
{{/each}}

{{#if constraints}}
Constraints: {{constraints}}
{{/if}}

Find:
1. Overlapping working hours for all team members
2. Optimal time that minimizes inconvenience
3. Alternative times if no perfect overlap exists
4. Rotation schedule if activity is recurring
5. Time zone equity analysis (who compromises most)

Implementation Notes

Resource Implementation

Resources should be implemented using the MCP-Go SDK's resource handler pattern:

// Example resource handler
func handleTimezoneInfo(ctx context.Context, uri string) (*mcp.ResourceResponse, error) {
    // Load or generate resource content
    content := loadTimezoneData()
    return &mcp.ResourceResponse{
        Uri:      uri,
        MimeType: "application/json",
        Content:  content,
    }, nil
}

Prompt Implementation

Prompts should follow the MCP prompt template pattern:

// Example prompt registration
s.AddPrompt(mcp.Prompt{
    Name:        "compare_timezones",
    Description: "Compare current times across multiple time zones",
    Arguments: []mcp.PromptArgument{
        {
            Name:        "timezones",
            Description: "List of timezone IDs to compare",
            Required:    true,
        },
        {
            Name:        "reference_time",
            Description: "Optional reference time",
            Required:    false,
        },
    },
})

REST API Extensions

When running in dual or rest mode, add corresponding REST endpoints:

  • GET /api/v1/resources - List available resources
  • GET /api/v1/resources/{uri} - Get specific resource content
  • GET /api/v1/prompts - List available prompts
  • POST /api/v1/prompts/{name}/execute - Execute a prompt with arguments

Testing Requirements

  1. Unit tests for each resource handler
  2. Unit tests for each prompt template
  3. Integration tests for REST endpoints
  4. Validation of resource content structure
  5. Prompt argument validation tests

Documentation Updates

  1. Update README with resource and prompt examples
  2. Add OpenAPI specifications for new endpoints
  3. Include usage examples in Go and curl
  4. Document any caching strategies for resources

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgoGo programmingtriageIssues / Features awaiting triage

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions