(&self, Parameters(ListFunctionsRequest { function_filter }): Parameters<ListFunctionsRequest>)
| 35 | ) |
| 36 | )] |
| 37 | pub async fn list_dsc_functions(&self, Parameters(ListFunctionsRequest { function_filter }): Parameters<ListFunctionsRequest>) -> Result<Json<FunctionListResult>, McpError> { |
| 38 | let result = task::spawn_blocking(move || { |
| 39 | let function_dispatcher = FunctionDispatcher::new(); |
| 40 | let mut functions = function_dispatcher.list(); |
| 41 | |
| 42 | // apply filtering if function_filter is provided |
| 43 | if let Some(name_pattern) = function_filter { |
| 44 | let regex_str = convert_wildcard_to_regex(&name_pattern); |
| 45 | let mut regex_builder = RegexBuilder::new(®ex_str); |
| 46 | regex_builder.case_insensitive(true); |
| 47 | |
| 48 | let regex = regex_builder.build() |
| 49 | .map_err(|_| McpError::invalid_params( |
| 50 | t!("mcp.list_dsc_functions.invalidNamePattern", pattern = name_pattern), |
| 51 | None |
| 52 | ))?; |
| 53 | |
| 54 | functions.retain(|func| regex.is_match(&func.name)); |
| 55 | } |
| 56 | |
| 57 | Ok(FunctionListResult { functions }) |
| 58 | }).await.map_err(|e| McpError::internal_error(e.to_string(), None))??; |
| 59 | |
| 60 | Ok(Json(result)) |
| 61 | } |
| 62 | } |
nothing calls this directly
no test coverage detected