use argonauts_mcp::session::goal::{self, ABOUT, SET_GOAL_TOOL};
use super::{Call, MainTool};
use crate::controller::conversation::ConversationState;
use crate::controller::{Ctx, Effect};
pub(super) fn tool() -> MainTool {
MainTool {
name: SET_GOAL_TOOL,
about: ABOUT,
offered,
call,
}
}
fn offered(_ctx: &Ctx, conversation: &ConversationState) -> bool {
conversation.place.is_none()
}
fn call(ctx: &mut Ctx, conversation: &mut ConversationState, call: Call) -> Vec<Effect> {
let asked = goal::parse(&call.arguments);
let (reply, effects) = super::super::goal::asked(
ctx,
conversation,
asked.action,
&asked.condition,
asked.from_now_on,
);
let _ = call.reply.send(reply);
effects
}