mcp-tools 0.1.0

Rust MCP tools library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
//! Web Tools MCP Server
//!
//! Provides web scraping and HTTP request capabilities via MCP protocol including:
//! - HTTP GET/POST/PUT/DELETE requests
//! - Web page content extraction
//! - HTML parsing and element selection
//! - JSON API interactions
//! - URL validation and analysis

use async_trait::async_trait;
use reqwest::{Client, Method, Response};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::time::Duration;
use tracing::{debug, info, warn};
use url::Url;

use crate::common::{
    BaseServer, McpContent, McpServerBase, McpTool, McpToolRequest, McpToolResponse,
    ServerCapabilities, ServerConfig,
};
use crate::{McpToolsError, Result};

/// Web Tools MCP Server
pub struct WebToolsServer {
    base: BaseServer,
    client: Client,
}

/// HTTP request configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HttpRequest {
    pub url: String,
    pub method: String,
    pub headers: HashMap<String, String>,
    pub body: Option<String>,
    pub timeout: Option<u64>,
    pub follow_redirects: bool,
}

/// HTTP response data
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HttpResponse {
    pub status: u16,
    pub status_text: String,
    pub headers: HashMap<String, String>,
    pub body: String,
    pub url: String,
    pub content_type: Option<String>,
    pub content_length: Option<u64>,
}

/// Web page analysis result
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WebPageAnalysis {
    pub url: String,
    pub title: Option<String>,
    pub description: Option<String>,
    pub keywords: Vec<String>,
    pub links: Vec<String>,
    pub images: Vec<String>,
    pub forms: Vec<FormInfo>,
    pub meta_tags: HashMap<String, String>,
    pub word_count: u32,
    pub load_time: u64,
}

/// Form information
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FormInfo {
    pub action: Option<String>,
    pub method: String,
    pub fields: Vec<FormField>,
}

/// Form field information
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FormField {
    pub name: Option<String>,
    pub field_type: String,
    pub required: bool,
    pub placeholder: Option<String>,
}

/// URL analysis result
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UrlAnalysis {
    pub url: String,
    pub is_valid: bool,
    pub scheme: Option<String>,
    pub host: Option<String>,
    pub port: Option<u16>,
    pub path: String,
    pub query: Option<String>,
    pub fragment: Option<String>,
    pub domain_info: DomainInfo,
}

/// Domain information
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DomainInfo {
    pub domain: String,
    pub subdomain: Option<String>,
    pub tld: Option<String>,
    pub is_ip: bool,
}

impl WebToolsServer {
    pub async fn new(config: ServerConfig) -> Result<Self> {
        let base = BaseServer::new(config).await?;

        // Create HTTP client with reasonable defaults
        let client = Client::builder()
            .timeout(Duration::from_secs(30))
            .user_agent("MCP-Tools/1.0")
            .build()
            .map_err(|e| McpToolsError::Server(format!("Failed to create HTTP client: {}", e)))?;

        Ok(Self { base, client })
    }

    /// Perform HTTP request
    async fn http_request(&self, request: HttpRequest) -> Result<HttpResponse> {
        debug!("Making HTTP request to: {}", request.url);

        // Validate URL
        let url = Url::parse(&request.url)
            .map_err(|e| McpToolsError::Server(format!("Invalid URL: {}", e)))?;

        // Parse method
        let method = match request.method.to_uppercase().as_str() {
            "GET" => Method::GET,
            "POST" => Method::POST,
            "PUT" => Method::PUT,
            "DELETE" => Method::DELETE,
            "HEAD" => Method::HEAD,
            "PATCH" => Method::PATCH,
            _ => {
                return Err(McpToolsError::Server(format!(
                    "Unsupported HTTP method: {}",
                    request.method
                )))
            }
        };

        // Build request
        let mut req_builder = self.client.request(method, url);

        // Add headers
        for (key, value) in request.headers {
            req_builder = req_builder.header(&key, &value);
        }

        // Add body if provided
        if let Some(body) = request.body {
            req_builder = req_builder.body(body);
        }

        // Set timeout if provided
        if let Some(timeout_secs) = request.timeout {
            req_builder = req_builder.timeout(Duration::from_secs(timeout_secs));
        }

        // Execute request
        let start_time = std::time::Instant::now();
        let response = req_builder
            .send()
            .await
            .map_err(|e| McpToolsError::Server(format!("HTTP request failed: {}", e)))?;

        // Extract response data
        let status = response.status().as_u16();
        let status_text = response
            .status()
            .canonical_reason()
            .unwrap_or("Unknown")
            .to_string();
        let final_url = response.url().to_string();

        // Extract headers
        let mut headers = HashMap::new();
        for (key, value) in response.headers() {
            if let Ok(value_str) = value.to_str() {
                headers.insert(key.to_string(), value_str.to_string());
            }
        }

        let content_type = response
            .headers()
            .get("content-type")
            .and_then(|v| v.to_str().ok())
            .map(|s| s.to_string());

        let content_length = response.content_length();

        // Get response body
        let body = response
            .text()
            .await
            .map_err(|e| McpToolsError::Server(format!("Failed to read response body: {}", e)))?;

        Ok(HttpResponse {
            status,
            status_text,
            headers,
            body,
            url: final_url,
            content_type,
            content_length,
        })
    }

