This is page 7 of 11. Use http://codebase.md/tuananh/hyper-mcp?lines=true&page={x} to view the full context.
# Directory Structure
```
├── .cursor
│ └── rules
│ └── print-ctx-size.mdc
├── .dockerignore
├── .github
│ ├── renovate.json5
│ └── workflows
│ ├── ci.yml
│ ├── nightly.yml
│ └── release.yml
├── .gitignore
├── .gitmodules
├── .hadolint.yaml
├── .pre-commit-config.yaml
├── .windsurf
│ └── rules
│ ├── print-ctx-size.md
│ └── think.md
├── assets
│ ├── cursor-mcp-1.png
│ ├── cursor-mcp.png
│ ├── eval-py.jpg
│ └── logo.png
├── Cargo.lock
├── Cargo.toml
├── config.example.json
├── config.example.yaml
├── CREATING_PLUGINS.md
├── DEPLOYMENT.md
├── Dockerfile
├── examples
│ └── plugins
│ ├── v1
│ │ ├── arxiv
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── context7
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── crates-io
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── crypto-price
│ │ │ ├── Dockerfile
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── main.go
│ │ │ ├── pdk.gen.go
│ │ │ └── README.md
│ │ ├── eval-py
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── fetch
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── fs
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── github
│ │ │ ├── .gitignore
│ │ │ ├── branches.go
│ │ │ ├── Dockerfile
│ │ │ ├── files.go
│ │ │ ├── gists.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── issues.go
│ │ │ ├── main.go
│ │ │ ├── pdk.gen.go
│ │ │ ├── README.md
│ │ │ └── repo.go
│ │ ├── gitlab
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── gomodule
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── hash
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.lock
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── maven
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── meme-generator
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── generate_embedded.py
│ │ │ ├── README.md
│ │ │ ├── src
│ │ │ │ ├── embedded.rs
│ │ │ │ ├── lib.rs
│ │ │ │ └── pdk.rs
│ │ │ └── templates.json
│ │ ├── memory
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── myip
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.lock
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── qdrant
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ ├── pdk.rs
│ │ │ └── qdrant_client.rs
│ │ ├── qr-code
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.lock
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── serper
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── sqlite
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── think
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ └── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ ├── time
│ │ │ ├── .cargo
│ │ │ │ └── config.toml
│ │ │ ├── .gitignore
│ │ │ ├── Cargo.toml
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ ├── src
│ │ │ │ ├── lib.rs
│ │ │ │ └── pdk.rs
│ │ │ └── time.wasm
│ │ └── tool-list-changed
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── src
│ │ │ ├── lib.rs
│ │ │ └── pdk.rs
│ │ └── tool_list_changed.wasm
│ └── v2
│ └── rstime
│ ├── .cargo
│ │ └── config.toml
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── Dockerfile
│ ├── README.md
│ ├── rstime.wasm
│ └── src
│ ├── lib.rs
│ └── pdk
│ ├── exports.rs
│ ├── imports.rs
│ ├── mod.rs
│ └── types.rs
├── iac
│ ├── .terraform.lock.hcl
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── justfile
├── LICENSE
├── README.md
├── RUNTIME_CONFIG.md
├── rust-toolchain.toml
├── server.json
├── SKIP_TOOLS_GUIDE.md
├── src
│ ├── cli.rs
│ ├── config.rs
│ ├── https_auth.rs
│ ├── logging.rs
│ ├── main.rs
│ ├── naming.rs
│ ├── plugin.rs
│ ├── service.rs
│ └── wasm
│ ├── http.rs
│ ├── mod.rs
│ ├── oci.rs
│ └── s3.rs
├── templates
│ └── plugins
│ ├── go
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── exports.go
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── imports.go
│ │ ├── main.go
│ │ ├── README.md
│ │ └── types.go
│ ├── README.md
│ └── rust
│ ├── .cargo
│ │ └── config.toml
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── Dockerfile
│ ├── README.md
│ └── src
│ ├── lib.rs
│ └── pdk
│ ├── exports.rs
│ ├── imports.rs
│ ├── mod.rs
│ └── types.rs
├── tests
│ └── fixtures
│ ├── config_with_auths.json
│ ├── config_with_auths.yaml
│ ├── documentation_example.json
│ ├── documentation_example.yaml
│ ├── invalid_auth_config.yaml
│ ├── invalid_plugin_name.yaml
│ ├── invalid_structure.yaml
│ ├── invalid_url.yaml
│ ├── keyring_auth_config.yaml
│ ├── skip_tools_examples.yaml
│ ├── unsupported_config.txt
│ ├── valid_config.json
│ └── valid_config.yaml
└── xtp-plugin-schema.json
```
# Files
--------------------------------------------------------------------------------
/examples/plugins/v2/rstime/src/lib.rs:
--------------------------------------------------------------------------------
```rust
1 | mod pdk;
2 |
3 | use anyhow::{Result, anyhow};
4 | use base64::{Engine as _, engine::general_purpose::STANDARD};
5 | use extism_pdk::{HttpRequest, Memory, http::request};
6 | use pdk::types::*;
7 | use serde_json::{Map, Value, json};
8 |
9 | pub(crate) fn call_tool(input: CallToolRequest) -> Result<CallToolResult> {
10 | match input.request.name.as_str() {
11 | "get_time" => {
12 | let tz = match input
13 | .request
14 | .arguments
15 | .as_ref()
16 | .and_then(|args| args.get("timezone"))
17 | .and_then(|v| v.as_str())
18 | {
19 | Some(timezone) => match timezone.parse::<chrono_tz::Tz>() {
20 | Ok(tz) => tz,
21 | Err(e) => {
22 | return Ok(CallToolResult {
23 | content: vec![ContentBlock::Text(TextContent {
24 | text: format!("Error: Invalid timezone '{}': {}", timezone, e),
25 |
26 | ..Default::default()
27 | })],
28 | is_error: Some(true),
29 |
30 | ..Default::default()
31 | });
32 | }
33 | },
34 | None => chrono_tz::UTC,
35 | };
36 | let current_time = chrono::Utc::now().with_timezone(&tz).to_rfc2822();
37 | Ok(CallToolResult {
38 | content: vec![ContentBlock::Text(TextContent {
39 | text: current_time.clone(),
40 |
41 | ..Default::default()
42 | })],
43 | structured_content: Some(Map::from_iter([(
44 | "current_time".to_string(),
45 | Value::String(current_time),
46 | )])),
47 |
48 | ..Default::default()
49 | })
50 | }
51 | "parse_time" => {
52 | let time_str = match input
53 | .request
54 | .arguments
55 | .as_ref()
56 | .and_then(|args| args.get("time"))
57 | .and_then(|v| v.as_str())
58 | {
59 | Some(t) => t,
60 | None => {
61 | return Ok(CallToolResult {
62 | content: vec![ContentBlock::Text(TextContent {
63 | text: "Error: 'time' argument is required".to_string(),
64 |
65 | ..Default::default()
66 | })],
67 | is_error: Some(true),
68 |
69 | ..Default::default()
70 | });
71 | }
72 | };
73 | match chrono::DateTime::parse_from_rfc2822(time_str) {
74 | Ok(dt) => Ok(CallToolResult {
75 | content: vec![ContentBlock::Text(TextContent {
76 | text: dt.timestamp().to_string(),
77 |
78 | ..Default::default()
79 | })],
80 | structured_content: Some(Map::from_iter([(
81 | "timestamp".to_string(),
82 | Value::Number(serde_json::Number::from(dt.timestamp())),
83 | )])),
84 |
85 | ..Default::default()
86 | }),
87 | Err(e) => Ok(CallToolResult {
88 | content: vec![ContentBlock::Text(TextContent {
89 | text: format!("Error parsing time: {}", e),
90 |
91 | ..Default::default()
92 | })],
93 | is_error: Some(true),
94 |
95 | ..Default::default()
96 | }),
97 | }
98 | }
99 | _ => Err(anyhow!("Unknown tool: {}", input.request.name)),
100 | }
101 | }
102 |
103 | // Provide completion suggestions for a partially-typed input.
104 | //
105 | // This function is called when the user requests autocompletion. The plugin should analyze the partial input and return matching completion suggestions based on the reference (prompt or resource) and argument context.
106 | pub(crate) fn complete(input: CompleteRequest) -> Result<CompleteResult> {
107 | match input.request.r#ref {
108 | Reference::Prompt(prompt_ref) if prompt_ref.name.as_str() != "get_time_with_timezone" => {
109 | return Err(anyhow!(
110 | "Completion for prompt not implemented: {}",
111 | prompt_ref.name
112 | ));
113 | }
114 |
115 | Reference::ResourceTemplate(resource_ref)
116 | if resource_ref.uri.as_str()
117 | != "https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz={timezone}" =>
118 | {
119 | return Err(anyhow!(
120 | "Completion for resource not implemented: {}",
121 | resource_ref.uri
122 | ));
123 | }
124 |
125 | _ => {}
126 | };
127 |
128 | match input.request.argument.name.as_str() {
129 | "timezone" => {
130 | let query = input
131 | .request
132 | .argument
133 | .value
134 | .to_ascii_lowercase()
135 | .replace(" ", "_");
136 | let mut suggestions: Vec<String> = vec![];
137 | let mut total: i64 = 0;
138 | for tz in chrono_tz::TZ_VARIANTS {
139 | if tz.name().to_ascii_lowercase().contains(&query) {
140 | if suggestions.len() < 100 {
141 | suggestions.push(tz.name().to_string());
142 | }
143 | total += 1;
144 | }
145 | }
146 | Ok(CompleteResult {
147 | completion: CompleteResultCompletion {
148 | has_more: Some(total > suggestions.len() as i64),
149 | total: Some(total),
150 | values: suggestions,
151 | },
152 | })
153 | }
154 | _ => Err(anyhow!(
155 | "Completion for argument not implemented: {}",
156 | input.request.argument.name
157 | )),
158 | }
159 | }
160 |
161 | // Retrieve a specific prompt by name.
162 | //
163 | // This function is called when the user requests a specific prompt. The plugin should return the prompt details including messages and optional description.
164 | pub(crate) fn get_prompt(input: GetPromptRequest) -> Result<GetPromptResult> {
165 | match input.request.name.as_str() {
166 | "get_time_with_timezone" => {
167 | let tz = match input
168 | .request
169 | .arguments
170 | .as_ref()
171 | .and_then(|args| args.get("timezone"))
172 | {
173 | Some(timezone) => match timezone.parse::<chrono_tz::Tz>() {
174 | Ok(tz) => tz,
175 | Err(e) => {
176 | return Ok(GetPromptResult {
177 | messages: vec![PromptMessage {
178 | role: Role::Assistant,
179 | content: ContentBlock::Text(TextContent {
180 | text: format!("Error: Invalid timezone '{}': {}", timezone, e),
181 |
182 | ..Default::default()
183 | }),
184 | }],
185 |
186 | ..Default::default()
187 | });
188 | }
189 | },
190 | None => chrono_tz::UTC,
191 | };
192 |
193 | Ok(GetPromptResult {
194 | description: Some(format!("Information for {}", tz.name())),
195 | messages: vec![PromptMessage {
196 | role: Role::Assistant,
197 | content: ContentBlock::Text(TextContent {
198 | text: format!("Please get the time for the timezone {}", tz.name()),
199 |
200 | ..Default::default()
201 | }),
202 | }],
203 | })
204 | }
205 | _ => Err(anyhow!("Prompt not found: {}", input.request.name)),
206 | }
207 | }
208 |
209 | // List all available prompts.
210 | //
211 | // This function should return a list of prompts that the plugin provides. Each prompt should include its name and a brief description of what it does. Supports pagination via cursor.
212 | pub(crate) fn list_prompts(_input: ListPromptsRequest) -> Result<ListPromptsResult> {
213 | Ok(ListPromptsResult {
214 | prompts: vec![Prompt {
215 | name: "get_time_with_timezone".to_string(),
216 | description: Some(
217 | "Asks the assistant to get the time in a provided timezone".to_string(),
218 | ),
219 | title: Some("Get Localized Time".to_string()),
220 | arguments: Some(vec![PromptArgument {
221 | name: "timezone".to_string(),
222 | description: Some(
223 | "The timezone to prompt for, will use UTC by default".to_string(),
224 | ),
225 | title: Some("Timezone".to_string()),
226 |
227 | ..Default::default()
228 | }]),
229 | }],
230 | })
231 | }
232 |
233 | // List all available resource templates.
234 | //
235 | // This function should return a list of resource templates that the plugin provides. Templates are URI patterns that can match multiple resources. Supports pagination via cursor.
236 | pub(crate) fn list_resource_templates(
237 | _input: ListResourceTemplatesRequest,
238 | ) -> Result<ListResourceTemplatesResult> {
239 | Ok(ListResourceTemplatesResult {
240 | resource_templates: vec![ResourceTemplate {
241 | name: "time_zone_converter".to_string(),
242 | description: Some("Display HTML page containing timezone information".to_string()),
243 | mime_type: Some("text/html".to_string()),
244 | uri_template: "https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz={timezone}"
245 | .to_string(),
246 | title: Some("TimeZone Converter".to_string()),
247 |
248 | ..Default::default()
249 | }],
250 | ..Default::default()
251 | })
252 | }
253 |
254 | // List all available resources.
255 | //
256 | // This function should return a list of resources that the plugin provides. Resources are URI-based references to files, data, or services. Supports pagination via cursor.
257 | pub(crate) fn list_resources(_input: ListResourcesRequest) -> Result<ListResourcesResult> {
258 | Ok(ListResourcesResult::default())
259 | }
260 |
261 | // List all available tools.
262 | //
263 | // This function should return a list of all tools that the plugin provides. Each tool should include its name, description, and input schema. Supports pagination via cursor.
264 | pub(crate) fn list_tools(_input: ListToolsRequest) -> Result<ListToolsResult> {
265 | Ok(ListToolsResult {
266 | tools: vec![
267 | Tool {
268 | annotations: None,
269 | description: Some("Returns the current time in the specified timezone. If no timezone is specified then UTC is used.".to_string()),
270 | input_schema: ToolSchema {
271 | properties: Some(Map::from_iter([
272 | ("timezone".to_string(), json!({
273 | "type": "string",
274 | "description": "The timezone to get the current time for, e.g. 'America/New_York'. Defaults to 'UTC' if not provided.",
275 | })),
276 | ])),
277 |
278 | ..Default::default()
279 | },
280 | name: "get_time".to_string(),
281 | output_schema: Some(ToolSchema {
282 | properties: Some(Map::from_iter([
283 | ("current_time".to_string(), json!({
284 | "type": "string",
285 | "description": "The current time in the specified timezone in RFC2822 format.",
286 | })),
287 | ])),
288 | required: Some(vec!["current_time".to_string()]),
289 |
290 | ..Default::default()
291 | }),
292 | title: Some("Get Current Time".to_string()),
293 | },
294 | Tool {
295 | annotations: None,
296 | description: Some("Parses a time string in RFC2822 format and returns the corresponding timestamp in UTC.".to_string()),
297 | input_schema: ToolSchema {
298 | properties: Some(Map::from_iter([
299 | ("time".to_string(), json!({
300 | "type": "string",
301 | "description": "The time string in RFC2822 format to parse.",
302 | })),
303 | ])),
304 | required: Some(vec!["time".to_string()]),
305 |
306 | ..Default::default()
307 | },
308 | name: "parse_time".to_string(),
309 | output_schema: Some(ToolSchema {
310 | properties: Some(Map::from_iter([
311 | ("timestamp".to_string(), json!({
312 | "type": "integer",
313 | "description": "The parsed timestamp in seconds since the Unix epoch.",
314 | })),
315 | ])),
316 | required: Some(vec!["timestamp".to_string()]),
317 |
318 | ..Default::default()
319 | }),
320 | title: Some("Parse Time from RFC2822".to_string()),
321 | }
322 | ],
323 | })
324 | }
325 |
326 | // Notification that the list of roots has changed.
327 | //
328 | // This is an optional notification handler. If implemented, the plugin will be notified whenever the roots list changes on the client side. This allows plugins to react to changes in the file system roots or other root resources.
329 | pub(crate) fn on_roots_list_changed(_input: PluginNotificationContext) -> Result<()> {
330 | Ok(())
331 | }
332 |
333 | // Read the contents of a resource by its URI.
334 | //
335 | // This function is called when the user wants to read the contents of a specific resource. The plugin should retrieve and return the resource data with appropriate MIME type information.
336 | pub(crate) fn read_resource(input: ReadResourceRequest) -> Result<ReadResourceResult> {
337 | if !input
338 | .request
339 | .uri
340 | .starts_with("https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz=")
341 | {
342 | return Ok(ReadResourceResult::default());
343 | }
344 |
345 | match request(
346 | &HttpRequest::new(input.request.uri.clone()).with_method("GET"),
347 | None::<Memory>,
348 | ) {
349 | Ok(response) => {
350 | if response.status_code() >= 200 && response.status_code() < 300 {
351 | Ok(ReadResourceResult {
352 | contents: vec![ResourceContents::Blob(BlobResourceContents {
353 | mime_type: Some("text/html".to_string()),
354 | blob: STANDARD.encode(response.body()),
355 | uri: input.request.uri,
356 |
357 | ..Default::default()
358 | })],
359 | })
360 | } else {
361 | Ok(ReadResourceResult {
362 | contents: vec![ResourceContents::Text(TextResourceContents {
363 | mime_type: Some("text/plain".to_string()),
364 | text: format!("Error fetching resource: HTTP {}", response.status_code()),
365 |
366 | ..Default::default()
367 | })],
368 | })
369 | }
370 | }
371 | Err(e) => Ok(ReadResourceResult {
372 | contents: vec![ResourceContents::Text(TextResourceContents {
373 | mime_type: Some("text/plain".to_string()),
374 | text: format!("Error fetching resource: {}", e),
375 |
376 | ..Default::default()
377 | })],
378 | }),
379 | }
380 | }
381 |
382 | #[cfg(test)]
383 | mod tests {
384 | use super::*;
385 | use std::collections::HashMap;
386 |
387 | #[test]
388 | fn test_call_tool_get_time_utc() {
389 | let input = CallToolRequest {
390 | context: PluginRequestContext::default(),
391 | request: CallToolRequestParam {
392 | name: "get_time".to_string(),
393 | arguments: None,
394 | },
395 | };
396 |
397 | let result = call_tool(input).expect("call_tool should succeed");
398 | assert!(!result.content.is_empty());
399 | assert!(result.is_error.is_none() || result.is_error == Some(false));
400 | assert!(result.structured_content.is_some());
401 | }
402 |
403 | #[test]
404 | fn test_call_tool_get_time_with_timezone() {
405 | let mut args = Map::new();
406 | args.insert(
407 | "timezone".to_string(),
408 | Value::String("America/New_York".to_string()),
409 | );
410 |
411 | let input = CallToolRequest {
412 | context: PluginRequestContext::default(),
413 | request: CallToolRequestParam {
414 | name: "get_time".to_string(),
415 | arguments: Some(args),
416 | },
417 | };
418 |
419 | let result = call_tool(input).expect("call_tool should succeed");
420 | assert!(!result.content.is_empty());
421 | assert!(result.is_error.is_none() || result.is_error == Some(false));
422 | }
423 |
424 | #[test]
425 | fn test_call_tool_get_time_invalid_timezone() {
426 | let mut args = Map::new();
427 | args.insert(
428 | "timezone".to_string(),
429 | Value::String("Invalid/Timezone".to_string()),
430 | );
431 |
432 | let input = CallToolRequest {
433 | context: PluginRequestContext::default(),
434 | request: CallToolRequestParam {
435 | name: "get_time".to_string(),
436 | arguments: Some(args),
437 | },
438 | };
439 |
440 | let result = call_tool(input).expect("call_tool should succeed");
441 | assert!(result.is_error == Some(true));
442 | }
443 |
444 | #[test]
445 | fn test_call_tool_parse_time_valid() {
446 | let mut args = Map::new();
447 | args.insert(
448 | "time".to_string(),
449 | Value::String("29 Nov 2024 10:30:00 +0000".to_string()),
450 | );
451 |
452 | let input = CallToolRequest {
453 | context: PluginRequestContext::default(),
454 | request: CallToolRequestParam {
455 | name: "parse_time".to_string(),
456 | arguments: Some(args),
457 | },
458 | };
459 |
460 | let result = call_tool(input).expect("call_tool should succeed");
461 | assert!(!result.content.is_empty());
462 | assert!(result.is_error.is_none() || result.is_error == Some(false));
463 | assert!(result.structured_content.is_some());
464 | }
465 |
466 | #[test]
467 | fn test_call_tool_parse_time_missing_argument() {
468 | let input = CallToolRequest {
469 | context: PluginRequestContext::default(),
470 | request: CallToolRequestParam {
471 | name: "parse_time".to_string(),
472 | arguments: None,
473 | },
474 | };
475 |
476 | let result = call_tool(input).expect("call_tool should succeed");
477 | assert!(result.is_error == Some(true));
478 | }
479 |
480 | #[test]
481 | fn test_call_tool_parse_time_invalid() {
482 | let mut args = Map::new();
483 | args.insert(
484 | "time".to_string(),
485 | Value::String("not a valid time".to_string()),
486 | );
487 |
488 | let input = CallToolRequest {
489 | context: PluginRequestContext::default(),
490 | request: CallToolRequestParam {
491 | name: "parse_time".to_string(),
492 | arguments: Some(args),
493 | },
494 | };
495 |
496 | let result = call_tool(input).expect("call_tool should succeed");
497 | assert!(result.is_error == Some(true));
498 | }
499 |
500 | #[test]
501 | fn test_call_tool_unknown_tool() {
502 | let input = CallToolRequest {
503 | context: PluginRequestContext::default(),
504 | request: CallToolRequestParam {
505 | name: "unknown_tool".to_string(),
506 | arguments: None,
507 | },
508 | };
509 |
510 | let result = call_tool(input);
511 | assert!(result.is_err());
512 | }
513 |
514 | #[test]
515 | fn test_complete_with_utc_query() {
516 | // Test complete function with UTC timezone query
517 | let prompt_ref = PromptReference {
518 | name: "get_time_with_timezone".to_string(),
519 | title: None,
520 | r#type: PromptReferenceType::Prompt,
521 | };
522 |
523 | let input = CompleteRequest {
524 | context: PluginRequestContext::default(),
525 | request: CompleteRequestParam {
526 | r#ref: Reference::Prompt(prompt_ref),
527 | argument: CompleteRequestParamArgument {
528 | name: "timezone".to_string(),
529 | value: "utc".to_string(),
530 | },
531 | context: None,
532 | },
533 | };
534 |
535 | let result = complete(input).expect("complete should succeed");
536 | assert!(!result.completion.values.is_empty());
537 | assert!(result.completion.values.contains(&"UTC".to_string()));
538 | assert!(result.completion.total.is_some());
539 | }
540 |
541 | #[test]
542 | fn test_complete_with_america_query() {
543 | // Test complete function with America timezone prefix
544 | let prompt_ref = PromptReference {
545 | name: "get_time_with_timezone".to_string(),
546 | title: None,
547 | r#type: PromptReferenceType::Prompt,
548 | };
549 |
550 | let input = CompleteRequest {
551 | context: PluginRequestContext::default(),
552 | request: CompleteRequestParam {
553 | r#ref: Reference::Prompt(prompt_ref),
554 | argument: CompleteRequestParamArgument {
555 | name: "timezone".to_string(),
556 | value: "america".to_string(),
557 | },
558 | context: None,
559 | },
560 | };
561 |
562 | let result = complete(input).expect("complete should succeed");
563 | assert!(!result.completion.values.is_empty());
564 | assert!(result.completion.values.len() > 5);
565 | assert!(
566 | result
567 | .completion
568 | .values
569 | .iter()
570 | .any(|v| v.contains("America"))
571 | );
572 | }
573 |
574 | #[test]
575 | fn test_complete_with_empty_query() {
576 | // Test complete function with empty query - should return many results
577 | let prompt_ref = PromptReference {
578 | name: "get_time_with_timezone".to_string(),
579 | title: None,
580 | r#type: PromptReferenceType::Prompt,
581 | };
582 |
583 | let input = CompleteRequest {
584 | context: PluginRequestContext::default(),
585 | request: CompleteRequestParam {
586 | r#ref: Reference::Prompt(prompt_ref),
587 | argument: CompleteRequestParamArgument {
588 | name: "timezone".to_string(),
589 | value: String::new(),
590 | },
591 | context: None,
592 | },
593 | };
594 |
595 | let result = complete(input).expect("complete should succeed");
596 | // Should return max 100 suggestions
597 | assert!(result.completion.values.len() <= 100);
598 | // Should indicate there are more
599 | assert_eq!(result.completion.has_more, Some(true));
600 | // Total should be much larger
601 | assert!(result.completion.total.unwrap() > 400);
602 | }
603 |
604 | #[test]
605 | fn test_complete_with_york_query() {
606 | // Test complete function with York timezone query (case insensitive)
607 | let prompt_ref = PromptReference {
608 | name: "get_time_with_timezone".to_string(),
609 | title: None,
610 | r#type: PromptReferenceType::Prompt,
611 | };
612 |
613 | let input = CompleteRequest {
614 | context: PluginRequestContext::default(),
615 | request: CompleteRequestParam {
616 | r#ref: Reference::Prompt(prompt_ref),
617 | argument: CompleteRequestParamArgument {
618 | name: "timezone".to_string(),
619 | value: "YORK".to_string(),
620 | },
621 | context: None,
622 | },
623 | };
624 |
625 | let result = complete(input).expect("complete should succeed");
626 | assert!(!result.completion.values.is_empty());
627 | assert!(
628 | result
629 | .completion
630 | .values
631 | .contains(&"America/New_York".to_string())
632 | );
633 | }
634 |
635 | #[test]
636 | fn test_complete_with_los_angeles_query() {
637 | // Test complete function with space-separated timezone query
638 | let prompt_ref = PromptReference {
639 | name: "get_time_with_timezone".to_string(),
640 | title: None,
641 | r#type: PromptReferenceType::Prompt,
642 | };
643 |
644 | let input = CompleteRequest {
645 | context: PluginRequestContext::default(),
646 | request: CompleteRequestParam {
647 | r#ref: Reference::Prompt(prompt_ref),
648 | argument: CompleteRequestParamArgument {
649 | name: "timezone".to_string(),
650 | value: "los angeles".to_string(),
651 | },
652 | context: None,
653 | },
654 | };
655 |
656 | let result = complete(input).expect("complete should succeed");
657 | assert!(!result.completion.values.is_empty());
658 | assert!(
659 | result
660 | .completion
661 | .values
662 | .contains(&"America/Los_Angeles".to_string())
663 | );
664 | }
665 |
666 | #[test]
667 | fn test_complete_with_europe_query() {
668 | // Test complete function with Europe timezone prefix
669 | let prompt_ref = PromptReference {
670 | name: "get_time_with_timezone".to_string(),
671 | title: None,
672 | r#type: PromptReferenceType::Prompt,
673 | };
674 |
675 | let input = CompleteRequest {
676 | context: PluginRequestContext::default(),
677 | request: CompleteRequestParam {
678 | r#ref: Reference::Prompt(prompt_ref),
679 | argument: CompleteRequestParamArgument {
680 | name: "timezone".to_string(),
681 | value: "europe/".to_string(),
682 | },
683 | context: None,
684 | },
685 | };
686 |
687 | let result = complete(input).expect("complete should succeed");
688 | assert!(!result.completion.values.is_empty());
689 | // All results should contain Europe
690 | assert!(
691 | result
692 | .completion
693 | .values
694 | .iter()
695 | .all(|v| v.to_lowercase().contains("europe"))
696 | );
697 | }
698 |
699 | #[test]
700 | fn test_complete_result_structure() {
701 | // Test that complete results have the expected structure
702 | // We verify the logic by constructing expected outputs
703 | let values = vec!["UTC".to_string(), "America/New_York".to_string()];
704 | let total = 500i64;
705 | let has_more = total > values.len() as i64;
706 |
707 | let completion = CompleteResultCompletion {
708 | has_more: Some(has_more),
709 | total: Some(total),
710 | values: values.clone(),
711 | };
712 |
713 | let result = CompleteResult { completion };
714 | assert_eq!(result.completion.values.len(), 2);
715 | assert!(result.completion.has_more.unwrap());
716 | assert_eq!(result.completion.total.unwrap(), 500);
717 | }
718 |
719 | #[test]
720 | fn test_complete_result_has_required_fields() {
721 | // Test that CompleteResult includes required fields
722 | let completion = CompleteResultCompletion {
723 | has_more: Some(true),
724 | total: Some(500),
725 | values: vec!["UTC".to_string(), "America/New_York".to_string()],
726 | };
727 |
728 | let result = CompleteResult { completion };
729 |
730 | assert!(result.completion.has_more.is_some());
731 | assert!(result.completion.total.is_some());
732 | assert!(!result.completion.values.is_empty());
733 | assert_eq!(result.completion.values.len(), 2);
734 | }
735 |
736 | #[test]
737 | fn test_complete_result_total_flag_matches_logic() {
738 | // Test the logic for has_more flag: should be true when total > values.len()
739 | let values = vec!["UTC".to_string()];
740 | let total = 500i64;
741 | let values_len = values.len() as i64;
742 |
743 | let has_more = total > values_len;
744 | assert!(has_more);
745 | }
746 |
747 | #[test]
748 | fn test_complete_result_no_more_when_all_returned() {
749 | // Test the logic for has_more flag: should be false when all results fit
750 | let values = vec!["UTC".to_string(), "America/New_York".to_string()];
751 | let total = values.len() as i64;
752 | let values_len = values.len() as i64;
753 |
754 | let has_more = total > values_len;
755 | assert!(!has_more);
756 | }
757 |
758 | #[test]
759 | fn test_get_prompt_valid() {
760 | let input = GetPromptRequest {
761 | context: PluginRequestContext::default(),
762 | request: GetPromptRequestParam {
763 | name: "get_time_with_timezone".to_string(),
764 | arguments: None,
765 | },
766 | };
767 |
768 | let result = get_prompt(input).expect("get_prompt should succeed");
769 | assert!(!result.messages.is_empty());
770 | assert!(result.description.is_some());
771 | }
772 |
773 | #[test]
774 | fn test_get_prompt_with_timezone() {
775 | let mut args = HashMap::new();
776 | args.insert("timezone".to_string(), "Europe/London".to_string());
777 |
778 | let input = GetPromptRequest {
779 | context: PluginRequestContext::default(),
780 | request: GetPromptRequestParam {
781 | name: "get_time_with_timezone".to_string(),
782 | arguments: Some(args),
783 | },
784 | };
785 |
786 | let result = get_prompt(input).expect("get_prompt should succeed");
787 | assert!(!result.messages.is_empty());
788 | assert!(result.description.is_some());
789 | }
790 |
791 | #[test]
792 | fn test_get_prompt_invalid_timezone() {
793 | let mut args = HashMap::new();
794 | args.insert("timezone".to_string(), "Invalid/Zone".to_string());
795 |
796 | let input = GetPromptRequest {
797 | context: PluginRequestContext::default(),
798 | request: GetPromptRequestParam {
799 | name: "get_time_with_timezone".to_string(),
800 | arguments: Some(args),
801 | },
802 | };
803 |
804 | let result = get_prompt(input).expect("get_prompt should succeed");
805 | assert!(!result.messages.is_empty());
806 | }
807 |
808 | #[test]
809 | fn test_get_prompt_not_found() {
810 | let input = GetPromptRequest {
811 | context: PluginRequestContext::default(),
812 | request: GetPromptRequestParam {
813 | name: "unknown_prompt".to_string(),
814 | arguments: None,
815 | },
816 | };
817 |
818 | let result = get_prompt(input);
819 | assert!(result.is_err());
820 | }
821 |
822 | #[test]
823 | fn test_list_prompts() {
824 | let input = ListPromptsRequest::default();
825 | let result = list_prompts(input).expect("list_prompts should succeed");
826 |
827 | assert!(!result.prompts.is_empty());
828 | assert_eq!(result.prompts[0].name, "get_time_with_timezone");
829 | assert!(result.prompts[0].description.is_some());
830 | assert!(result.prompts[0].arguments.is_some());
831 | }
832 |
833 | #[test]
834 | fn test_list_resource_templates() {
835 | let input = ListResourceTemplatesRequest::default();
836 | let result =
837 | list_resource_templates(input).expect("list_resource_templates should succeed");
838 |
839 | assert!(!result.resource_templates.is_empty());
840 | assert_eq!(result.resource_templates[0].name, "time_zone_converter");
841 | assert!(result.resource_templates[0].description.is_some());
842 | assert!(result.resource_templates[0].mime_type.is_some());
843 | }
844 |
845 | #[test]
846 | fn test_list_resources() {
847 | let input = ListResourcesRequest::default();
848 | let result = list_resources(input).expect("list_resources should succeed");
849 |
850 | assert!(result.resources.is_empty());
851 | }
852 |
853 | #[test]
854 | fn test_list_tools() {
855 | let input = ListToolsRequest::default();
856 | let result = list_tools(input).expect("list_tools should succeed");
857 |
858 | assert_eq!(result.tools.len(), 2);
859 | assert_eq!(result.tools[0].name, "get_time");
860 | assert_eq!(result.tools[1].name, "parse_time");
861 |
862 | assert!(result.tools[0].description.is_some());
863 | assert!(result.tools[0].input_schema.properties.is_some());
864 | assert!(result.tools[0].output_schema.is_some());
865 |
866 | assert!(result.tools[1].description.is_some());
867 | assert!(result.tools[1].input_schema.properties.is_some());
868 | assert!(result.tools[1].output_schema.is_some());
869 | }
870 |
871 | #[test]
872 | fn test_on_roots_list_changed() {
873 | let input = PluginNotificationContext::default();
874 | let result = on_roots_list_changed(input);
875 |
876 | assert!(result.is_ok());
877 | }
878 |
879 | #[test]
880 | fn test_prompt_reference_serialization() {
881 | // Test serializing a PromptReference and checking its structure
882 | let prompt_ref = PromptReference {
883 | name: "test_prompt".to_string(),
884 | title: None,
885 | r#type: PromptReferenceType::Prompt,
886 | };
887 |
888 | let json_value = serde_json::to_value(&prompt_ref).expect("should serialize");
889 | println!("Serialized PromptReference: {}", json_value);
890 |
891 | let json_obj = json_value.as_object().expect("should be object");
892 | assert!(json_obj.contains_key("type"), "Should have 'type' field");
893 | assert!(json_obj.contains_key("name"), "Should have 'name' field");
894 |
895 | // Check the type field value
896 | let type_value = json_obj.get("type").expect("type field exists");
897 | println!("Type field value: {}", type_value);
898 | assert_eq!(type_value, "prompt");
899 | }
900 |
901 | #[test]
902 | fn test_any_reference_deserialization() {
903 | // Test deserializing a PromptReference map into AnyReference
904 | let prompt_ref = PromptReference {
905 | name: "test_prompt".to_string(),
906 | title: None,
907 | r#type: PromptReferenceType::Prompt,
908 | };
909 |
910 | let json_string = serde_json::to_string(&prompt_ref).expect("should serialize");
911 |
912 | // Try to deserialize into AnyReference
913 | let any_ref: Reference =
914 | serde_json::from_str(&json_string).expect("should deserialize into Reference");
915 |
916 | match any_ref {
917 | Reference::Prompt(pr) => {
918 | assert_eq!(pr.name, "test_prompt");
919 | }
920 | _ => {
921 | panic!("Should have deserialized as Prompt, not other type");
922 | }
923 | }
924 | }
925 |
926 | #[test]
927 | fn test_complete_resource_with_utc_query() {
928 | // Test complete function with ResourceTemplateReference and UTC timezone query
929 | let resource_ref = ResourceTemplateReference {
930 | r#type: ResourceReferenceType::Resource,
931 | uri: "https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz={timezone}".to_string(),
932 | };
933 |
934 | let input = CompleteRequest {
935 | context: PluginRequestContext::default(),
936 | request: CompleteRequestParam {
937 | r#ref: Reference::ResourceTemplate(resource_ref),
938 | argument: CompleteRequestParamArgument {
939 | name: "timezone".to_string(),
940 | value: "utc".to_string(),
941 | },
942 | context: None,
943 | },
944 | };
945 |
946 | let result = complete(input).expect("complete should succeed");
947 | assert!(!result.completion.values.is_empty());
948 | assert!(result.completion.values.contains(&"UTC".to_string()));
949 | assert!(result.completion.total.is_some());
950 | }
951 |
952 | #[test]
953 | fn test_complete_resource_with_asia_query() {
954 | // Test complete function with ResourceTemplateReference and Asia timezone prefix
955 | let resource_ref = ResourceTemplateReference {
956 | r#type: ResourceReferenceType::Resource,
957 | uri: "https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz={timezone}".to_string(),
958 | };
959 |
960 | let input = CompleteRequest {
961 | context: PluginRequestContext::default(),
962 | request: CompleteRequestParam {
963 | r#ref: Reference::ResourceTemplate(resource_ref),
964 | argument: CompleteRequestParamArgument {
965 | name: "timezone".to_string(),
966 | value: "asia".to_string(),
967 | },
968 | context: None,
969 | },
970 | };
971 |
972 | let result = complete(input).expect("complete should succeed");
973 | assert!(!result.completion.values.is_empty());
974 | assert!(result.completion.values.contains(&"Asia/Tokyo".to_string()));
975 | assert!(result.completion.total.is_some());
976 | assert!(result.completion.has_more.is_some());
977 | }
978 |
979 | #[test]
980 | fn test_complete_resource_with_no_match() {
981 | // Test complete function with ResourceTemplateReference that has no matching timezones
982 | let resource_ref = ResourceTemplateReference {
983 | r#type: ResourceReferenceType::Resource,
984 | uri: "https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz={timezone}".to_string(),
985 | };
986 |
987 | let input = CompleteRequest {
988 | context: PluginRequestContext::default(),
989 | request: CompleteRequestParam {
990 | r#ref: Reference::ResourceTemplate(resource_ref),
991 | argument: CompleteRequestParamArgument {
992 | name: "timezone".to_string(),
993 | value: "nonexistent_tz".to_string(),
994 | },
995 | context: None,
996 | },
997 | };
998 |
999 | let result = complete(input).expect("complete should succeed");
1000 | assert!(result.completion.values.is_empty());
1001 | assert_eq!(result.completion.total, Some(0));
1002 | }
1003 |
1004 | #[test]
1005 | fn test_complete_resource_empty_query() {
1006 | // Test complete function with ResourceTemplateReference and empty query
1007 | let resource_ref = ResourceTemplateReference {
1008 | r#type: ResourceReferenceType::Resource,
1009 | uri: "https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz={timezone}".to_string(),
1010 | };
1011 |
1012 | let input = CompleteRequest {
1013 | context: PluginRequestContext::default(),
1014 | request: CompleteRequestParam {
1015 | r#ref: Reference::ResourceTemplate(resource_ref),
1016 | argument: CompleteRequestParamArgument {
1017 | name: "timezone".to_string(),
1018 | value: "".to_string(),
1019 | },
1020 | context: None,
1021 | },
1022 | };
1023 |
1024 | let result = complete(input).expect("complete should succeed");
1025 | // Empty query should match all timezones (up to 100)
1026 | assert!(!result.completion.values.is_empty());
1027 | assert_eq!(result.completion.values.len(), 100);
1028 | assert!(result.completion.total.is_some());
1029 | assert!(result.completion.has_more.is_some());
1030 | }
1031 |
1032 | #[test]
1033 | fn test_any_reference_deserialization_resource() {
1034 | // Test deserializing a ResourceTemplateReference map into AnyReference
1035 | let resource_ref = ResourceTemplateReference {
1036 | r#type: ResourceReferenceType::Resource,
1037 | uri: "https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz={timezone}".to_string(),
1038 | };
1039 |
1040 | let json_string = serde_json::to_string(&resource_ref).expect("should serialize");
1041 |
1042 | // Try to deserialize into AnyReference
1043 | let any_ref: Reference =
1044 | serde_json::from_str(&json_string).expect("should deserialize into AnyReference");
1045 |
1046 | match any_ref {
1047 | Reference::ResourceTemplate(rr) => {
1048 | assert_eq!(
1049 | rr.uri,
1050 | "https://www.timezoneconverter.com/cgi-bin/zoneinfo?tz={timezone}"
1051 | );
1052 | }
1053 | _ => {
1054 | panic!("Should have deserialized as Resource, not Prompt");
1055 | }
1056 | }
1057 | }
1058 | }
1059 |
```
--------------------------------------------------------------------------------
/xtp-plugin-schema.json:
--------------------------------------------------------------------------------
```json
1 | {
2 | "version": "v1-draft",
3 | "exports": {
4 | "call_tool": {
5 | "description": "Execute a tool call. This is the primary entry point for tool execution in plugins.\n\nThe plugin receives a tool call request with the tool name and arguments, along with request context information. The plugin should execute the requested tool and return the result with content blocks and optional structured output.",
6 | "input": {
7 | "$ref": "#/components/schemas/CallToolRequest",
8 | "contentType": "application/json"
9 | },
10 | "output": {
11 | "$ref": "#/components/schemas/CallToolResult",
12 | "contentType": "application/json"
13 | }
14 | },
15 | "complete": {
16 | "description": "Provide completion suggestions for a partially-typed input.\n\nThis function is called when the user requests autocompletion. The plugin should analyze the partial input and return matching completion suggestions based on the reference (prompt or resource) and argument context.",
17 | "input": {
18 | "$ref": "#/components/schemas/CompleteRequest",
19 | "contentType": "application/json"
20 | },
21 | "output": {
22 | "$ref": "#/components/schemas/CompleteResult",
23 | "contentType": "application/json"
24 | }
25 | },
26 | "get_prompt": {
27 | "description": "Retrieve a specific prompt by name.\n\nThis function is called when the user requests a specific prompt. The plugin should return the prompt details including messages and optional description.",
28 | "input": {
29 | "$ref": "#/components/schemas/GetPromptRequest",
30 | "contentType": "application/json"
31 | },
32 | "output": {
33 | "$ref": "#/components/schemas/GetPromptResult",
34 | "contentType": "application/json"
35 | }
36 | },
37 | "list_prompts": {
38 | "description": "List all available prompts.\n\nThis function should return a list of prompts that the plugin provides. Each prompt should include its name and a brief description of what it does. Supports pagination via cursor.",
39 | "input": {
40 | "$ref": "#/components/schemas/ListPromptsRequest",
41 | "contentType": "application/json"
42 | },
43 | "output": {
44 | "$ref": "#/components/schemas/ListPromptsResult",
45 | "contentType": "application/json"
46 | }
47 | },
48 | "list_resource_templates": {
49 | "description": "List all available resource templates.\n\nThis function should return a list of resource templates that the plugin provides. Templates are URI patterns that can match multiple resources. Supports pagination via cursor.",
50 | "input": {
51 | "$ref": "#/components/schemas/ListResourceTemplatesRequest",
52 | "contentType": "application/json"
53 | },
54 | "output": {
55 | "$ref": "#/components/schemas/ListResourceTemplatesResult",
56 | "contentType": "application/json"
57 | }
58 | },
59 | "list_resources": {
60 | "description": "List all available resources.\n\nThis function should return a list of resources that the plugin provides. Resources are URI-based references to files, data, or services. Supports pagination via cursor.",
61 | "input": {
62 | "$ref": "#/components/schemas/ListResourcesRequest",
63 | "contentType": "application/json"
64 | },
65 | "output": {
66 | "$ref": "#/components/schemas/ListResourcesResult",
67 | "contentType": "application/json"
68 | }
69 | },
70 | "list_tools": {
71 | "description": "List all available tools.\n\nThis function should return a list of all tools that the plugin provides. Each tool should include its name, description, and input schema. Supports pagination via cursor.",
72 | "input": {
73 | "$ref": "#/components/schemas/ListToolsRequest",
74 | "contentType": "application/json"
75 | },
76 | "output": {
77 | "$ref": "#/components/schemas/ListToolsResult",
78 | "contentType": "application/json"
79 | }
80 | },
81 | "on_roots_list_changed": {
82 | "description": "Notification that the list of roots has changed.\n\nThis is an optional notification handler. If implemented, the plugin will be notified whenever the roots list changes on the client side. This allows plugins to react to changes in the file system roots or other root resources.",
83 | "input": {
84 | "$ref": "#/components/schemas/PluginNotificationContext",
85 | "contentType": "application/json"
86 | }
87 | },
88 | "read_resource": {
89 | "description": "Read the contents of a resource by its URI.\n\nThis function is called when the user wants to read the contents of a specific resource. The plugin should retrieve and return the resource data with appropriate MIME type information.",
90 | "input": {
91 | "$ref": "#/components/schemas/ReadResourceRequest",
92 | "contentType": "application/json"
93 | },
94 | "output": {
95 | "$ref": "#/components/schemas/ReadResourceResult",
96 | "contentType": "application/json"
97 | }
98 | }
99 | },
100 | "imports": {
101 | "create_elicitation": {
102 | "description": "Request user input through the client's elicitation interface.\n\nPlugins can use this to ask users for input, decisions, or confirmations. This is useful for interactive plugins that need user guidance during tool execution. Returns the user's response with action and optional form data.",
103 | "input": {
104 | "$ref": "#/components/schemas/ElicitRequestParamWithTimeout",
105 | "contentType": "application/json"
106 | },
107 | "output": {
108 | "$ref": "#/components/schemas/ElicitResult",
109 | "contentType": "application/json"
110 | }
111 | },
112 | "create_message": {
113 | "description": "Request message creation through the client's sampling interface.\n\nPlugins can use this to have the client create messages, typically with AI assistance. This is used when plugins need intelligent text generation or analysis. Returns the generated message with model information.",
114 | "input": {
115 | "$ref": "#/components/schemas/CreateMessageRequestParam",
116 | "contentType": "application/json"
117 | },
118 | "output": {
119 | "$ref": "#/components/schemas/CreateMessageResult",
120 | "contentType": "application/json"
121 | }
122 | },
123 | "list_roots": {
124 | "description": "List the client's root directories or resources.\n\nPlugins can query this to discover what root resources (typically file system roots) are available on the client side. This helps plugins understand the scope of resources they can access.",
125 | "output": {
126 | "$ref": "#/components/schemas/ListRootsResult",
127 | "contentType": "application/json"
128 | }
129 | },
130 | "notify_logging_message": {
131 | "description": "Send a logging message to the client.\n\nPlugins use this to report diagnostic, informational, warning, or error messages. The client's logging level determines which messages are processed.",
132 | "input": {
133 | "$ref": "#/components/schemas/LoggingMessageNotificationParam",
134 | "contentType": "application/json"
135 | }
136 | },
137 | "notify_progress": {
138 | "description": "Send a progress notification to the client.\n\nPlugins use this to report progress during long-running operations. This allows clients to display progress bars or status information to users.",
139 | "input": {
140 | "$ref": "#/components/schemas/ProgressNotificationParam",
141 | "contentType": "application/json"
142 | }
143 | },
144 | "notify_prompt_list_changed": {
145 | "description": "Notify the client that the list of available prompts has changed.\n\nPlugins should call this when they add, remove, or modify their available prompts. The client will typically refresh its prompt list in response."
146 | },
147 | "notify_resource_list_changed": {
148 | "description": "Notify the client that the list of available resources has changed.\n\nPlugins should call this when they add, remove, or modify their available resources. The client will typically refresh its resource list in response."
149 | },
150 | "notify_resource_updated": {
151 | "description": "Notify the client that a specific resource has been updated.\n\nPlugins should call this when they modify the contents of a resource. The client can use this to invalidate caches and refresh resource displays.",
152 | "input": {
153 | "$ref": "#/components/schemas/ResourceUpdatedNotificationParam",
154 | "contentType": "application/json"
155 | }
156 | },
157 | "notify_tool_list_changed": {
158 | "description": "Notify the client that the list of available tools has changed.\n\nPlugins should call this when they add, remove, or modify their available tools. The client will typically refresh its tool list in response."
159 | }
160 | },
161 | "components": {
162 | "schemas": {
163 | "Annotations": {
164 | "description": "Content annotations for categorization and priority",
165 | "properties": {
166 | "audience": {
167 | "description": "Intended audience for the resource",
168 | "type": "array",
169 | "items": {
170 | "$ref": "#/components/schemas/Role"
171 | }
172 | },
173 | "lastModified": {
174 | "description": "Last modified timestamp for the resource",
175 | "type": "string",
176 | "format": "date-time"
177 | },
178 | "priority": {
179 | "description": "Priority level indicating the importance of the resource",
180 | "type": "number",
181 | "format": "float"
182 | }
183 | }
184 | },
185 | "AudioContent": {
186 | "description": "Audio content block",
187 | "properties": {
188 | "data": {
189 | "type": "string",
190 | "description": "Base64-encoded audio data"
191 | },
192 | "mimeType": {
193 | "type": "string",
194 | "description": "MIME type of the audio (e.g. 'audio/mpeg')"
195 | },
196 | "type": {
197 | "$ref": "#/components/schemas/AudioType"
198 | },
199 | "annotations": {
200 | "$ref": "#/components/schemas/Annotations",
201 | "description": "Optional content annotations"
202 | },
203 | "_meta": {
204 | "type": "object",
205 | "description": "Optional additional metadata about the content block"
206 | }
207 | },
208 | "required": ["data", "mimeType", "type"]
209 | },
210 | "AudioType": {
211 | "type": "string",
212 | "enum": ["audio"]
213 | },
214 | "BlobResourceContents": {
215 | "description": "Binary content of a resource",
216 | "properties": {
217 | "blob": {
218 | "type": "string",
219 | "description": "Base64-encoded binary data of the resource"
220 | },
221 | "uri": {
222 | "type": "string",
223 | "description": "URI of the resource"
224 | },
225 | "mimeType": {
226 | "type": "string",
227 | "description": "MIME type of the binary content (e.g. 'application/pdf')"
228 | },
229 | "_meta": {
230 | "type": "object",
231 | "description": "Optional additional metadata about the blob resource"
232 | }
233 | },
234 | "required": ["blob", "uri"]
235 | },
236 | "BooleanSchema": {
237 | "description": "Schema for a boolean input",
238 | "properties": {
239 | "type": {
240 | "$ref": "#/components/schemas/BooleanType"
241 | },
242 | "description": {
243 | "type": "string",
244 | "description": "Description of the boolean input"
245 | },
246 | "title": {
247 | "type": "string",
248 | "description": "Optional human-readable title"
249 | },
250 | "default": {
251 | "type": "boolean",
252 | "description": "Optional default value"
253 | }
254 | },
255 | "required": ["type"]
256 | },
257 | "BooleanType": {
258 | "type": "string",
259 | "enum": ["boolean"]
260 | },
261 | "CallToolRequest": {
262 | "description": "Input for the call_tool export function",
263 | "properties": {
264 | "request": {
265 | "$ref": "#/components/schemas/CallToolRequestParam"
266 | },
267 | "context": {
268 | "$ref": "#/components/schemas/PluginRequestContext"
269 | }
270 | },
271 | "required": ["request", "context"]
272 | },
273 | "CallToolRequestParam": {
274 | "description": "Parameters for a tool call request",
275 | "properties": {
276 | "name": {
277 | "type": "string",
278 | "description": "The name of the tool to call"
279 | },
280 | "arguments": {
281 | "type": "object",
282 | "description": "Arguments to pass to the tool"
283 | }
284 | },
285 | "required": ["name"]
286 | },
287 | "CallToolResult": {
288 | "description": "Result of a tool call containing content blocks and optional structured output",
289 | "properties": {
290 | "content": {
291 | "type": "array",
292 | "description": "Array of TextContent, ImageContent, AudioContent, EmbeddedResource, or ResourceLinks representing the result",
293 | "items": {
294 | "type": "object"
295 | }
296 | },
297 | "isError": {
298 | "type": "boolean",
299 | "description": "Whether the tool call ended in an error. If not set, defaults to false."
300 | },
301 | "structuredContent": {
302 | "type": "object",
303 | "description": "Optional structured JSON result from the tool"
304 | },
305 | "_meta": {
306 | "type": "object",
307 | "description": "Optional additional metadata about the tool call result"
308 | }
309 | },
310 | "required": ["content"]
311 | },
312 | "CompleteRequest": {
313 | "description": "Input for the complete export function",
314 | "properties": {
315 | "request": {
316 | "$ref": "#/components/schemas/CompleteRequestParam"
317 | },
318 | "context": {
319 | "$ref": "#/components/schemas/PluginRequestContext"
320 | }
321 | },
322 | "required": ["request", "context"]
323 | },
324 | "CompleteRequestParam": {
325 | "description": "Parameters for a completion request",
326 | "properties": {
327 | "ref": {
328 | "type": "object",
329 | "description": "Reference to either a PromptReference or ResourceTemplateReference"
330 | },
331 | "argument": {
332 | "$ref": "#/components/schemas/CompleteRequestParamArgument"
333 | },
334 | "context": {
335 | "type": "object",
336 | "description": "Optional completion context with previously-resolved arguments"
337 | }
338 | },
339 | "required": ["ref", "argument"]
340 | },
341 | "CompleteRequestParamArgument": {
342 | "description": "The argument being completed",
343 | "properties": {
344 | "name": {
345 | "type": "string",
346 | "description": "Name of the argument"
347 | },
348 | "value": {
349 | "type": "string",
350 | "description": "Current value to complete"
351 | }
352 | },
353 | "required": ["name", "value"]
354 | },
355 | "CompleteResult": {
356 | "description": "Result of a completion request",
357 | "properties": {
358 | "completion": {
359 | "$ref": "#/components/schemas/CompleteResultCompletion"
360 | }
361 | },
362 | "required": ["completion"]
363 | },
364 | "CompleteResultCompletion": {
365 | "description": "Completion result with values",
366 | "properties": {
367 | "values": {
368 | "type": "array",
369 | "items": {
370 | "type": "string"
371 | },
372 | "description": "Array of completion values (max 100 items)"
373 | },
374 | "total": {
375 | "type": "integer",
376 | "description": "Total number of available completions"
377 | },
378 | "hasMore": {
379 | "type": "boolean",
380 | "description": "Whether there are more completions available"
381 | }
382 | },
383 | "required": ["values"]
384 | },
385 | "ElicitRequestParamWithTimeout": {
386 | "description": "Input for the create_elicitation import function",
387 | "properties": {
388 | "message": {
389 | "type": "string",
390 | "description": "Message to present to the user"
391 | },
392 | "requestedSchema": {
393 | "$ref": "#/components/schemas/Schema"
394 | },
395 | "timeout": {
396 | "type": "integer",
397 | "description": "Optional timeout in milliseconds"
398 | }
399 | },
400 | "required": ["message", "requestedSchema"]
401 | },
402 | "ElicitResult": {
403 | "description": "Result of an elicitation request",
404 | "properties": {
405 | "action": {
406 | "$ref": "#/components/schemas/ElicitResultAction"
407 | },
408 | "content": {
409 | "type": "object",
410 | "description": "Form data submitted by user (only present when action is accept)"
411 | }
412 | },
413 | "required": ["action"]
414 | },
415 | "ElicitResultAction": {
416 | "description": "User's action in response to elicitation",
417 | "type": "string",
418 | "enum": ["accept", "decline", "cancel"]
419 | },
420 | "CreateMessageRequestParam": {
421 | "description": "Input for the create_message import function",
422 | "properties": {
423 | "messages": {
424 | "type": "array",
425 | "description": "Conversation messages of of TextContent, ImageContent or AudioContent",
426 | "items": {
427 | "type": "object"
428 | }
429 | },
430 | "maxTokens": {
431 | "type": "integer",
432 | "description": "Maximum tokens to sample"
433 | },
434 | "systemPrompt": {
435 | "type": "string",
436 | "description": "Optional system prompt"
437 | },
438 | "temperature": {
439 | "type": "number",
440 | "description": "Sampling temperature"
441 | },
442 | "stopSequences": {
443 | "type": "array",
444 | "items": {
445 | "type": "string"
446 | },
447 | "description": "Stop sequences"
448 | },
449 | "modelPreferences": {
450 | "$ref": "#/components/schemas/ModelPreferences",
451 | "description": "Preferences for model selection"
452 | },
453 | "includeContext": {
454 | "$ref": "#/components/schemas/CreateMessageRequestParamIncludeContext"
455 | }
456 | },
457 | "required": ["messages", "maxTokens"]
458 | },
459 | "CreateMessageRequestParamIncludeContext": {
460 | "description": "Context inclusion level",
461 | "type": "string",
462 | "enum": ["none", "thisServer", "allServers"]
463 | },
464 | "CreateMessageResult": {
465 | "description": "Result of message creation",
466 | "properties": {
467 | "content": {
468 | "type": "object",
469 | "description": "One of TextContent, ImageContent or AudioContent"
470 | },
471 | "model": {
472 | "type": "string",
473 | "description": "Name of the model used"
474 | },
475 | "role": {
476 | "$ref": "#/components/schemas/Role"
477 | },
478 | "stopReason": {
479 | "type": "string",
480 | "description": "Optional reason sampling stopped"
481 | }
482 | },
483 | "required": ["content", "model", "role"]
484 | },
485 | "EmbeddedResource": {
486 | "description": "An embedded resource with data",
487 | "properties": {
488 | "resource": {
489 | "type": "object",
490 | "description": "The embedded TextResourceContents or BlobResourceContents"
491 | },
492 | "type": {
493 | "$ref": "#/components/schemas/ResourceType"
494 | },
495 | "_meta": {
496 | "type": "object",
497 | "description": "Optional additional metadata about the embedded resource"
498 | },
499 | "annotations": {
500 | "$ref": "#/components/schemas/Annotations",
501 | "description": "Optional resource annotations"
502 | }
503 | },
504 | "required": ["resource", "type"]
505 | },
506 | "EnumSchema": {
507 | "description": "Schema for an enum input",
508 | "properties": {
509 | "type": {
510 | "$ref": "#/components/schemas/StringType"
511 | },
512 | "description": {
513 | "type": "string",
514 | "description": "Description of the enum input"
515 | },
516 | "enum": {
517 | "type": "array",
518 | "items": {
519 | "type": "string"
520 | },
521 | "description": "Array of allowed string values"
522 | },
523 | "enumNames": {
524 | "type": "array",
525 | "items": {
526 | "type": "string"
527 | },
528 | "description": "Optional array of human-readable names for the enum values"
529 | },
530 | "title": {
531 | "type": "string",
532 | "description": "Optional human-readable title"
533 | }
534 | },
535 | "required": ["type", "enum"]
536 | },
537 | "GetPromptRequest": {
538 | "description": "Input for the get_prompt export function",
539 | "properties": {
540 | "request": {
541 | "$ref": "#/components/schemas/GetPromptRequestParam"
542 | },
543 | "context": {
544 | "$ref": "#/components/schemas/PluginRequestContext"
545 | }
546 | },
547 | "required": ["request", "context"]
548 | },
549 | "GetPromptRequestParam": {
550 | "description": "Parameters for get_prompt request",
551 | "properties": {
552 | "name": {
553 | "type": "string",
554 | "description": "Name of the prompt to retrieve"
555 | },
556 | "arguments": {
557 | "type": "object",
558 | "description": "Arguments for templating the prompt"
559 | }
560 | },
561 | "required": ["name"]
562 | },
563 | "GetPromptResult": {
564 | "description": "Result of retrieving a prompt",
565 | "properties": {
566 | "messages": {
567 | "type": "array",
568 | "description": "Array of prompt messages",
569 | "items": {
570 | "$ref": "#/components/schemas/PromptMessage"
571 | }
572 | },
573 | "description": {
574 | "type": "string",
575 | "description": "Optional description of the prompt"
576 | }
577 | },
578 | "required": ["messages"]
579 | },
580 | "ImageContent": {
581 | "description": "Image content block",
582 | "properties": {
583 | "data": {
584 | "type": "string",
585 | "description": "Base64-encoded image data"
586 | },
587 | "mimeType": {
588 | "type": "string",
589 | "description": "MIME type of the image (e.g. 'image/png')"
590 | },
591 | "type": {
592 | "$ref": "#/components/schemas/ImageType"
593 | },
594 | "annotations": {
595 | "$ref": "#/components/schemas/Annotations",
596 | "description": "Optional content annotations"
597 | },
598 | "_meta": {
599 | "type": "object",
600 | "description": "Optional additional metadata about the content block"
601 | }
602 | },
603 | "required": ["data", "mimeType", "type"]
604 | },
605 | "ImageType": {
606 | "type": "string",
607 | "enum": ["image"]
608 | },
609 | "ListPromptsRequest": {
610 | "description": "Input for the list_prompts export function",
611 | "properties": {
612 | "context": {
613 | "$ref": "#/components/schemas/PluginRequestContext"
614 | }
615 | },
616 | "required": ["context"]
617 | },
618 | "ListPromptsResult": {
619 | "description": "Result of listing prompts",
620 | "properties": {
621 | "prompts": {
622 | "type": "array",
623 | "description": "Array of available prompts",
624 | "items": {
625 | "$ref": "#/components/schemas/Prompt"
626 | }
627 | }
628 | },
629 | "required": ["prompts"]
630 | },
631 | "ListResourceTemplatesRequest": {
632 | "description": "Input for the list_resource_templates export function",
633 | "properties": {
634 | "context": {
635 | "$ref": "#/components/schemas/PluginRequestContext"
636 | }
637 | },
638 | "required": ["context"]
639 | },
640 | "ListResourceTemplatesResult": {
641 | "description": "Result of listing resource templates",
642 | "properties": {
643 | "resourceTemplates": {
644 | "type": "array",
645 | "description": "Array of resource templates",
646 | "items": {
647 | "$ref": "#/components/schemas/ResourceTemplate"
648 | }
649 | },
650 | "nextCursor": {
651 | "type": "string",
652 | "description": "Optional cursor for pagination"
653 | }
654 | },
655 | "required": ["resourceTemplates"]
656 | },
657 | "ListResourcesRequest": {
658 | "description": "Input for the list_resources export function",
659 | "properties": {
660 | "context": {
661 | "$ref": "#/components/schemas/PluginRequestContext"
662 | }
663 | },
664 | "required": ["context"]
665 | },
666 | "ListResourcesResult": {
667 | "description": "Result of listing resources",
668 | "properties": {
669 | "resources": {
670 | "type": "array",
671 | "description": "Array of available resources",
672 | "items": {
673 | "$ref": "#/components/schemas/Resource"
674 | }
675 | }
676 | },
677 | "required": ["resources"]
678 | },
679 | "ListRootsResult": {
680 | "description": "Result of listing roots",
681 | "properties": {
682 | "roots": {
683 | "type": "array",
684 | "description": "Array of root directories/resources",
685 | "items": {
686 | "$ref": "#/components/schemas/Root"
687 | }
688 | }
689 | },
690 | "required": ["roots"]
691 | },
692 | "ListToolsRequest": {
693 | "description": "Input for the list_tools export function",
694 | "properties": {
695 | "context": {
696 | "$ref": "#/components/schemas/PluginRequestContext"
697 | }
698 | },
699 | "required": ["context"]
700 | },
701 | "ListToolsResult": {
702 | "description": "Result of listing tools",
703 | "properties": {
704 | "tools": {
705 | "type": "array",
706 | "description": "Array of available tools",
707 | "items": {
708 | "$ref": "#/components/schemas/Tool"
709 | }
710 | }
711 | },
712 | "required": ["tools"]
713 | },
714 | "LoggingLevel": {
715 | "description": "Logging level (syslog severity)",
716 | "type": "string",
717 | "enum": [
718 | "debug",
719 | "info",
720 | "notice",
721 | "warning",
722 | "error",
723 | "critical",
724 | "alert",
725 | "emergency"
726 | ]
727 | },
728 | "LoggingMessageNotificationParam": {
729 | "description": "Parameters for notify_logging_message",
730 | "properties": {
731 | "level": {
732 | "$ref": "#/components/schemas/LoggingLevel"
733 | },
734 | "data": {
735 | "description": "Data to log (any JSON-serializable type)",
736 | "type": "object"
737 | },
738 | "logger": {
739 | "type": "string",
740 | "description": "Optional logger name"
741 | }
742 | },
743 | "required": ["level", "data"]
744 | },
745 | "ModelHint": {
746 | "description": "A hint for model selection",
747 | "properties": {
748 | "name": {
749 | "type": "string",
750 | "description": "Suggested model name or family"
751 | }
752 | }
753 | },
754 | "ModelPreferences": {
755 | "description": "Server preferences for model selection",
756 | "properties": {
757 | "costPriority": {
758 | "type": "number",
759 | "format": "float",
760 | "description": "Priority for cost (0-1)"
761 | },
762 | "speedPriority": {
763 | "type": "number",
764 | "format": "float",
765 | "description": "Priority for speed (0-1)"
766 | },
767 | "intelligencePriority": {
768 | "type": "number",
769 | "format": "float",
770 | "description": "Priority for intelligence (0-1)"
771 | },
772 | "hints": {
773 | "type": "array",
774 | "description": "Model name hints",
775 | "items": {
776 | "$ref": "#/components/schemas/ModelHint"
777 | }
778 | }
779 | }
780 | },
781 | "NumberSchema": {
782 | "description": "Schema for a number input",
783 | "properties": {
784 | "type": {
785 | "$ref": "#/components/schemas/NumberType"
786 | },
787 | "description": {
788 | "type": "string",
789 | "description": "Description of the number input"
790 | },
791 | "minimum": {
792 | "type": "number",
793 | "description": "Minimum value"
794 | },
795 | "maximum": {
796 | "type": "number",
797 | "description": "Maximum value"
798 | },
799 | "title": {
800 | "type": "string",
801 | "description": "Optional human-readable title"
802 | }
803 | },
804 | "required": ["type"]
805 | },
806 | "NumberType": {
807 | "description": "Number type",
808 | "type": "string",
809 | "enum": ["number", "integer"]
810 | },
811 | "ObjectType": {
812 | "description": "The type of schema requested for elicitation",
813 | "type": "string",
814 | "enum": ["object"]
815 | },
816 | "PluginNotificationContext": {
817 | "description": "Context information for notification-type plugin function calls. Contains metadata passed through the MCP protocol.",
818 | "properties": {
819 | "_meta": {
820 | "type": "object",
821 | "description": "Additional metadata about the notification"
822 | }
823 | },
824 | "required": ["_meta"]
825 | },
826 | "PluginRequestContext": {
827 | "description": "Context information for request-type plugin function calls. Contains the request ID and metadata passed through the MCP protocol.",
828 | "properties": {
829 | "id": {
830 | "type": "string",
831 | "description": "Unique identifier for this request"
832 | },
833 | "_meta": {
834 | "type": "object",
835 | "description": "Additional metadata about the request"
836 | }
837 | },
838 | "required": ["id", "_meta"]
839 | },
840 | "ProgressNotificationParam": {
841 | "description": "Parameters for notify_progress to track long-running operations",
842 | "properties": {
843 | "progress": {
844 | "type": "number",
845 | "description": "The progress thus far"
846 | },
847 | "progressToken": {
848 | "type": "string",
849 | "description": "A token identifying the progress context"
850 | },
851 | "total": {
852 | "type": "number",
853 | "description": "Optional total units of work"
854 | },
855 | "message": {
856 | "type": "string",
857 | "description": "Optional progress message describing current operation"
858 | }
859 | },
860 | "required": ["progress", "progressToken"]
861 | },
862 | "Prompt": {
863 | "description": "A prompt template",
864 | "properties": {
865 | "name": {
866 | "type": "string",
867 | "description": "Unique name of the prompt"
868 | },
869 | "title": {
870 | "type": "string",
871 | "description": "Human-readable title"
872 | },
873 | "description": {
874 | "type": "string",
875 | "description": "Description of what the prompt does"
876 | },
877 | "arguments": {
878 | "type": "array",
879 | "description": "Optional prompt arguments",
880 | "items": {
881 | "$ref": "#/components/schemas/PromptArgument"
882 | }
883 | }
884 | },
885 | "required": ["name"]
886 | },
887 | "PromptArgument": {
888 | "description": "An argument that a prompt accepts",
889 | "properties": {
890 | "name": {
891 | "type": "string",
892 | "description": "Name of the argument"
893 | },
894 | "title": {
895 | "type": "string",
896 | "description": "Human-readable title"
897 | },
898 | "description": {
899 | "type": "string",
900 | "description": "Description of the argument"
901 | },
902 | "required": {
903 | "type": "boolean",
904 | "description": "Whether this argument is required"
905 | }
906 | },
907 | "required": ["name"]
908 | },
909 | "PromptMessage": {
910 | "description": "A message in a prompt",
911 | "properties": {
912 | "role": {
913 | "$ref": "#/components/schemas/Role"
914 | },
915 | "content": {
916 | "type": "object",
917 | "description": "One of TextContent, ImageContent, AudioContent, EmbeddedResource, or ResourceLink"
918 | }
919 | },
920 | "required": ["role", "content"]
921 | },
922 | "PromptReference": {
923 | "description": "Reference to a prompt by name",
924 | "properties": {
925 | "type": {
926 | "$ref": "#/components/schemas/PromptReferenceType"
927 | },
928 | "name": {
929 | "type": "string",
930 | "description": "Name of the prompt"
931 | },
932 | "title": {
933 | "type": "string",
934 | "description": "Optional human-readable title"
935 | }
936 | },
937 | "required": ["type", "name"]
938 | },
939 | "PromptReferenceType": {
940 | "description": "The type of prompt content",
941 | "type": "string",
942 | "enum": ["prompt"]
943 | },
944 | "ReadResourceRequest": {
945 | "description": "Input for the read_resource export function",
946 | "properties": {
947 | "request": {
948 | "$ref": "#/components/schemas/ReadResourceRequestParam"
949 | },
950 | "context": {
951 | "$ref": "#/components/schemas/PluginRequestContext"
952 | }
953 | },
954 | "required": ["request", "context"]
955 | },
956 | "ReadResourceRequestParam": {
957 | "description": "Parameters for a read resource request",
958 | "properties": {
959 | "uri": {
960 | "type": "string",
961 | "description": "URI of the resource to read"
962 | }
963 | },
964 | "required": ["uri"]
965 | },
966 | "ReadResourceResult": {
967 | "description": "Result of reading a resource",
968 | "properties": {
969 | "contents": {
970 | "type": "array",
971 | "description": "Array of TextResourceContents or BlobResourceContents",
972 | "items": {
973 | "type": "object"
974 | }
975 | }
976 | },
977 | "required": ["contents"]
978 | },
979 | "Resource": {
980 | "description": "A resource available from the plugin",
981 | "properties": {
982 | "uri": {
983 | "type": "string",
984 | "description": "URI of the resource"
985 | },
986 | "name": {
987 | "type": "string",
988 | "description": "Human-readable name"
989 | },
990 | "title": {
991 | "type": "string",
992 | "description": "Human-readable title"
993 | },
994 | "description": {
995 | "type": "string",
996 | "description": "Description of the resource"
997 | },
998 | "mimeType": {
999 | "type": "string",
1000 | "description": "MIME type of the resource"
1001 | },
1002 | "size": {
1003 | "type": "integer",
1004 | "description": "Size in bytes"
1005 | },
1006 | "annotations": {
1007 | "$ref": "#/components/schemas/Annotations",
1008 | "description": "Optional resource annotations"
1009 | }
1010 | },
1011 | "required": ["name", "uri"]
1012 | },
1013 | "ResourceLink": {
1014 | "description": "A link to a resource by its URI",
1015 | "properties": {
1016 | "uri": {
1017 | "type": "string",
1018 | "description": "URI of the resource"
1019 | },
1020 | "name": {
1021 | "type": "string",
1022 | "description": "Optional human-readable name"
1023 | },
1024 | "title": {
1025 | "type": "string",
1026 | "description": "Optional human-readable title"
1027 | },
1028 | "description": {
1029 | "type": "string",
1030 | "description": "Optional description of the resource"
1031 | },
1032 | "mimeType": {
1033 | "type": "string",
1034 | "description": "Optional MIME type of the resource"
1035 | },
1036 | "size": {
1037 | "type": "integer",
1038 | "description": "Optional size in bytes"
1039 | },
1040 | "annotations": {
1041 | "$ref": "#/components/schemas/Annotations",
1042 | "description": "Optional resource annotations"
1043 | },
1044 | "type": {
1045 | "$ref": "#/components/schemas/ResourceLinkType"
1046 | },
1047 | "_meta": {
1048 | "type": "object",
1049 | "description": "Optional additional metadata about the resource link"
1050 | }
1051 | },
1052 | "required": ["uri", "name", "type"]
1053 | },
1054 | "ResourceLinkType": {
1055 | "description": "The type of resource link",
1056 | "type": "string",
1057 | "enum": ["resource_link"]
1058 | },
1059 | "ResourceReferenceType": {
1060 | "description": "The type of resource content",
1061 | "type": "string",
1062 | "enum": ["resource"]
1063 | },
1064 | "ResourceTemplate": {
1065 | "description": "A template for resources matching a URI pattern",
1066 | "properties": {
1067 | "uriTemplate": {
1068 | "type": "string",
1069 | "description": "RFC 6570 URI template pattern"
1070 | },
1071 | "name": {
1072 | "type": "string",
1073 | "description": "Human-readable name"
1074 | },
1075 | "title": {
1076 | "type": "string",
1077 | "description": "Human-readable title"
1078 | },
1079 | "description": {
1080 | "type": "string",
1081 | "description": "Description of the template"
1082 | },
1083 | "mimeType": {
1084 | "type": "string",
1085 | "description": "MIME type for resources matching this template"
1086 | },
1087 | "annotations": {
1088 | "$ref": "#/components/schemas/Annotations"
1089 | }
1090 | },
1091 | "required": ["name", "uriTemplate"]
1092 | },
1093 | "ResourceTemplateReference": {
1094 | "description": "Reference to a resource template by URI pattern",
1095 | "properties": {
1096 | "type": {
1097 | "$ref": "#/components/schemas/ResourceReferenceType"
1098 | },
1099 | "uri": {
1100 | "type": "string",
1101 | "description": "URI or URI template pattern of the resource"
1102 | }
1103 | },
1104 | "required": ["type", "uri"]
1105 | },
1106 | "ResourceType": {
1107 | "description": "The type of resource content",
1108 | "type": "string",
1109 | "enum": ["resource"]
1110 | },
1111 | "ResourceUpdatedNotificationParam": {
1112 | "description": "Parameters for notify_resource_updated to notify about specific resource updates",
1113 | "properties": {
1114 | "uri": {
1115 | "type": "string",
1116 | "description": "URI of the updated resource"
1117 | }
1118 | },
1119 | "required": ["uri"]
1120 | },
1121 | "Role": {
1122 | "description": "Intended audience/role for content or resources",
1123 | "type": "string",
1124 | "enum": ["assistant", "user"]
1125 | },
1126 | "Root": {
1127 | "description": "A root directory or resource",
1128 | "properties": {
1129 | "uri": {
1130 | "type": "string",
1131 | "description": "URI of the root (typically file://)"
1132 | },
1133 | "name": {
1134 | "type": "string",
1135 | "description": "Optional human-readable name"
1136 | }
1137 | },
1138 | "required": ["uri"]
1139 | },
1140 | "Schema": {
1141 | "description": "A JSON Schema definitions",
1142 | "properties": {
1143 | "type": {
1144 | "$ref": "#/components/schemas/ObjectType"
1145 | },
1146 | "properties": {
1147 | "type": "object",
1148 | "description": "A map of StringSchema, NumberSchema, BooleanSchema or EnumSchema definitions (no nesting)"
1149 | },
1150 | "required": {
1151 | "type": "array",
1152 | "items": {
1153 | "type": "string"
1154 | },
1155 | "description": "Required property names"
1156 | }
1157 | },
1158 | "required": ["type", "properties"]
1159 | },
1160 | "StringSchema": {
1161 | "description": "Schema for a string input",
1162 | "properties": {
1163 | "type": {
1164 | "$ref": "#/components/schemas/StringType"
1165 | },
1166 | "description": {
1167 | "type": "string",
1168 | "description": "Description of the string input"
1169 | },
1170 | "minLength": {
1171 | "type": "integer",
1172 | "description": "Minimum length of the string"
1173 | },
1174 | "maxLength": {
1175 | "type": "integer",
1176 | "description": "Maximum length of the string"
1177 | },
1178 | "format": {
1179 | "$ref": "#/components/schemas/StringSchemaFormat"
1180 | },
1181 | "title": {
1182 | "type": "string",
1183 | "description": "Optional human-readable title"
1184 | }
1185 | },
1186 | "required": ["type"]
1187 | },
1188 | "StringSchemaFormat": {
1189 | "description": "Format of the string schema",
1190 | "type": "string",
1191 | "enum": ["email", "uri", "date", "date_time"]
1192 | },
1193 | "StringType": {
1194 | "description": "String type",
1195 | "type": "string",
1196 | "enum": ["string"]
1197 | },
1198 | "TextContent": {
1199 | "description": "Text content block",
1200 | "properties": {
1201 | "text": {
1202 | "type": "string",
1203 | "description": "The text content"
1204 | },
1205 | "type": {
1206 | "$ref": "#/components/schemas/TextType"
1207 | },
1208 | "annotations": {
1209 | "$ref": "#/components/schemas/Annotations",
1210 | "description": "Optional content annotations"
1211 | },
1212 | "_meta": {
1213 | "type": "object",
1214 | "description": "Optional additional metadata about the content block"
1215 | }
1216 | },
1217 | "required": ["text", "type"]
1218 | },
1219 | "TextResourceContents": {
1220 | "description": "Text content of a resource",
1221 | "properties": {
1222 | "text": {
1223 | "type": "string",
1224 | "description": "Text content of the resource"
1225 | },
1226 | "uri": {
1227 | "type": "string",
1228 | "description": "URI of the resource"
1229 | },
1230 | "mimeType": {
1231 | "type": "string",
1232 | "description": "MIME type of the text content (e.g. 'text/plain')"
1233 | },
1234 | "_meta": {
1235 | "type": "object",
1236 | "description": "Optional additional metadata about the text resource"
1237 | }
1238 | },
1239 | "required": ["text", "uri"]
1240 | },
1241 | "TextType": {
1242 | "type": "string",
1243 | "enum": ["text"]
1244 | },
1245 | "Tool": {
1246 | "description": "A tool offered by the plugin",
1247 | "properties": {
1248 | "name": {
1249 | "type": "string",
1250 | "description": "Unique name of the tool"
1251 | },
1252 | "title": {
1253 | "type": "string",
1254 | "description": "Human-readable title"
1255 | },
1256 | "description": {
1257 | "type": "string",
1258 | "description": "Description of what the tool does"
1259 | },
1260 | "inputSchema": {
1261 | "$ref": "#/components/schemas/ToolSchema"
1262 | },
1263 | "outputSchema": {
1264 | "$ref": "#/components/schemas/ToolSchema"
1265 | },
1266 | "annotations": {
1267 | "$ref": "#/components/schemas/Annotations",
1268 | "description": "Optional tool annotations"
1269 | }
1270 | },
1271 | "required": ["name", "inputSchema"]
1272 | },
1273 | "ToolSchema": {
1274 | "description": "Schema for tool input/output arguments",
1275 | "properties": {
1276 | "type": {
1277 | "$ref": "#/components/schemas/ObjectType"
1278 | },
1279 | "properties": {
1280 | "type": "object",
1281 | "description": "Schema properties"
1282 | },
1283 | "required": {
1284 | "type": "array",
1285 | "items": {
1286 | "type": "string"
1287 | },
1288 | "description": "Required properties"
1289 | }
1290 | },
1291 | "required": ["type"]
1292 | }
1293 | }
1294 | }
1295 | }
1296 |
```
--------------------------------------------------------------------------------
/examples/plugins/v1/meme-generator/src/embedded.rs:
--------------------------------------------------------------------------------
```rust
1 | // Embed templates.json
2 | pub const TEMPLATES_JSON: &str = include_str!("../templates.json");
3 |
4 | // Embed font data
5 | pub const FONT_DATA: &[u8] = include_bytes!("../assets/fonts/NotoSans-Bold.ttf");
6 |
7 | // Function to get template config
8 | pub fn get_template_config(template_id: &str) -> Option<&'static str> {
9 | match template_id {
10 | "aag" => Some(include_str!("../assets/templates/aag/config.yml")),
11 | "ackbar" => Some(include_str!("../assets/templates/ackbar/config.yml")),
12 | "afraid" => Some(include_str!("../assets/templates/afraid/config.yml")),
13 | "agnes" => Some(include_str!("../assets/templates/agnes/config.yml")),
14 | "aint-got-time" => Some(include_str!("../assets/templates/aint-got-time/config.yml")),
15 | "ams" => Some(include_str!("../assets/templates/ams/config.yml")),
16 | "ants" => Some(include_str!("../assets/templates/ants/config.yml")),
17 | "apcr" => Some(include_str!("../assets/templates/apcr/config.yml")),
18 | "astronaut" => Some(include_str!("../assets/templates/astronaut/config.yml")),
19 | "atis" => Some(include_str!("../assets/templates/atis/config.yml")),
20 | "away" => Some(include_str!("../assets/templates/away/config.yml")),
21 | "awesome" => Some(include_str!("../assets/templates/awesome/config.yml")),
22 | "awesome-awkward" => Some(include_str!(
23 | "../assets/templates/awesome-awkward/config.yml"
24 | )),
25 | "awkward" => Some(include_str!("../assets/templates/awkward/config.yml")),
26 | "awkward-awesome" => Some(include_str!(
27 | "../assets/templates/awkward-awesome/config.yml"
28 | )),
29 | "bad" => Some(include_str!("../assets/templates/bad/config.yml")),
30 | "badchoice" => Some(include_str!("../assets/templates/badchoice/config.yml")),
31 | "balloon" => Some(include_str!("../assets/templates/balloon/config.yml")),
32 | "bd" => Some(include_str!("../assets/templates/bd/config.yml")),
33 | "because" => Some(include_str!("../assets/templates/because/config.yml")),
34 | "bender" => Some(include_str!("../assets/templates/bender/config.yml")),
35 | "bihw" => Some(include_str!("../assets/templates/bihw/config.yml")),
36 | "bilbo" => Some(include_str!("../assets/templates/bilbo/config.yml")),
37 | "biw" => Some(include_str!("../assets/templates/biw/config.yml")),
38 | "blb" => Some(include_str!("../assets/templates/blb/config.yml")),
39 | "boat" => Some(include_str!("../assets/templates/boat/config.yml")),
40 | "bongo" => Some(include_str!("../assets/templates/bongo/config.yml")),
41 | "both" => Some(include_str!("../assets/templates/both/config.yml")),
42 | "box" => Some(include_str!("../assets/templates/box/config.yml")),
43 | "bs" => Some(include_str!("../assets/templates/bs/config.yml")),
44 | "bus" => Some(include_str!("../assets/templates/bus/config.yml")),
45 | "buzz" => Some(include_str!("../assets/templates/buzz/config.yml")),
46 | "cake" => Some(include_str!("../assets/templates/cake/config.yml")),
47 | "captain" => Some(include_str!("../assets/templates/captain/config.yml")),
48 | "captain-america" => Some(include_str!(
49 | "../assets/templates/captain-america/config.yml"
50 | )),
51 | "cb" => Some(include_str!("../assets/templates/cb/config.yml")),
52 | "cbb" => Some(include_str!("../assets/templates/cbb/config.yml")),
53 | "cbg" => Some(include_str!("../assets/templates/cbg/config.yml")),
54 | "center" => Some(include_str!("../assets/templates/center/config.yml")),
55 | "ch" => Some(include_str!("../assets/templates/ch/config.yml")),
56 | "chair" => Some(include_str!("../assets/templates/chair/config.yml")),
57 | "cheems" => Some(include_str!("../assets/templates/cheems/config.yml")),
58 | "chosen" => Some(include_str!("../assets/templates/chosen/config.yml")),
59 | "cmm" => Some(include_str!("../assets/templates/cmm/config.yml")),
60 | "country" => Some(include_str!("../assets/templates/country/config.yml")),
61 | "crazypills" => Some(include_str!("../assets/templates/crazypills/config.yml")),
62 | "crow" => Some(include_str!("../assets/templates/crow/config.yml")),
63 | "cryingfloor" => Some(include_str!("../assets/templates/cryingfloor/config.yml")),
64 | "db" => Some(include_str!("../assets/templates/db/config.yml")),
65 | "dbg" => Some(include_str!("../assets/templates/dbg/config.yml")),
66 | "dg" => Some(include_str!("../assets/templates/dg/config.yml")),
67 | "disastergirl" => Some(include_str!("../assets/templates/disastergirl/config.yml")),
68 | "dodgson" => Some(include_str!("../assets/templates/dodgson/config.yml")),
69 | "doge" => Some(include_str!("../assets/templates/doge/config.yml")),
70 | "dragon" => Some(include_str!("../assets/templates/dragon/config.yml")),
71 | "drake" => Some(include_str!("../assets/templates/drake/config.yml")),
72 | "drowning" => Some(include_str!("../assets/templates/drowning/config.yml")),
73 | "drunk" => Some(include_str!("../assets/templates/drunk/config.yml")),
74 | "ds" => Some(include_str!("../assets/templates/ds/config.yml")),
75 | "dsm" => Some(include_str!("../assets/templates/dsm/config.yml")),
76 | "dwight" => Some(include_str!("../assets/templates/dwight/config.yml")),
77 | "elf" => Some(include_str!("../assets/templates/elf/config.yml")),
78 | "elmo" => Some(include_str!("../assets/templates/elmo/config.yml")),
79 | "ermg" => Some(include_str!("../assets/templates/ermg/config.yml")),
80 | "exit" => Some(include_str!("../assets/templates/exit/config.yml")),
81 | "fa" => Some(include_str!("../assets/templates/fa/config.yml")),
82 | "facepalm" => Some(include_str!("../assets/templates/facepalm/config.yml")),
83 | "fbf" => Some(include_str!("../assets/templates/fbf/config.yml")),
84 | "feelsgood" => Some(include_str!("../assets/templates/feelsgood/config.yml")),
85 | "fetch" => Some(include_str!("../assets/templates/fetch/config.yml")),
86 | "fine" => Some(include_str!("../assets/templates/fine/config.yml")),
87 | "firsttry" => Some(include_str!("../assets/templates/firsttry/config.yml")),
88 | "fmr" => Some(include_str!("../assets/templates/fmr/config.yml")),
89 | "friends" => Some(include_str!("../assets/templates/friends/config.yml")),
90 | "fry" => Some(include_str!("../assets/templates/fry/config.yml")),
91 | "fwp" => Some(include_str!("../assets/templates/fwp/config.yml")),
92 | "gandalf" => Some(include_str!("../assets/templates/gandalf/config.yml")),
93 | "gb" => Some(include_str!("../assets/templates/gb/config.yml")),
94 | "gears" => Some(include_str!("../assets/templates/gears/config.yml")),
95 | "genie" => Some(include_str!("../assets/templates/genie/config.yml")),
96 | "ggg" => Some(include_str!("../assets/templates/ggg/config.yml")),
97 | "glasses" => Some(include_str!("../assets/templates/glasses/config.yml")),
98 | "gone" => Some(include_str!("../assets/templates/gone/config.yml")),
99 | "grave" => Some(include_str!("../assets/templates/grave/config.yml")),
100 | "gru" => Some(include_str!("../assets/templates/gru/config.yml")),
101 | "grumpycat" => Some(include_str!("../assets/templates/grumpycat/config.yml")),
102 | "hagrid" => Some(include_str!("../assets/templates/hagrid/config.yml")),
103 | "happening" => Some(include_str!("../assets/templates/happening/config.yml")),
104 | "harold" => Some(include_str!("../assets/templates/harold/config.yml")),
105 | "headaches" => Some(include_str!("../assets/templates/headaches/config.yml")),
106 | "hipster" => Some(include_str!("../assets/templates/hipster/config.yml")),
107 | "home" => Some(include_str!("../assets/templates/home/config.yml")),
108 | "icanhas" => Some(include_str!("../assets/templates/icanhas/config.yml")),
109 | "imsorry" => Some(include_str!("../assets/templates/imsorry/config.yml")),
110 | "inigo" => Some(include_str!("../assets/templates/inigo/config.yml")),
111 | "interesting" => Some(include_str!("../assets/templates/interesting/config.yml")),
112 | "ive" => Some(include_str!("../assets/templates/ive/config.yml")),
113 | "iw" => Some(include_str!("../assets/templates/iw/config.yml")),
114 | "jd" => Some(include_str!("../assets/templates/jd/config.yml")),
115 | "jetpack" => Some(include_str!("../assets/templates/jetpack/config.yml")),
116 | "jim" => Some(include_str!("../assets/templates/jim/config.yml")),
117 | "joker" => Some(include_str!("../assets/templates/joker/config.yml")),
118 | "jw" => Some(include_str!("../assets/templates/jw/config.yml")),
119 | "keanu" => Some(include_str!("../assets/templates/keanu/config.yml")),
120 | "kermit" => Some(include_str!("../assets/templates/kermit/config.yml")),
121 | "khaby-lame" => Some(include_str!("../assets/templates/khaby-lame/config.yml")),
122 | "kk" => Some(include_str!("../assets/templates/kk/config.yml")),
123 | "kombucha" => Some(include_str!("../assets/templates/kombucha/config.yml")),
124 | "kramer" => Some(include_str!("../assets/templates/kramer/config.yml")),
125 | "leo" => Some(include_str!("../assets/templates/leo/config.yml")),
126 | "light" => Some(include_str!("../assets/templates/light/config.yml")),
127 | "live" => Some(include_str!("../assets/templates/live/config.yml")),
128 | "ll" => Some(include_str!("../assets/templates/ll/config.yml")),
129 | "lrv" => Some(include_str!("../assets/templates/lrv/config.yml")),
130 | "made" => Some(include_str!("../assets/templates/made/config.yml")),
131 | "mb" => Some(include_str!("../assets/templates/mb/config.yml")),
132 | "michael-scott" => Some(include_str!("../assets/templates/michael-scott/config.yml")),
133 | "midwit" => Some(include_str!("../assets/templates/midwit/config.yml")),
134 | "millers" => Some(include_str!("../assets/templates/millers/config.yml")),
135 | "mini-keanu" => Some(include_str!("../assets/templates/mini-keanu/config.yml")),
136 | "mmm" => Some(include_str!("../assets/templates/mmm/config.yml")),
137 | "money" => Some(include_str!("../assets/templates/money/config.yml")),
138 | "mordor" => Some(include_str!("../assets/templates/mordor/config.yml")),
139 | "morpheus" => Some(include_str!("../assets/templates/morpheus/config.yml")),
140 | "mouth" => Some(include_str!("../assets/templates/mouth/config.yml")),
141 | "mw" => Some(include_str!("../assets/templates/mw/config.yml")),
142 | "nails" => Some(include_str!("../assets/templates/nails/config.yml")),
143 | "nice" => Some(include_str!("../assets/templates/nice/config.yml")),
144 | "noah" => Some(include_str!("../assets/templates/noah/config.yml")),
145 | "noidea" => Some(include_str!("../assets/templates/noidea/config.yml")),
146 | "ntot" => Some(include_str!("../assets/templates/ntot/config.yml")),
147 | "oag" => Some(include_str!("../assets/templates/oag/config.yml")),
148 | "officespace" => Some(include_str!("../assets/templates/officespace/config.yml")),
149 | "older" => Some(include_str!("../assets/templates/older/config.yml")),
150 | "oprah" => Some(include_str!("../assets/templates/oprah/config.yml")),
151 | "panik-kalm-panik" => Some(include_str!(
152 | "../assets/templates/panik-kalm-panik/config.yml"
153 | )),
154 | "patrick" => Some(include_str!("../assets/templates/patrick/config.yml")),
155 | "perfection" => Some(include_str!("../assets/templates/perfection/config.yml")),
156 | "persian" => Some(include_str!("../assets/templates/persian/config.yml")),
157 | "philosoraptor" => Some(include_str!("../assets/templates/philosoraptor/config.yml")),
158 | "pigeon" => Some(include_str!("../assets/templates/pigeon/config.yml")),
159 | "pooh" => Some(include_str!("../assets/templates/pooh/config.yml")),
160 | "pool" => Some(include_str!("../assets/templates/pool/config.yml")),
161 | "prop3" => Some(include_str!("../assets/templates/prop3/config.yml")),
162 | "ptj" => Some(include_str!("../assets/templates/ptj/config.yml")),
163 | "puffin" => Some(include_str!("../assets/templates/puffin/config.yml")),
164 | "red" => Some(include_str!("../assets/templates/red/config.yml")),
165 | "regret" => Some(include_str!("../assets/templates/regret/config.yml")),
166 | "remembers" => Some(include_str!("../assets/templates/remembers/config.yml")),
167 | "reveal" => Some(include_str!("../assets/templates/reveal/config.yml")),
168 | "right" => Some(include_str!("../assets/templates/right/config.yml")),
169 | "rollsafe" => Some(include_str!("../assets/templates/rollsafe/config.yml")),
170 | "sad-biden" => Some(include_str!("../assets/templates/sad-biden/config.yml")),
171 | "sad-boehner" => Some(include_str!("../assets/templates/sad-boehner/config.yml")),
172 | "sad-bush" => Some(include_str!("../assets/templates/sad-bush/config.yml")),
173 | "sad-clinton" => Some(include_str!("../assets/templates/sad-clinton/config.yml")),
174 | "sad-obama" => Some(include_str!("../assets/templates/sad-obama/config.yml")),
175 | "sadfrog" => Some(include_str!("../assets/templates/sadfrog/config.yml")),
176 | "saltbae" => Some(include_str!("../assets/templates/saltbae/config.yml")),
177 | "same" => Some(include_str!("../assets/templates/same/config.yml")),
178 | "sarcasticbear" => Some(include_str!("../assets/templates/sarcasticbear/config.yml")),
179 | "say" => Some(include_str!("../assets/templates/say/config.yml")),
180 | "sb" => Some(include_str!("../assets/templates/sb/config.yml")),
181 | "scc" => Some(include_str!("../assets/templates/scc/config.yml")),
182 | "seagull" => Some(include_str!("../assets/templates/seagull/config.yml")),
183 | "sf" => Some(include_str!("../assets/templates/sf/config.yml")),
184 | "sk" => Some(include_str!("../assets/templates/sk/config.yml")),
185 | "ski" => Some(include_str!("../assets/templates/ski/config.yml")),
186 | "slap" => Some(include_str!("../assets/templates/slap/config.yml")),
187 | "snek" => Some(include_str!("../assets/templates/snek/config.yml")),
188 | "soa" => Some(include_str!("../assets/templates/soa/config.yml")),
189 | "sohappy" => Some(include_str!("../assets/templates/sohappy/config.yml")),
190 | "sohot" => Some(include_str!("../assets/templates/sohot/config.yml")),
191 | "soup-nazi" => Some(include_str!("../assets/templates/soup-nazi/config.yml")),
192 | "sparta" => Some(include_str!("../assets/templates/sparta/config.yml")),
193 | "spiderman" => Some(include_str!("../assets/templates/spiderman/config.yml")),
194 | "spirit" => Some(include_str!("../assets/templates/spirit/config.yml")),
195 | "spongebob" => Some(include_str!("../assets/templates/spongebob/config.yml")),
196 | "ss" => Some(include_str!("../assets/templates/ss/config.yml")),
197 | "stew" => Some(include_str!("../assets/templates/stew/config.yml")),
198 | "stonks" => Some(include_str!("../assets/templates/stonks/config.yml")),
199 | "stop" => Some(include_str!("../assets/templates/stop/config.yml")),
200 | "stop-it" => Some(include_str!("../assets/templates/stop-it/config.yml")),
201 | "success" => Some(include_str!("../assets/templates/success/config.yml")),
202 | "tenguy" => Some(include_str!("../assets/templates/tenguy/config.yml")),
203 | "toohigh" => Some(include_str!("../assets/templates/toohigh/config.yml")),
204 | "touch" => Some(include_str!("../assets/templates/touch/config.yml")),
205 | "tried" => Some(include_str!("../assets/templates/tried/config.yml")),
206 | "trump" => Some(include_str!("../assets/templates/trump/config.yml")),
207 | "ugandanknuck" => Some(include_str!("../assets/templates/ugandanknuck/config.yml")),
208 | "vince" => Some(include_str!("../assets/templates/vince/config.yml")),
209 | "wallet" => Some(include_str!("../assets/templates/wallet/config.yml")),
210 | "waygd" => Some(include_str!("../assets/templates/waygd/config.yml")),
211 | "wddth" => Some(include_str!("../assets/templates/wddth/config.yml")),
212 | "whatyear" => Some(include_str!("../assets/templates/whatyear/config.yml")),
213 | "winter" => Some(include_str!("../assets/templates/winter/config.yml")),
214 | "wishes" => Some(include_str!("../assets/templates/wishes/config.yml")),
215 | "wkh" => Some(include_str!("../assets/templates/wkh/config.yml")),
216 | "woman-cat" => Some(include_str!("../assets/templates/woman-cat/config.yml")),
217 | "wonka" => Some(include_str!("../assets/templates/wonka/config.yml")),
218 | "worst" => Some(include_str!("../assets/templates/worst/config.yml")),
219 | "xy" => Some(include_str!("../assets/templates/xy/config.yml")),
220 | "yallgot" => Some(include_str!("../assets/templates/yallgot/config.yml")),
221 | "yodawg" => Some(include_str!("../assets/templates/yodawg/config.yml")),
222 | "yuno" => Some(include_str!("../assets/templates/yuno/config.yml")),
223 | "zero-wing" => Some(include_str!("../assets/templates/zero-wing/config.yml")),
224 | _ => None,
225 | }
226 | }
227 |
228 | // Function to get template image
229 | pub fn get_template_image(template_id: &str, image_name: &str) -> Option<&'static [u8]> {
230 | match (template_id, image_name) {
231 | ("aag", "default.jpg") => Some(include_bytes!("../assets/templates/aag/default.jpg")),
232 | ("ackbar", "default.jpg") => Some(include_bytes!("../assets/templates/ackbar/default.jpg")),
233 | ("afraid", "default.jpg") => Some(include_bytes!("../assets/templates/afraid/default.jpg")),
234 | ("agnes", "default.jpg") => Some(include_bytes!("../assets/templates/agnes/default.jpg")),
235 | ("aint-got-time", "default.jpg") => Some(include_bytes!(
236 | "../assets/templates/aint-got-time/default.jpg"
237 | )),
238 | ("ams", "default.jpg") => Some(include_bytes!("../assets/templates/ams/default.jpg")),
239 | ("ants", "default.jpg") => Some(include_bytes!("../assets/templates/ants/default.jpg")),
240 | ("apcr", "default.jpg") => Some(include_bytes!("../assets/templates/apcr/default.jpg")),
241 | ("astronaut", "default.png") => {
242 | Some(include_bytes!("../assets/templates/astronaut/default.png"))
243 | }
244 | ("atis", "default.jpg") => Some(include_bytes!("../assets/templates/atis/default.jpg")),
245 | ("away", "default.jpg") => Some(include_bytes!("../assets/templates/away/default.jpg")),
246 | ("awesome", "default.jpg") => {
247 | Some(include_bytes!("../assets/templates/awesome/default.jpg"))
248 | }
249 | ("awesome-awkward", "default.jpg") => Some(include_bytes!(
250 | "../assets/templates/awesome-awkward/default.jpg"
251 | )),
252 | ("awkward", "default.jpg") => {
253 | Some(include_bytes!("../assets/templates/awkward/default.jpg"))
254 | }
255 | ("awkward-awesome", "default.jpg") => Some(include_bytes!(
256 | "../assets/templates/awkward-awesome/default.jpg"
257 | )),
258 | ("bad", "default.jpg") => Some(include_bytes!("../assets/templates/bad/default.jpg")),
259 | ("badchoice", "default.jpg") => {
260 | Some(include_bytes!("../assets/templates/badchoice/default.jpg"))
261 | }
262 | ("balloon", "default.jpg") => {
263 | Some(include_bytes!("../assets/templates/balloon/default.jpg"))
264 | }
265 | ("bd", "default.jpg") => Some(include_bytes!("../assets/templates/bd/default.jpg")),
266 | ("because", "default.png") => {
267 | Some(include_bytes!("../assets/templates/because/default.png"))
268 | }
269 | ("bender", "default.jpg") => Some(include_bytes!("../assets/templates/bender/default.jpg")),
270 | ("bihw", "default.jpg") => Some(include_bytes!("../assets/templates/bihw/default.jpg")),
271 | ("bilbo", "default.jpg") => Some(include_bytes!("../assets/templates/bilbo/default.jpg")),
272 | ("biw", "default.jpg") => Some(include_bytes!("../assets/templates/biw/default.jpg")),
273 | ("blb", "default.jpg") => Some(include_bytes!("../assets/templates/blb/default.jpg")),
274 | ("boat", "default.jpg") => Some(include_bytes!("../assets/templates/boat/default.jpg")),
275 | ("bongo", "default.gif") => Some(include_bytes!("../assets/templates/bongo/default.gif")),
276 | ("both", "default.jpg") => Some(include_bytes!("../assets/templates/both/default.jpg")),
277 | ("both", "default.gif") => Some(include_bytes!("../assets/templates/both/default.gif")),
278 | ("box", "default.png") => Some(include_bytes!("../assets/templates/box/default.png")),
279 | ("box", "default.gif") => Some(include_bytes!("../assets/templates/box/default.gif")),
280 | ("bs", "default.jpg") => Some(include_bytes!("../assets/templates/bs/default.jpg")),
281 | ("bus", "default.jpg") => Some(include_bytes!("../assets/templates/bus/default.jpg")),
282 | ("buzz", "default.jpg") => Some(include_bytes!("../assets/templates/buzz/default.jpg")),
283 | ("buzz", "default.gif") => Some(include_bytes!("../assets/templates/buzz/default.gif")),
284 | ("cake", "default.jpg") => Some(include_bytes!("../assets/templates/cake/default.jpg")),
285 | ("cake", "default.gif") => Some(include_bytes!("../assets/templates/cake/default.gif")),
286 | ("captain", "default.jpg") => {
287 | Some(include_bytes!("../assets/templates/captain/default.jpg"))
288 | }
289 | ("captain-america", "default.jpg") => Some(include_bytes!(
290 | "../assets/templates/captain-america/default.jpg"
291 | )),
292 | ("cb", "default.jpg") => Some(include_bytes!("../assets/templates/cb/default.jpg")),
293 | ("cbb", "default.jpg") => Some(include_bytes!("../assets/templates/cbb/default.jpg")),
294 | ("cbg", "default.jpg") => Some(include_bytes!("../assets/templates/cbg/default.jpg")),
295 | ("center", "default.jpg") => Some(include_bytes!("../assets/templates/center/default.jpg")),
296 | ("ch", "default.jpg") => Some(include_bytes!("../assets/templates/ch/default.jpg")),
297 | ("chair", "default.png") => Some(include_bytes!("../assets/templates/chair/default.png")),
298 | ("cheems", "default.jpg") => Some(include_bytes!("../assets/templates/cheems/default.jpg")),
299 | ("chosen", "default.jpg") => Some(include_bytes!("../assets/templates/chosen/default.jpg")),
300 | ("cmm", "default.png") => Some(include_bytes!("../assets/templates/cmm/default.png")),
301 | ("country", "default.jpg") => {
302 | Some(include_bytes!("../assets/templates/country/default.jpg"))
303 | }
304 | ("crazypills", "default.png") => {
305 | Some(include_bytes!("../assets/templates/crazypills/default.png"))
306 | }
307 | ("crow", "default.jpg") => Some(include_bytes!("../assets/templates/crow/default.jpg")),
308 | ("cryingfloor", "default.jpg") => Some(include_bytes!(
309 | "../assets/templates/cryingfloor/default.jpg"
310 | )),
311 | ("db", "default.jpg") => Some(include_bytes!("../assets/templates/db/default.jpg")),
312 | ("dbg", "default.jpg") => Some(include_bytes!("../assets/templates/dbg/default.jpg")),
313 | ("dg", "default.jpg") => Some(include_bytes!("../assets/templates/dg/default.jpg")),
314 | ("disastergirl", "default.jpg") => Some(include_bytes!(
315 | "../assets/templates/disastergirl/default.jpg"
316 | )),
317 | ("dodgson", "default.jpg") => {
318 | Some(include_bytes!("../assets/templates/dodgson/default.jpg"))
319 | }
320 | ("dodgson", "default.gif") => {
321 | Some(include_bytes!("../assets/templates/dodgson/default.gif"))
322 | }
323 | ("doge", "bark.jpg") => Some(include_bytes!("../assets/templates/doge/bark.jpg")),
324 | ("doge", "pet.jpg") => Some(include_bytes!("../assets/templates/doge/pet.jpg")),
325 | ("doge", "growl.jpg") => Some(include_bytes!("../assets/templates/doge/growl.jpg")),
326 | ("doge", "roll.jpg") => Some(include_bytes!("../assets/templates/doge/roll.jpg")),
327 | ("doge", "default.jpg") => Some(include_bytes!("../assets/templates/doge/default.jpg")),
328 | ("doge", "bite.jpg") => Some(include_bytes!("../assets/templates/doge/bite.jpg")),
329 | ("doge", "full.jpg") => Some(include_bytes!("../assets/templates/doge/full.jpg")),
330 | ("dragon", "default.png") => Some(include_bytes!("../assets/templates/dragon/default.png")),
331 | ("drake", "beat.jpg") => Some(include_bytes!("../assets/templates/drake/beat.jpg")),
332 | ("drake", "yes.jpg") => Some(include_bytes!("../assets/templates/drake/yes.jpg")),
333 | ("drake", "default.png") => Some(include_bytes!("../assets/templates/drake/default.png")),
334 | ("drake", "padding.jpg") => Some(include_bytes!("../assets/templates/drake/padding.jpg")),
335 | ("drake", "no.jpg") => Some(include_bytes!("../assets/templates/drake/no.jpg")),
336 | ("drowning", "default.png") => {
337 | Some(include_bytes!("../assets/templates/drowning/default.png"))
338 | }
339 | ("drunk", "default.jpg") => Some(include_bytes!("../assets/templates/drunk/default.jpg")),
340 | ("ds", "maga.jpg") => Some(include_bytes!("../assets/templates/ds/maga.jpg")),
341 | ("ds", "default.jpg") => Some(include_bytes!("../assets/templates/ds/default.jpg")),
342 | ("dsm", "default.jpg") => Some(include_bytes!("../assets/templates/dsm/default.jpg")),
343 | ("dwight", "default.jpg") => Some(include_bytes!("../assets/templates/dwight/default.jpg")),
344 | ("elf", "default.jpg") => Some(include_bytes!("../assets/templates/elf/default.jpg")),
345 | ("elmo", "default.png") => Some(include_bytes!("../assets/templates/elmo/default.png")),
346 | ("ermg", "default.jpg") => Some(include_bytes!("../assets/templates/ermg/default.jpg")),
347 | ("exit", "default.png") => Some(include_bytes!("../assets/templates/exit/default.png")),
348 | ("fa", "default.jpg") => Some(include_bytes!("../assets/templates/fa/default.jpg")),
349 | ("facepalm", "default.jpg") => {
350 | Some(include_bytes!("../assets/templates/facepalm/default.jpg"))
351 | }
352 | ("fbf", "default.jpg") => Some(include_bytes!("../assets/templates/fbf/default.jpg")),
353 | ("feelsgood", "default.png") => {
354 | Some(include_bytes!("../assets/templates/feelsgood/default.png"))
355 | }
356 | ("fetch", "default.jpg") => Some(include_bytes!("../assets/templates/fetch/default.jpg")),
357 | ("fine", "default.png") => Some(include_bytes!("../assets/templates/fine/default.png")),
358 | ("fine", "default.gif") => Some(include_bytes!("../assets/templates/fine/default.gif")),
359 | ("firsttry", "default.png") => {
360 | Some(include_bytes!("../assets/templates/firsttry/default.png"))
361 | }
362 | ("fmr", "default.jpg") => Some(include_bytes!("../assets/templates/fmr/default.jpg")),
363 | ("friends", "default.png") => {
364 | Some(include_bytes!("../assets/templates/friends/default.png"))
365 | }
366 | ("fry", "default.png") => Some(include_bytes!("../assets/templates/fry/default.png")),
367 | ("fry", "default.gif") => Some(include_bytes!("../assets/templates/fry/default.gif")),
368 | ("fwp", "default.jpg") => Some(include_bytes!("../assets/templates/fwp/default.jpg")),
369 | ("gandalf", "default.jpg") => {
370 | Some(include_bytes!("../assets/templates/gandalf/default.jpg"))
371 | }
372 | ("gb", "default.jpg") => Some(include_bytes!("../assets/templates/gb/default.jpg")),
373 | ("gears", "default.jpg") => Some(include_bytes!("../assets/templates/gears/default.jpg")),
374 | ("genie", "default.png") => Some(include_bytes!("../assets/templates/genie/default.png")),
375 | ("ggg", "default.jpg") => Some(include_bytes!("../assets/templates/ggg/default.jpg")),
376 | ("glasses", "default.png") => {
377 | Some(include_bytes!("../assets/templates/glasses/default.png"))
378 | }
379 | ("gone", "default.jpg") => Some(include_bytes!("../assets/templates/gone/default.jpg")),
380 | ("grave", "default.png") => Some(include_bytes!("../assets/templates/grave/default.png")),
381 | ("gru", "default.jpg") => Some(include_bytes!("../assets/templates/gru/default.jpg")),
382 | ("grumpycat", "default.jpg") => {
383 | Some(include_bytes!("../assets/templates/grumpycat/default.jpg"))
384 | }
385 | ("hagrid", "default.jpg") => Some(include_bytes!("../assets/templates/hagrid/default.jpg")),
386 | ("happening", "default.jpg") => {
387 | Some(include_bytes!("../assets/templates/happening/default.jpg"))
388 | }
389 | ("happening", "default.gif") => {
390 | Some(include_bytes!("../assets/templates/happening/default.gif"))
391 | }
392 | ("harold", "default.jpg") => Some(include_bytes!("../assets/templates/harold/default.jpg")),
393 | ("headaches", "default.png") => {
394 | Some(include_bytes!("../assets/templates/headaches/default.png"))
395 | }
396 | ("hipster", "default.jpg") => {
397 | Some(include_bytes!("../assets/templates/hipster/default.jpg"))
398 | }
399 | ("home", "default.jpg") => Some(include_bytes!("../assets/templates/home/default.jpg")),
400 | ("icanhas", "default.jpg") => {
401 | Some(include_bytes!("../assets/templates/icanhas/default.jpg"))
402 | }
403 | ("imsorry", "default.jpg") => {
404 | Some(include_bytes!("../assets/templates/imsorry/default.jpg"))
405 | }
406 | ("inigo", "default.jpg") => Some(include_bytes!("../assets/templates/inigo/default.jpg")),
407 | ("interesting", "default.jpg") => Some(include_bytes!(
408 | "../assets/templates/interesting/default.jpg"
409 | )),
410 | ("ive", "default.png") => Some(include_bytes!("../assets/templates/ive/default.png")),
411 | ("iw", "default.png") => Some(include_bytes!("../assets/templates/iw/default.png")),
412 | ("jd", "default.jpg") => Some(include_bytes!("../assets/templates/jd/default.jpg")),
413 | ("jetpack", "default.jpg") => {
414 | Some(include_bytes!("../assets/templates/jetpack/default.jpg"))
415 | }
416 | ("jim", "default.png") => Some(include_bytes!("../assets/templates/jim/default.png")),
417 | ("joker", "default.jpg") => Some(include_bytes!("../assets/templates/joker/default.jpg")),
418 | ("jw", "default.png") => Some(include_bytes!("../assets/templates/jw/default.png")),
419 | ("jw", "alternate.png") => Some(include_bytes!("../assets/templates/jw/alternate.png")),
420 | ("keanu", "default.jpg") => Some(include_bytes!("../assets/templates/keanu/default.jpg")),
421 | ("kermit", "default.jpg") => Some(include_bytes!("../assets/templates/kermit/default.jpg")),
422 | ("khaby-lame", "default.jpg") => {
423 | Some(include_bytes!("../assets/templates/khaby-lame/default.jpg"))
424 | }
425 | ("kk", "luke.jpg") => Some(include_bytes!("../assets/templates/kk/luke.jpg")),
426 | ("kk", "default.jpg") => Some(include_bytes!("../assets/templates/kk/default.jpg")),
427 | ("kombucha", "default.png") => {
428 | Some(include_bytes!("../assets/templates/kombucha/default.png"))
429 | }
430 | ("kramer", "default.png") => Some(include_bytes!("../assets/templates/kramer/default.png")),
431 | ("kramer", "seinfeld.jpg") => {
432 | Some(include_bytes!("../assets/templates/kramer/seinfeld.jpg"))
433 | }
434 | ("leo", "default.jpg") => Some(include_bytes!("../assets/templates/leo/default.jpg")),
435 | ("light", "default.jpg") => Some(include_bytes!("../assets/templates/light/default.jpg")),
436 | ("live", "default.jpg") => Some(include_bytes!("../assets/templates/live/default.jpg")),
437 | ("live", "default.gif") => Some(include_bytes!("../assets/templates/live/default.gif")),
438 | ("ll", "default.jpg") => Some(include_bytes!("../assets/templates/ll/default.jpg")),
439 | ("lrv", "default.jpg") => Some(include_bytes!("../assets/templates/lrv/default.jpg")),
440 | ("made", "default.png") => Some(include_bytes!("../assets/templates/made/default.png")),
441 | ("mb", "box.jpg") => Some(include_bytes!("../assets/templates/mb/box.jpg")),
442 | ("mb", "default.jpg") => Some(include_bytes!("../assets/templates/mb/default.jpg")),
443 | ("mb", "default.gif") => Some(include_bytes!("../assets/templates/mb/default.gif")),
444 | ("mb", "flood.png") => Some(include_bytes!("../assets/templates/mb/flood.png")),
445 | ("michael-scott", "default.jpg") => Some(include_bytes!(
446 | "../assets/templates/michael-scott/default.jpg"
447 | )),
448 | ("midwit", "default.jpg") => Some(include_bytes!("../assets/templates/midwit/default.jpg")),
449 | ("millers", "default.png") => {
450 | Some(include_bytes!("../assets/templates/millers/default.png"))
451 | }
452 | ("mini-keanu", "default.jpg") => {
453 | Some(include_bytes!("../assets/templates/mini-keanu/default.jpg"))
454 | }
455 | ("mmm", "default.jpg") => Some(include_bytes!("../assets/templates/mmm/default.jpg")),
456 | ("money", "default.jpg") => Some(include_bytes!("../assets/templates/money/default.jpg")),
457 | ("money", "default.gif") => Some(include_bytes!("../assets/templates/money/default.gif")),
458 | ("mordor", "default.jpg") => Some(include_bytes!("../assets/templates/mordor/default.jpg")),
459 | ("morpheus", "default.jpg") => {
460 | Some(include_bytes!("../assets/templates/morpheus/default.jpg"))
461 | }
462 | ("mouth", "default.png") => Some(include_bytes!("../assets/templates/mouth/default.png")),
463 | ("mw", "default.jpg") => Some(include_bytes!("../assets/templates/mw/default.jpg")),
464 | ("nails", "default.png") => Some(include_bytes!("../assets/templates/nails/default.png")),
465 | ("nice", "default.jpg") => Some(include_bytes!("../assets/templates/nice/default.jpg")),
466 | ("noah", "default.jpg") => Some(include_bytes!("../assets/templates/noah/default.jpg")),
467 | ("noidea", "default.jpg") => Some(include_bytes!("../assets/templates/noidea/default.jpg")),
468 | ("ntot", "default.png") => Some(include_bytes!("../assets/templates/ntot/default.png")),
469 | ("oag", "default.jpg") => Some(include_bytes!("../assets/templates/oag/default.jpg")),
470 | ("officespace", "default.jpg") => Some(include_bytes!(
471 | "../assets/templates/officespace/default.jpg"
472 | )),
473 | ("older", "default.jpg") => Some(include_bytes!("../assets/templates/older/default.jpg")),
474 | ("oprah", "default.jpg") => Some(include_bytes!("../assets/templates/oprah/default.jpg")),
475 | ("oprah", "default.gif") => Some(include_bytes!("../assets/templates/oprah/default.gif")),
476 | ("panik-kalm-panik", "default.png") => Some(include_bytes!(
477 | "../assets/templates/panik-kalm-panik/default.png"
478 | )),
479 | ("patrick", "default.jpg") => {
480 | Some(include_bytes!("../assets/templates/patrick/default.jpg"))
481 | }
482 | ("patrick", "default.gif") => {
483 | Some(include_bytes!("../assets/templates/patrick/default.gif"))
484 | }
485 | ("perfection", "default.jpg") => {
486 | Some(include_bytes!("../assets/templates/perfection/default.jpg"))
487 | }
488 | ("persian", "default.jpg") => {
489 | Some(include_bytes!("../assets/templates/persian/default.jpg"))
490 | }
491 | ("philosoraptor", "default.jpg") => Some(include_bytes!(
492 | "../assets/templates/philosoraptor/default.jpg"
493 | )),
494 | ("pigeon", "default.jpg") => Some(include_bytes!("../assets/templates/pigeon/default.jpg")),
495 | ("pooh", "default.png") => Some(include_bytes!("../assets/templates/pooh/default.png")),
496 | ("pool", "default.png") => Some(include_bytes!("../assets/templates/pool/default.png")),
497 | ("prop3", "default.png") => Some(include_bytes!("../assets/templates/prop3/default.png")),
498 | ("ptj", "default.jpg") => Some(include_bytes!("../assets/templates/ptj/default.jpg")),
499 | ("puffin", "default.jpg") => Some(include_bytes!("../assets/templates/puffin/default.jpg")),
500 | ("red", "default.jpg") => Some(include_bytes!("../assets/templates/red/default.jpg")),
501 | ("regret", "default.jpg") => Some(include_bytes!("../assets/templates/regret/default.jpg")),
502 | ("remembers", "default.jpg") => {
503 | Some(include_bytes!("../assets/templates/remembers/default.jpg"))
504 | }
505 | ("reveal", "default.png") => Some(include_bytes!("../assets/templates/reveal/default.png")),
506 | ("right", "default.png") => Some(include_bytes!("../assets/templates/right/default.png")),
507 | ("rollsafe", "default.jpg") => {
508 | Some(include_bytes!("../assets/templates/rollsafe/default.jpg"))
509 | }
510 | ("rollsafe", "default.gif") => {
511 | Some(include_bytes!("../assets/templates/rollsafe/default.gif"))
512 | }
513 | ("sad-biden", "down.jpg") => Some(include_bytes!("../assets/templates/sad-biden/down.jpg")),
514 | ("sad-biden", "scowl.jpg") => {
515 | Some(include_bytes!("../assets/templates/sad-biden/scowl.jpg"))
516 | }
517 | ("sad-biden", "default.jpg") => {
518 | Some(include_bytes!("../assets/templates/sad-biden/default.jpg"))
519 | }
520 | ("sad-biden", "window.jpg") => {
521 | Some(include_bytes!("../assets/templates/sad-biden/window.jpg"))
522 | }
523 | ("sad-boehner", "default.jpg") => Some(include_bytes!(
524 | "../assets/templates/sad-boehner/default.jpg"
525 | )),
526 | ("sad-boehner", "really.jpg") => {
527 | Some(include_bytes!("../assets/templates/sad-boehner/really.jpg"))
528 | }
529 | ("sad-boehner", "sad.jpg") => {
530 | Some(include_bytes!("../assets/templates/sad-boehner/sad.jpg"))
531 | }
532 | ("sad-boehner", "frown.jpg") => {
533 | Some(include_bytes!("../assets/templates/sad-boehner/frown.jpg"))
534 | }
535 | ("sad-boehner", "what.jpg") => {
536 | Some(include_bytes!("../assets/templates/sad-boehner/what.jpg"))
537 | }
538 | ("sad-bush", "nervous.jpg") => {
539 | Some(include_bytes!("../assets/templates/sad-bush/nervous.jpg"))
540 | }
541 | ("sad-bush", "facebook.jpg") => {
542 | Some(include_bytes!("../assets/templates/sad-bush/facebook.jpg"))
543 | }
544 | ("sad-bush", "unsure.jpg") => {
545 | Some(include_bytes!("../assets/templates/sad-bush/unsure.jpg"))
546 | }
547 | ("sad-bush", "default.jpg") => {
548 | Some(include_bytes!("../assets/templates/sad-bush/default.jpg"))
549 | }
550 | ("sad-bush", "upset.jpg") => Some(include_bytes!("../assets/templates/sad-bush/upset.jpg")),
551 | ("sad-clinton", "nervous.jpg") => Some(include_bytes!(
552 | "../assets/templates/sad-clinton/nervous.jpg"
553 | )),
554 | ("sad-clinton", "default.jpg") => Some(include_bytes!(
555 | "../assets/templates/sad-clinton/default.jpg"
556 | )),
557 | ("sad-clinton", "ashamed.jpg") => Some(include_bytes!(
558 | "../assets/templates/sad-clinton/ashamed.jpg"
559 | )),
560 | ("sad-clinton", "sad.jpg") => {
561 | Some(include_bytes!("../assets/templates/sad-clinton/sad.jpg"))
562 | }
563 | ("sad-clinton", "frown.jpg") => {
564 | Some(include_bytes!("../assets/templates/sad-clinton/frown.jpg"))
565 | }
566 | ("sad-obama", "down.jpg") => Some(include_bytes!("../assets/templates/sad-obama/down.jpg")),
567 | ("sad-obama", "default.jpg") => {
568 | Some(include_bytes!("../assets/templates/sad-obama/default.jpg"))
569 | }
570 | ("sad-obama", "mad.jpg") => Some(include_bytes!("../assets/templates/sad-obama/mad.jpg")),
571 | ("sad-obama", "really.jpg") => {
572 | Some(include_bytes!("../assets/templates/sad-obama/really.jpg"))
573 | }
574 | ("sad-obama", "frown.jpg") => {
575 | Some(include_bytes!("../assets/templates/sad-obama/frown.jpg"))
576 | }
577 | ("sad-obama", "bow.jpg") => Some(include_bytes!("../assets/templates/sad-obama/bow.jpg")),
578 | ("sadfrog", "default.jpg") => {
579 | Some(include_bytes!("../assets/templates/sadfrog/default.jpg"))
580 | }
581 | ("saltbae", "default.jpg") => {
582 | Some(include_bytes!("../assets/templates/saltbae/default.jpg"))
583 | }
584 | ("same", "default.jpg") => Some(include_bytes!("../assets/templates/same/default.jpg")),
585 | ("sarcasticbear", "default.jpg") => Some(include_bytes!(
586 | "../assets/templates/sarcasticbear/default.jpg"
587 | )),
588 | ("say", "default.jpg") => Some(include_bytes!("../assets/templates/say/default.jpg")),
589 | ("sb", "default.jpg") => Some(include_bytes!("../assets/templates/sb/default.jpg")),
590 | ("scc", "default.jpg") => Some(include_bytes!("../assets/templates/scc/default.jpg")),
591 | ("seagull", "default.jpg") => {
592 | Some(include_bytes!("../assets/templates/seagull/default.jpg"))
593 | }
594 | ("sf", "default.jpg") => Some(include_bytes!("../assets/templates/sf/default.jpg")),
595 | ("sk", "default.jpg") => Some(include_bytes!("../assets/templates/sk/default.jpg")),
596 | ("ski", "default.png") => Some(include_bytes!("../assets/templates/ski/default.png")),
597 | ("slap", "default.png") => Some(include_bytes!("../assets/templates/slap/default.png")),
598 | ("snek", "default.png") => Some(include_bytes!("../assets/templates/snek/default.png")),
599 | ("soa", "default.jpg") => Some(include_bytes!("../assets/templates/soa/default.jpg")),
600 | ("sohappy", "default.jpg") => {
601 | Some(include_bytes!("../assets/templates/sohappy/default.jpg"))
602 | }
603 | ("sohot", "default.png") => Some(include_bytes!("../assets/templates/sohot/default.png")),
604 | ("soup-nazi", "default.jpg") => {
605 | Some(include_bytes!("../assets/templates/soup-nazi/default.jpg"))
606 | }
607 | ("sparta", "default.jpg") => Some(include_bytes!("../assets/templates/sparta/default.jpg")),
608 | ("spiderman", "default.jpg") => {
609 | Some(include_bytes!("../assets/templates/spiderman/default.jpg"))
610 | }
611 | ("spirit", "default.jpg") => Some(include_bytes!("../assets/templates/spirit/default.jpg")),
612 | ("spongebob", "default.jpg") => {
613 | Some(include_bytes!("../assets/templates/spongebob/default.jpg"))
614 | }
615 | ("ss", "default.jpg") => Some(include_bytes!("../assets/templates/ss/default.jpg")),
616 | ("stew", "default.jpg") => Some(include_bytes!("../assets/templates/stew/default.jpg")),
617 | ("stonks", "default.png") => Some(include_bytes!("../assets/templates/stonks/default.png")),
618 | ("stop", "default.jpg") => Some(include_bytes!("../assets/templates/stop/default.jpg")),
619 | ("stop-it", "default.jpg") => {
620 | Some(include_bytes!("../assets/templates/stop-it/default.jpg"))
621 | }
622 | ("success", "default.jpg") => {
623 | Some(include_bytes!("../assets/templates/success/default.jpg"))
624 | }
625 | ("tenguy", "default.jpg") => Some(include_bytes!("../assets/templates/tenguy/default.jpg")),
626 | ("toohigh", "default.jpg") => {
627 | Some(include_bytes!("../assets/templates/toohigh/default.jpg"))
628 | }
629 | ("touch", "default.jpg") => Some(include_bytes!("../assets/templates/touch/default.jpg")),
630 | ("tried", "default.jpg") => Some(include_bytes!("../assets/templates/tried/default.jpg")),
631 | ("trump", "default.jpg") => Some(include_bytes!("../assets/templates/trump/default.jpg")),
632 | ("ugandanknuck", "default.jpg") => Some(include_bytes!(
633 | "../assets/templates/ugandanknuck/default.jpg"
634 | )),
635 | ("vince", "default.jpg") => Some(include_bytes!("../assets/templates/vince/default.jpg")),
636 | ("wallet", "default.jpg") => Some(include_bytes!("../assets/templates/wallet/default.jpg")),
637 | ("waygd", "default.jpg") => Some(include_bytes!("../assets/templates/waygd/default.jpg")),
638 | ("waygd", "default.gif") => Some(include_bytes!("../assets/templates/waygd/default.gif")),
639 | ("wddth", "default.png") => Some(include_bytes!("../assets/templates/wddth/default.png")),
640 | ("whatyear", "default.jpg") => {
641 | Some(include_bytes!("../assets/templates/whatyear/default.jpg"))
642 | }
643 | ("winter", "default.jpg") => Some(include_bytes!("../assets/templates/winter/default.jpg")),
644 | ("wishes", "blank.png") => Some(include_bytes!("../assets/templates/wishes/blank.png")),
645 | ("wishes", "default.png") => Some(include_bytes!("../assets/templates/wishes/default.png")),
646 | ("wkh", "default.jpg") => Some(include_bytes!("../assets/templates/wkh/default.jpg")),
647 | ("woman-cat", "default.jpg") => {
648 | Some(include_bytes!("../assets/templates/woman-cat/default.jpg"))
649 | }
650 | ("wonka", "default.jpg") => Some(include_bytes!("../assets/templates/wonka/default.jpg")),
651 | ("worst", "default.jpg") => Some(include_bytes!("../assets/templates/worst/default.jpg")),
652 | ("xy", "default.jpg") => Some(include_bytes!("../assets/templates/xy/default.jpg")),
653 | ("yallgot", "default.jpg") => {
654 | Some(include_bytes!("../assets/templates/yallgot/default.jpg"))
655 | }
656 | ("yodawg", "default.jpg") => Some(include_bytes!("../assets/templates/yodawg/default.jpg")),
657 | ("yuno", "default.jpg") => Some(include_bytes!("../assets/templates/yuno/default.jpg")),
658 | ("zero-wing", "default.jpg") => {
659 | Some(include_bytes!("../assets/templates/zero-wing/default.jpg"))
660 | }
661 | _ => None,
662 | }
663 | }
664 |
```