Skip to main content
Glama
ChronulusAI

Chronulus MCP Server

Official

reuse_forecasting_agent_and_get_forecast

Generate forecasts for values between 0 and 1 using a pre-configured Chronulus AI agent, providing predictions and explanations without requiring historical data.

Instructions

This tool creates a NormalizedForecaster agent with your session and input data model and then provides a forecast input data to the agent and returns the prediction data and text explanation from the agent.

When to use this tool:

  • Use this tool to request a forecast from Chronulus

  • This tool is specifically made to forecast values between 0 and 1 and does not require historical data

  • The prediction can be thought of as seasonal weights, probabilities, or shares of something as in the decimal representation of a percent

How to use this tool:

  • First, make sure you have a session_id for the forecasting or prediction use case.

  • Next, think about the features / characteristics most suitable for producing the requested forecast and then create an input_data_model that corresponds to the input_data you will provide for the thing being forecasted.

  • Remember to pass all relevant information to Chronulus including text and images provided by the user.

  • If a user gives you files about a thing you are forecasting or predicting, you should pass these as inputs to the agent using one of the following types:

    • ImageFromFile

    • List[ImageFromFile]

    • TextFromFile

    • List[TextFromFile]

    • PdfFromFile

    • List[PdfFromFile]

  • If you have a large amount of text (over 500 words) to pass to the agent, you should use the Text or List[Text] field types

  • Finally, add information about the forecasting horizon and time scale requested by the user

  • Assume the dates and datetimes in the prediction results are already converted to the appropriate local timezone if location is a factor in the use case. So do not try to convert from UTC to local time when plotting.

  • When plotting the predictions, use a Rechart time series with the appropriate axes labeled and with the prediction explanation displayed as a caption below the plot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe agent_id for the forecasting or prediction use case and previously defined input_data_model
input_dataYesThe forecast inputs that you will pass to the chronulus agent to make the prediction. The keys of the dict should correspond to the InputField name you provided in input_fields.
forecast_start_dt_strYesThe datetime str in '%Y-%m-%d %H:%M:%S' format of the first value in the forecast horizon.
time_scaleNoThe times scale of the forecast horizon. Valid time scales are 'hours', 'days', and 'weeks'.days
horizon_lenNoThe integer length of the forecast horizon. Eg., 60 if a 60 day forecast was requested.

