use serde::{Deserialize, Serialize};
use solagent_core::rig::{
completion::ToolDefinition,
tool::{Tool, ToolEmbedding},
};
use solagent_parameters::parameters;
use solagent_plugin_rugcheck::fetch_detailed_report;
#[derive(Deserialize)]
pub struct FetchTokenReportDetailedArgs {
mint: String,
}
#[derive(Deserialize, Serialize)]
pub struct FetchTokenReportDetailedOutput {
pub token_check: serde_json::Value,
}
#[derive(Debug, thiserror::Error)]
#[error("FetchTokenReportDetailed error")]
pub struct FetchTokenReportDetailedError;
#[derive(Default)]
pub struct FetchTokenReportDetailed {}
impl FetchTokenReportDetailed {
pub fn new() -> Self {
FetchTokenReportDetailed {}
}
}
impl Tool for FetchTokenReportDetailed {
const NAME: &'static str = "fetch_detailed_report";
type Error = FetchTokenReportDetailedError;
type Args = FetchTokenReportDetailedArgs;
type Output = FetchTokenReportDetailedOutput;
async fn definition(&self, _prompt: String) -> ToolDefinition {
ToolDefinition {
name: "fetch_detailed_report".to_string(),
description: r#"
Fetches a detailed report for a specific token from RugCheck.
Inputs:
- mint: string, the mint address of the token, e.g., "84VUXykQjNvPDm88oT5FRucXeNcrwdQGottJKjkAoqd1" (required).
"#.to_string(),
parameters: parameters!(
mint: String,
),
}
}
async fn call(&self, args: Self::Args) -> Result<Self::Output, Self::Error> {
let token_check = fetch_detailed_report(args.mint)
.await
.expect("fetch_detailed_report");
Ok(FetchTokenReportDetailedOutput { token_check })
}
}
#[derive(Debug, thiserror::Error)]
#[error("Init error")]
pub struct InitError;
impl ToolEmbedding for FetchTokenReportDetailed {
type InitError = InitError;
type Context = ();
type State = ();
fn init(_state: Self::State, _context: Self::Context) -> Result<Self, Self::InitError> {
Ok(FetchTokenReportDetailed {})
}
fn embedding_docs(&self) -> Vec<String> {
vec!["Fetches a summary report for a specific token from FetchTokenReportDetailed.".into()]
}
fn context(&self) -> Self::Context {}
}