    /// Analyze web page content
    async fn analyze_webpage(&self, url: &str) -> Result<WebPageAnalysis> {
        debug!("Analyzing webpage: {}", url);

        let request = HttpRequest {
            url: url.to_string(),
            method: "GET".to_string(),
            headers: HashMap::new(),
            body: None,
            timeout: Some(30),
            follow_redirects: true,
        };

        let start_time = std::time::Instant::now();
        let response = self.http_request(request).await?;
        let load_time = start_time.elapsed().as_millis() as u64;

        // Basic HTML parsing (simplified - would use a proper HTML parser in production)
        let html = &response.body;

        // Extract title
        let title = self.extract_html_tag(html, "title");

        // Extract meta description
        let description = self.extract_meta_content(html, "description");

        // Extract meta keywords
        let keywords_str = self
            .extract_meta_content(html, "keywords")
            .unwrap_or_default();
        let keywords: Vec<String> = keywords_str
            .split(',')
            .map(|s| s.trim().to_string())
            .filter(|s| !s.is_empty())
            .collect();

        // Extract links (simplified)
        let links = self.extract_links(html);

        // Extract images (simplified)
        let images = self.extract_images(html);

        // Extract forms (simplified)
        let forms = self.extract_forms(html);

        // Extract meta tags
        let meta_tags = self.extract_meta_tags(html);

        // Count words (simplified)
        let word_count = html
            .split_whitespace()
            .filter(|word| !word.starts_with('<'))
            .count() as u32;

        Ok(WebPageAnalysis {
            url: response.url,
            title,
            description,
            keywords,
            links,
            images,
            forms,
            meta_tags,
            word_count,
            load_time,
        })
    }

    /// Analyze URL structure
    async fn analyze_url(&self, url_str: &str) -> Result<UrlAnalysis> {
        debug!("Analyzing URL: {}", url_str);

        match Url::parse(url_str) {
            Ok(url) => {
                let domain = url.host_str().unwrap_or("").to_string();
                let domain_parts: Vec<&str> = domain.split('.').collect();

                let (subdomain, tld) = if domain_parts.len() > 2 {
                    (
                        Some(domain_parts[0].to_string()),
                        Some(domain_parts.last().unwrap().to_string()),
                    )
                } else {
                    (None, domain_parts.last().map(|s| s.to_string()))
                };

                let is_ip = domain.parse::<std::net::IpAddr>().is_ok();

                Ok(UrlAnalysis {
                    url: url_str.to_string(),
                    is_valid: true,
                    scheme: Some(url.scheme().to_string()),
                    host: url.host_str().map(|s| s.to_string()),
                    port: url.port(),
                    path: url.path().to_string(),
                    query: url.query().map(|s| s.to_string()),
                    fragment: url.fragment().map(|s| s.to_string()),
                    domain_info: DomainInfo {
                        domain,
                        subdomain,
                        tld,
                        is_ip,
                    },
                })
            }
            Err(_) => Ok(UrlAnalysis {
                url: url_str.to_string(),
                is_valid: false,
                scheme: None,
                host: None,
                port: None,
                path: String::new(),
                query: None,
                fragment: None,
                domain_info: DomainInfo {
                    domain: String::new(),
                    subdomain: None,
                    tld: None,
                    is_ip: false,
                },
            }),
        }
    }

