mcprotocol_rs/server_features/
prompts.rs

1use async_trait::async_trait;
2use serde::{Deserialize, Serialize};
3use serde_json::Value;
4
5use crate::Result;
6
7/// Represents a prompt template
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Prompt {
10    /// Unique identifier for the prompt
11    pub id: String,
12    /// Human-readable name
13    pub name: String,
14    /// Description of what the prompt does
15    pub description: String,
16    /// The actual prompt template
17    pub template: String,
18    /// Optional parameters for the template
19    pub parameters: Option<Value>,
20}
21
22/// Prompt manager trait
23#[async_trait]
24pub trait PromptManager: Send + Sync {
25    /// Lists available prompts
26    async fn list_prompts(&self) -> Result<Vec<Prompt>>;
27
28    /// Gets a specific prompt by ID
29    async fn get_prompt(&self, id: &str) -> Result<Prompt>;
30
31    /// Executes a prompt with given parameters
32    async fn execute_prompt(&self, id: &str, params: Option<Value>) -> Result<Value>;
33}