//! Generated types for {{server_name}}
//!
//! Typed shapes of the upstream's tool arguments, for callers that want to
//! build them with the compiler's help. Field names are Rust's; each
//! serializes under the upstream's own name.
use serde::{Deserialize, Serialize};
{{#each type_definitions}}
{{#if this.description}}
/// {{this.description}}
{{/if}}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct {{this.name}} {
{{#each this.fields}}
{{#if this.description}}
/// {{this.description}}
{{/if}}
{{#if this.rename}}
#[serde(rename = "{{this.rename}}")]
{{/if}}
{{#if this.optional}}
#[serde(default, skip_serializing_if = "Option::is_none")]
pub {{this.name}}: Option<{{this.rust_type}}>,
{{else}}
pub {{this.name}}: {{this.rust_type}},
{{/if}}
{{/each}}
}
{{/each}}
/// The upstream's tools, by the name the upstream uses
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Tool {
{{#each tool_enums}}
{{this.ident}},
{{/each}}
}
impl Tool {
/// The upstream's name for this tool
pub fn name(&self) -> &'static str {
match *self {
{{#each tool_enums}}
Tool::{{this.ident}} => "{{this.name}}",
{{/each}}
}
}
}
/// The upstream's static resources
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Resource {
{{#each resource_enums}}
{{this.name}},
{{/each}}
}
impl Resource {
/// The resource's URI
pub fn uri(&self) -> &'static str {
match *self {
{{#each resource_enums}}
Resource::{{this.name}} => "{{this.uri}}",
{{/each}}
}
}
}
/// The upstream's prompts, by the name the upstream uses
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Prompt {
{{#each prompt_enums}}
{{this.ident}},
{{/each}}
}
impl Prompt {
/// The upstream's name for this prompt
pub fn name(&self) -> &'static str {
match *self {
{{#each prompt_enums}}
Prompt::{{this.ident}} => "{{this.name}}",
{{/each}}
}
}
}