|
9 | 9 | //! - URI templates for parameterized resources |
10 | 10 | //! - Proper error handling and async support |
11 | 11 |
|
12 | | -use pulseengine_mcp_macros::{mcp_server, mcp_tools, mcp_resource}; |
| 12 | +use pulseengine_mcp_macros::{mcp_server, mcp_tools}; |
13 | 13 | use serde::{Deserialize, Serialize}; |
14 | 14 |
|
15 | 15 | /// Example data structure that your tools might work with |
@@ -46,7 +46,7 @@ pub struct ServerConfig { |
46 | 46 | /// automatically generates the necessary MCP infrastructure. |
47 | 47 | #[mcp_server( |
48 | 48 | name = "Template MCP Server", |
49 | | - version = "0.1.0", |
| 49 | + version = "0.2.0", |
50 | 50 | description = "A template MCP server demonstrating basic functionality", |
51 | 51 | auth = "disabled" // Change to "memory", "file", or remove for production |
52 | 52 | )] |
@@ -165,79 +165,20 @@ impl TemplateMcpServer { |
165 | 165 | } |
166 | 166 | } |
167 | 167 |
|
168 | | - // Resources - Read-only data accessible via MCP resource URIs |
169 | | - |
170 | | - /// Get server status information |
171 | | - /// |
172 | | - /// This resource provides read-only access to the server's current status. |
173 | | - /// Resources are for data that clients need to read but not modify. |
174 | | - #[mcp_resource( |
175 | | - uri_template = "template://server-status", |
176 | | - name = "server_status", |
177 | | - description = "Current server status and statistics", |
178 | | - mime_type = "application/json" |
179 | | - )] |
180 | | - pub async fn server_status_resource(&self) -> anyhow::Result<ServerStatus> { |
181 | | - let uptime = self.start_time.elapsed(); |
182 | | - |
183 | | - Ok(ServerStatus { |
184 | | - name: "Template MCP Server".to_string(), |
185 | | - version: "0.1.0".to_string(), |
186 | | - uptime_seconds: uptime.as_secs(), |
187 | | - tools_count: 6, // Update this if you add/remove tools |
188 | | - resources_count: 3, // Update this if you add/remove resources |
189 | | - }) |
190 | | - } |
191 | | - |
192 | | - /// Get server configuration |
193 | | - /// |
194 | | - /// This resource exposes the server's configuration settings. |
195 | | - /// Resources are perfect for configuration data that clients need to read. |
196 | | - #[mcp_resource( |
197 | | - uri_template = "template://server-config", |
198 | | - name = "server_config", |
199 | | - description = "Server configuration settings", |
200 | | - mime_type = "application/json" |
201 | | - )] |
202 | | - pub async fn server_config_resource(&self) -> anyhow::Result<ServerConfig> { |
203 | | - Ok(ServerConfig { |
204 | | - max_concurrent_requests: 100, |
205 | | - timeout_seconds: 30, |
206 | | - debug_mode: cfg!(debug_assertions), |
207 | | - supported_formats: vec![ |
208 | | - "json".to_string(), |
209 | | - "text".to_string(), |
210 | | - "binary".to_string(), |
211 | | - ], |
212 | | - }) |
213 | | - } |
214 | | - |
215 | | - /// Get example data by ID |
216 | | - /// |
217 | | - /// This resource demonstrates parameterized resources using URI templates. |
218 | | - /// The {id} parameter is extracted from the URI when the resource is accessed. |
219 | | - #[mcp_resource( |
220 | | - uri_template = "template://example-data/{id}", |
221 | | - name = "example_data", |
222 | | - description = "Example data entry by ID", |
223 | | - mime_type = "application/json" |
224 | | - )] |
225 | | - pub async fn example_data_resource(&self, id: String) -> anyhow::Result<ExampleData> { |
226 | | - // In a real implementation, you'd look up the data by ID |
227 | | - // For this template, we'll generate example data |
228 | | - let id_num = id.parse::<u64>().unwrap_or(1); |
229 | | - |
230 | | - Ok(ExampleData { |
231 | | - id: id_num, |
232 | | - name: format!("Example Item {}", id_num), |
233 | | - value: (id_num as f64) * 1.5, |
234 | | - tags: vec![ |
235 | | - "example".to_string(), |
236 | | - "template".to_string(), |
237 | | - format!("id-{}", id_num), |
238 | | - ], |
239 | | - }) |
240 | | - } |
| 168 | + // TODO: Resources disabled temporarily due to framework bug in v0.9.0 |
| 169 | + // The mcp_server macro doesn't properly delegate to McpResourcesProvider |
| 170 | + // Will re-enable once framework is fixed |
| 171 | + // |
| 172 | + // Example resources that will be available once the framework is fixed: |
| 173 | + // |
| 174 | + // #[mcp_resource(uri_template = "template://server-status")] |
| 175 | + // pub async fn server_status_resource(&self) -> anyhow::Result<ServerStatus> |
| 176 | + // |
| 177 | + // #[mcp_resource(uri_template = "template://server-config")] |
| 178 | + // pub async fn server_config_resource(&self) -> anyhow::Result<ServerConfig> |
| 179 | + // |
| 180 | + // #[mcp_resource(uri_template = "template://example-data/{id}")] |
| 181 | + // pub async fn example_data_resource(&self, id: String) -> anyhow::Result<ExampleData> |
241 | 182 | } |
242 | 183 |
|
243 | 184 | // Add any additional implementation methods here that are NOT tools |
|
0 commit comments