Skip to content

Get past time from the Time MCP server #2710

@saroad2

Description

@saroad2

Is your feature request related to a problem? Please describe.
As part of my work, I need a way to get past time.
For example, one of my customers might ask something like "Which requests were sent in the last 5 hours?"
I need to first fetch the time from 5 hours ago, and then call the tool that can fetch those requests based on a start time and end time.

Describe the solution you'd like
I would like to have a tool called get_time_ago with the following fields:

  • days_ago: int of how many days ago the time should be
  • hours_ago: int of how many hours ago the time should be
  • minutes_ago: int of how many minutes ago the time should be
  • seconds_ago: int of how many second ago the time should be
  • milliseconds_ago: int of how many milliseconds ago the time should

So for example, if I ask the LLM "Give me all the requests from two and a half hours ago", it will call get_time_ago(hours_ago=2, minutes_ago=30)

Describe alternatives you've considered
One possible alternative is that the LLM will call the get_current_time tool and deduce the past time on its own. Meaning, that this capability will be handled in the LLM side instead of the MCP side.
From my experience, LLMs have hard time to calculate time on their own, so if I run the "get_current_time" tool, the LLM might not be able to deduce the new time from the returned string. Having a dedicated tool for that will probably make our lives easier that way.

Additional context
If I will get an OK from the maintainers, I would gladly implement this!
In the implementation, I would probably use the datetime.timedelta class to handle the time differences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions