Skip to main content

pmcp_server/tools/
mod.rs

1//! MCP tool implementations for the PMCP server.
2//!
3//! Tools:
4//! - test_check: Protocol compliance testing
5//! - test_generate: Test scenario generation
6//! - test_apps: MCP Apps metadata validation
7//! - scaffold: Code template generation
8//! - schema_export: Schema discovery and export
9
10use mcp_tester::ServerTester;
11use std::time::Duration;
12
13pub mod scaffold;
14pub mod schema_export;
15pub mod test_apps;
16pub mod test_check;
17pub mod test_generate;
18
19pub use scaffold::ScaffoldTool;
20pub use schema_export::SchemaExportTool;
21pub use test_apps::TestAppsTool;
22pub use test_check::TestCheckTool;
23pub use test_generate::TestGenerateTool;
24
25pub(crate) const DEFAULT_TIMEOUT_SECS: u64 = 30;
26
27pub(crate) const fn default_timeout() -> u64 {
28    DEFAULT_TIMEOUT_SECS
29}
30
31pub(crate) fn create_tester(url: &str, timeout_secs: u64) -> pmcp::Result<ServerTester> {
32    ServerTester::new(
33        url,
34        Duration::from_secs(timeout_secs),
35        false, // insecure
36        None,  // api_key
37        None,  // transport (auto-detect)
38        None,  // http_middleware_chain
39    )
40    .map_err(internal_err)
41}
42
43/// Adapter for `.map_err()` — `pmcp::Error::internal()` takes `impl Into<String>`
44/// which doesn't match `impl Display` error types as a function pointer.
45pub(crate) fn internal_err(e: impl std::fmt::Display) -> pmcp::Error {
46    pmcp::Error::Internal(e.to_string())
47}