Implementation Reference

  • The handler function for the 'reuse_forecasting_agent_and_get_forecast' tool. It loads a pre-existing NormalizedForecaster agent using the provided agent_id, validates and processes the input_data, queues a forecast over the specified horizon, retrieves the prediction, and returns a dictionary containing the agent_id, prediction_id, forecast data, and textual explanation.
    async def reuse_forecasting_agent_and_get_forecast(
            agent_id: Annotated[str, Field(description="The agent_id for the forecasting or prediction use case and previously defined input_data_model")],
            input_data: Annotated[Dict[str, Union[str, dict, List[dict]]], Field(
                description="The forecast inputs that you will pass to the chronulus agent to make the prediction. The keys of the dict should correspond to the InputField name you provided in input_fields.")],
            forecast_start_dt_str: Annotated[str, Field(
                description="The datetime str in '%Y-%m-%d %H:%M:%S' format of the first value in the forecast horizon.")],
            time_scale: Annotated[str, Field(
                description="The times scale of the forecast horizon. Valid time scales are 'hours', 'days', and 'weeks'.",
                default="days")],
            horizon_len: Annotated[int, Field(
                description="The integer length of the forecast horizon. Eg., 60 if a 60 day forecast was requested.",
                default=60)],
    ) -> Union[str, Dict[str, Union[dict, str]]]:
        """Queues and retrieves a forecast from Chronulus with a previously created agent_id
    
        This tool provides a forecast input to a previous created Chronulus NormalizedForecaster agent and returns the
        prediction data and text explanation from the agent.
    
        Args:
            agent_id (str): The agent_id for the forecasting or prediction use case and previously defined input_data_model
            input_data (Dict[str, Union[str, dict, List[dict]]]): The forecast inputs that you will pass to the chronulus agent to make the prediction. The keys of the dict should correspond to the InputField name you provided in input_fields.
            forecast_start_dt_str (str): The datetime str in '%Y-%m-%d %H:%M:%S' format of the first value in the forecast horizon."
            time_scale (str): The times scale of the forecast horizon. Valid time scales are 'hours', 'days', and 'weeks'.
            horizon_len (int): The integer length of the forecast horizon. Eg., 60 if a 60 day forecast was requested.
    
        Returns:
            Union[str, Dict[str, Union[dict, str]]]: a dictionary with prediction data, a text explanation of the predictions, agent_id, and the prediction id.
        """
    
        nf_agent = NormalizedForecaster.load_from_saved_estimator(estimator_id=agent_id, verbose=False)
        item = nf_agent.input_type(**input_data)
    
        try:
            forecast_start_dt = datetime.fromisoformat(forecast_start_dt_str)
            horizon_params = {
                'start_dt': forecast_start_dt,
                time_scale: horizon_len
            }
            req = nf_agent.queue(item, **horizon_params)
        except Exception as e:
            return f"""Error at nf_agent: {str(e)}"""
    
        try:
            predictions = nf_agent.get_predictions(req.request_id)
            prediction = predictions[0]
            return {
                "agent_id": nf_agent.estimator_id,
                "prediction_id": prediction.id,
                'data': prediction.to_json(orient='rows'),
                'explanation': prediction.text}
    
        except Exception as e:
            return f"""Error on prediction: {str(e)}"""
  • Registers the 'reuse_forecasting_agent_and_get_forecast' tool with the FastMCP server instance. Note that it uses the description constant intended for the create tool.
    mcp.add_tool(reuse_forecasting_agent_and_get_forecast, description=CREATE_AGENT_AND_GET_FORECAST_DESCRIPTION)
  • Imports the 'reuse_forecasting_agent_and_get_forecast' handler from the forecaster module to make it available for registration.
    from chronulus_mcp.agent.forecaster import create_forecasting_agent_and_get_forecast, reuse_forecasting_agent_and_get_forecast, rescale_forecast
  • Defines the description string for the reuse forecasting tool, detailing usage instructions and parameters, though not directly used in the registration (uses create tool's description instead). Serves as tool schema/documentation.
    REUSE_AGENT_AND_GET_FORECAST_DESCRIPTION = f"""
    This tool provides a forecast input to a previous created Chronulus NormalizedForecaster agent and returns the
        prediction data and text explanation from the agent.
    
    When to use this tool:
    - Use this tool to request a forecast from a Chronulus agent that you have already created and when your input data model is unchanged
    - This tool is specifically made to forecast values between 0 and 1 and does not require historical data
    - The prediction can be thought of as seasonal weights, probabilities, or shares of something as in the decimal representation of a percent
    
    How to use this tool:
    - First, make sure you have an agent_id for the agent. The agent is already attached to the correct session. So you do not need to provide a session_id.
    - Next, reference the input data model that you previously used with the agent and create new inputs for the item being forecast
        that align with the previously specified input data model
    {FILE_TYPE_INSTRUCTIONS}
    - Finally, add information about the forecasting horizon and time scale requested by the user
    - Assume the dates and datetimes in the prediction results are already converted to the appropriate local timezone if location is a factor in the use case. So do not try to convert from UTC to local time when plotting.
    - When plotting the predictions, use a Rechart time series with the appropriate axes labeled and with the prediction explanation displayed as a caption below the plot
    """
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it creates an agent and returns predictions with explanations, specifies the output range (0 to 1), handles file inputs (images, text, PDFs), manages large text inputs, includes timezone assumptions, and provides plotting guidance. However, it lacks details on error handling, rate limits, or authentication needs, which are common gaps for a tool of this complexity.

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

Conciseness3/5

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

The description is well-structured with clear sections ('When to use this tool', 'How to use this tool'), but it is overly verbose at 15+ sentences. Some details, like plotting instructions and timezone assumptions, are tangential to the core tool functionality and could be streamlined. While front-loaded with purpose, it includes unnecessary elaboration that reduces conciseness.

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?

Given the tool's complexity (5 parameters, nested objects, no output schema, no annotations), the description provides substantial context: purpose, usage guidelines, behavioral details, and implementation steps. It compensates well for the lack of annotations and output schema by explaining what the tool does and how to use it. However, it could improve by briefly mentioning the return format or error cases to be fully complete.

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 schema already documents all parameters thoroughly. The description adds minimal parameter semantics beyond the schema—it mentions 'agent_id' in the usage guidelines and implies 'input_data' through file handling examples, but doesn't explain parameter interactions or provide additional context. This meets the baseline of 3 when schema coverage is high.

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 clearly states the tool's purpose: 'creates a NormalizedForecaster agent with your session and input data model and then provides a forecast input data to the agent and returns the prediction data and text explanation from the agent.' It specifies the exact action (create agent, provide forecast input, return prediction and explanation) and distinguishes it from siblings like 'create_forecasting_agent_and_get_forecast' by focusing on reusing an existing agent rather than creating a new one.

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

Usage Guidelines5/5

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

The description includes an explicit 'When to use this tool' section with three bullet points: use for forecasting from Chronulus, specifically for values between 0 and 1 without historical data, and for seasonal weights/probabilities/shares. It also distinguishes from alternatives by implying this is for reuse (vs. creation tools like 'create_forecasting_agent_and_get_forecast'), though it doesn't explicitly name alternatives, the context is clear.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ChronulusAI/chronulus-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server