    // Helper methods for HTML parsing (simplified implementations)
    fn extract_html_tag(&self, html: &str, tag: &str) -> Option<String> {
        let start_tag = format!("<{}>", tag);
        let end_tag = format!("</{}>", tag);

        if let Some(start) = html.find(&start_tag) {
            if let Some(end) = html[start..].find(&end_tag) {
                let content = &html[start + start_tag.len()..start + end];
                return Some(content.trim().to_string());
            }
        }
        None
    }

    fn extract_meta_content(&self, html: &str, name: &str) -> Option<String> {
        let pattern = format!(r#"<meta[^>]*name="{}"[^>]*content="([^"]*)"#, name);
        // Simplified regex-like extraction (would use proper regex in production)
        if let Some(start) = html.find(&format!(r#"name="{}""#, name)) {
            if let Some(content_start) = html[start..].find(r#"content=""#) {
                let content_pos = start + content_start + 9; // length of 'content="'
                if let Some(content_end) = html[content_pos..].find('"') {
                    return Some(html[content_pos..content_pos + content_end].to_string());
                }
            }
        }
        None
    }

    fn extract_links(&self, html: &str) -> Vec<String> {
        let mut links = Vec::new();
        let mut pos = 0;

        while let Some(href_pos) = html[pos..].find("href=\"") {
            let start = pos + href_pos + 6; // length of 'href="'
            if let Some(end_pos) = html[start..].find('"') {
                let link = html[start..start + end_pos].to_string();
                if !link.is_empty() && !link.starts_with('#') {
                    links.push(link);
                }
                pos = start + end_pos;
            } else {
                break;
            }
        }

        links
    }

    fn extract_images(&self, html: &str) -> Vec<String> {
        let mut images = Vec::new();
        let mut pos = 0;

        while let Some(src_pos) = html[pos..].find("src=\"") {
            let start = pos + src_pos + 5; // length of 'src="'
            if let Some(end_pos) = html[start..].find('"') {
                let image = html[start..start + end_pos].to_string();
                if !image.is_empty() {
                    images.push(image);
                }
                pos = start + end_pos;
            } else {
                break;
            }
        }

        images
    }

    fn extract_forms(&self, _html: &str) -> Vec<FormInfo> {
        // Simplified implementation - would need proper HTML parsing
        Vec::new()
    }

    fn extract_meta_tags(&self, _html: &str) -> HashMap<String, String> {
        // Simplified implementation - would need proper HTML parsing
        HashMap::new()
    }
}

#[async_trait]
impl McpServerBase for WebToolsServer {
    async fn get_capabilities(&self) -> Result<ServerCapabilities> {
        let mut capabilities = self.base.get_capabilities().await?;

        // Add Web Tools-specific tools
        let web_tools = vec![
            McpTool {
                name: "http_request".to_string(),
                description: "Make HTTP requests (GET, POST, PUT, DELETE) to web endpoints"
                    .to_string(),
                input_schema: serde_json::json!({
                    "type": "object",
                    "properties": {
                        "url": {
                            "type": "string",
                            "description": "Target URL for the HTTP request"
                        },
                        "method": {
                            "type": "string",
                            "description": "HTTP method (GET, POST, PUT, DELETE, HEAD, PATCH)",
                            "enum": ["GET", "POST", "PUT", "DELETE", "HEAD", "PATCH"],
                            "default": "GET"
                        },
                        "headers": {
                            "type": "object",
                            "description": "HTTP headers as key-value pairs",
                            "additionalProperties": {"type": "string"}
                        },
                        "body": {
                            "type": "string",
                            "description": "Request body (for POST, PUT, PATCH methods)"
                        },
                        "timeout": {
                            "type": "integer",
                            "description": "Request timeout in seconds (default: 30)",
                            "minimum": 1,
                            "maximum": 300
                        },
                        "follow_redirects": {
                            "type": "boolean",
                            "description": "Whether to follow HTTP redirects (default: true)"
                        }
                    },
                    "required": ["url"]
                }),
                category: "web".to_string(),
                requires_permission: true,
                permissions: vec!["network.http".to_string()],
            },
            McpTool {
                name: "analyze_webpage".to_string(),
                description:
                    "Analyze a web page and extract metadata, links, images, and other information"
                        .to_string(),
                input_schema: serde_json::json!({
                    "type": "object",
                    "properties": {
                        "url": {
                            "type": "string",
                            "description": "URL of the web page to analyze"
                        }
                    },
                    "required": ["url"]
                }),
                category: "web".to_string(),
                requires_permission: true,
                permissions: vec!["network.http".to_string()],
            },
            McpTool {
                name: "analyze_url".to_string(),
                description:
                    "Analyze URL structure and extract components (scheme, host, path, query, etc.)"
                        .to_string(),
                input_schema: serde_json::json!({
                    "type": "object",
                    "properties": {
                        "url": {
                            "type": "string",
                            "description": "URL to analyze"
                        }
                    },
                    "required": ["url"]
                }),
                category: "web".to_string(),
                requires_permission: false,
                permissions: vec![],
            },
            McpTool {
                name: "fetch_content".to_string(),
                description: "Fetch content from a URL with automatic content type detection"
                    .to_string(),
                input_schema: serde_json::json!({
                    "type": "object",
                    "properties": {
                        "url": {
                            "type": "string",
                            "description": "URL to fetch content from"
                        },
                        "headers": {
                            "type": "object",
                            "description": "Additional HTTP headers",
                            "additionalProperties": {"type": "string"}
                        },
                        "timeout": {
                            "type": "integer",
                            "description": "Request timeout in seconds (default: 30)"
                        }
                    },
                    "required": ["url"]
                }),
                category: "web".to_string(),
                requires_permission: true,
                permissions: vec!["network.http".to_string()],
            },
        ];

        capabilities.tools = web_tools;
        Ok(capabilities)
    }

    async fn handle_tool_request(&self, request: McpToolRequest) -> Result<McpToolResponse> {
        info!("Handling Web Tools request: {}", request.tool);

        match request.tool.as_str() {
            "http_request" => {
                debug!("Making HTTP request");

                let url = request
                    .arguments
                    .get("url")
                    .and_then(|v| v.as_str())
                    .ok_or_else(|| McpToolsError::Server("Missing 'url' parameter".to_string()))?;

                let method = request
                    .arguments
                    .get("method")
                    .and_then(|v| v.as_str())
                    .unwrap_or("GET");

                let headers = request
                    .arguments
                    .get("headers")
                    .and_then(|v| v.as_object())
                    .map(|obj| {
                        obj.iter()
                            .filter_map(|(k, v)| v.as_str().map(|s| (k.clone(), s.to_string())))
                            .collect()
                    })
                    .unwrap_or_default();

                let body = request
                    .arguments
                    .get("body")
                    .and_then(|v| v.as_str())
                    .map(|s| s.to_string());

                let timeout = request.arguments.get("timeout").and_then(|v| v.as_u64());

                let follow_redirects = request
                    .arguments
                    .get("follow_redirects")
                    .and_then(|v| v.as_bool())
                    .unwrap_or(true);

                let http_request = HttpRequest {
                    url: url.to_string(),
                    method: method.to_string(),
                    headers,
                    body,
                    timeout,
                    follow_redirects,
                };

                let response = self.http_request(http_request).await?;

                let content_text = format!(
                    "HTTP Request Complete\n\
                    Status: {} {}\n\
                    URL: {}\n\
                    Content-Type: {}\n\
                    Content-Length: {} bytes",
                    response.status,
                    response.status_text,
                    response.url,
                    response.content_type.as_deref().unwrap_or("unknown"),
                    response
                        .content_length
                        .unwrap_or(response.body.len() as u64)
                );

                let mut metadata = HashMap::new();
                metadata.insert("http_response".to_string(), serde_json::to_value(response)?);

                Ok(McpToolResponse {
                    id: request.id,
                    content: vec![McpContent::text(content_text)],
                    is_error: false,
                    error: None,
                    metadata,
                })
            }
            "analyze_webpage" => {
                debug!("Analyzing webpage");

                let url = request
                    .arguments
                    .get("url")
                    .and_then(|v| v.as_str())
                    .ok_or_else(|| McpToolsError::Server("Missing 'url' parameter".to_string()))?;

                let analysis = self.analyze_webpage(url).await?;

                let content_text = format!(
                    "Web Page Analysis Complete\n\
                    URL: {}\n\
                    Title: {}\n\
                    Description: {}\n\
                    Links Found: {}\n\
                    Images Found: {}\n\
                    Word Count: {}\n\
                    Load Time: {}ms",
                    analysis.url,
                    analysis.title.as_deref().unwrap_or("None"),
                    analysis.description.as_deref().unwrap_or("None"),
                    analysis.links.len(),
                    analysis.images.len(),
                    analysis.word_count,
                    analysis.load_time
                );

                let mut metadata = HashMap::new();
                metadata.insert(
                    "webpage_analysis".to_string(),
                    serde_json::to_value(analysis)?,
                );

                Ok(McpToolResponse {
                    id: request.id,
                    content: vec![McpContent::text(content_text)],
                    is_error: false,
                    error: None,
                    metadata,
                })
            }
            "analyze_url" => {
                debug!("Analyzing URL structure");

                let url = request
                    .arguments
                    .get("url")
                    .and_then(|v| v.as_str())
                    .ok_or_else(|| McpToolsError::Server("Missing 'url' parameter".to_string()))?;

                let analysis = self.analyze_url(url).await?;

                let content_text = format!(
                    "URL Analysis Complete\n\
                    URL: {}\n\
                    Valid: {}\n\
                    Scheme: {}\n\
                    Host: {}\n\
                    Port: {}\n\
                    Path: {}\n\
                    Domain: {}",
                    analysis.url,
                    analysis.is_valid,
                    analysis.scheme.as_deref().unwrap_or("None"),
                    analysis.host.as_deref().unwrap_or("None"),
                    analysis
                        .port
                        .map(|p| p.to_string())
                        .as_deref()
                        .unwrap_or("None"),
                    analysis.path,
                    analysis.domain_info.domain
                );

                let mut metadata = HashMap::new();
                metadata.insert("url_analysis".to_string(), serde_json::to_value(analysis)?);

                Ok(McpToolResponse {
                    id: request.id,
                    content: vec![McpContent::text(content_text)],
                    is_error: false,
                    error: None,
                    metadata,
                })
            }
            "fetch_content" => {
                debug!("Fetching content from URL");

                let url = request
                    .arguments
                    .get("url")
                    .and_then(|v| v.as_str())
                    .ok_or_else(|| McpToolsError::Server("Missing 'url' parameter".to_string()))?;

                let headers = request
                    .arguments
                    .get("headers")
                    .and_then(|v| v.as_object())
                    .map(|obj| {
                        obj.iter()
                            .filter_map(|(k, v)| v.as_str().map(|s| (k.clone(), s.to_string())))
                            .collect()
                    })
                    .unwrap_or_default();

                let timeout = request.arguments.get("timeout").and_then(|v| v.as_u64());

                let http_request = HttpRequest {
                    url: url.to_string(),
                    method: "GET".to_string(),
                    headers,
                    body: None,
                    timeout,
                    follow_redirects: true,
                };

                let response = self.http_request(http_request).await?;

                let content_text = format!(
                    "Content Fetched Successfully\n\
                    URL: {}\n\
                    Status: {}\n\
                    Content-Type: {}\n\
                    Size: {} bytes\n\n{}",
                    response.url,
                    response.status,
                    response.content_type.as_deref().unwrap_or("unknown"),
                    response.body.len(),
                    if response.body.len() > 1000 {
                        format!("{}...", &response.body[..1000])
                    } else {
                        response.body.clone()
                    }
                );

                let mut metadata = HashMap::new();
                metadata.insert(
                    "fetched_content".to_string(),
                    serde_json::to_value(response)?,
                );

                Ok(McpToolResponse {
                    id: request.id,
                    content: vec![McpContent::text(content_text)],
                    is_error: false,
                    error: None,
                    metadata,
                })
            }
            _ => {
                warn!("Unknown Web Tools request: {}", request.tool);
                Err(McpToolsError::Server(format!(
                    "Unknown Web Tools request: {}",
                    request.tool
                )))
            }
        }
    }

    async fn get_stats(&self) -> Result<crate::common::ServerStats> {
        self.base.get_stats().await
    }

    async fn initialize(&mut self) -> Result<()> {
        info!("Initializing Web Tools MCP Server");
        Ok(())
    }

    async fn shutdown(&mut self) -> Result<()> {
        info!("Shutting down Web Tools MCP Server");
        Ok(())
    }
}