Skip to content

Commit 7baa158

Browse files
committed
Resolve remark
1 parent c79943f commit 7baa158

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

dsc/src/mcp/list_dsc_functions.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use crate::mcp::mcp_server::McpServer;
55
use dsc_lib::functions::{FunctionDispatcher, FunctionDefinition};
6+
use dsc_lib::util::convert_wildcard_to_regex;
67
use rmcp::{ErrorData as McpError, Json, tool, tool_router, handler::server::wrapper::Parameters};
78
use rust_i18n::t;
89
use schemars::JsonSchema;
@@ -21,23 +22,10 @@ pub struct ListFunctionsRequest {
2122
pub function_name: Option<String>,
2223
}
2324

24-
fn convert_wildcard_to_regex(pattern: &str) -> String {
25-
let escaped = regex::escape(pattern);
26-
let regex_pattern = escaped
27-
.replace(r"\*", ".*")
28-
.replace(r"\?", ".");
29-
30-
if !pattern.contains('*') && !pattern.contains('?') {
31-
format!("^{regex_pattern}$")
32-
} else {
33-
regex_pattern
34-
}
35-
}
36-
3725
#[tool_router(router = list_dsc_functions_router, vis = "pub")]
3826
impl McpServer {
3927
#[tool(
40-
description = "List available DSC functions with optional filtering by name pattern",
28+
description = "List available DSC functions to be used in expressions with optional filtering by name pattern",
4129
annotations(
4230
title = "Enumerate all available DSC functions on the local machine returning name, category, description, and metadata.",
4331
read_only_hint = true,

0 commit comments

Comments
 (0)