50 lines
3.7 KiB
JSON
50 lines
3.7 KiB
JSON
[
|
||
{
|
||
"name": "search",
|
||
"description": "**Core Function**: Intelligent hybrid search with keywords, regular expressions, and mandatory weight-based scoring, solving keyword order limitation problems.\n\n**Applicable Scenarios**: Comprehensive content retrieval of pagination.txt files when extended keywords are obtained, with priority control based on keyword importance.\n\n**Advantages**:\n- Does not depend on keyword occurrence order, more flexible matching\n- **Mandatory weight-based scoring system** - all keywords must have assigned weights\n- Sorts by **weight score** instead of simple match count, for more relevant results\n- Supports mixed use of regular keywords and regular expressions\n- Intelligently recognizes multiple regex formats\n- Enhanced result display with match types, weights, and detailed information\n- First line shows total matches and displayed count: `Found X matches, showing top Y results:`\n- Result format: `[line_number]:[weight_score]:[match_info]:[original_line_content]`\n\n**Required Keyword Format**:\n`[{\"pattern\": \"keyword1\", \"weight\": 2.0}, {\"pattern\": \"keyword2\", \"weight\": 0.5}]`\n\n**Weight Requirements**:\n- All keywords must include a positive weight value\n- Weight must be a number greater than 0\n- Higher weights indicate greater importance\n\n**Weight Calculation**:\n- Each keyword/regex match contributes: `weight × match_count` to the line's total score\n- Multiple occurrences of the same keyword in one line are counted separately\n\n**Supported Regex Formats**:\n- `/pattern/` format: e.g., `/def\\s+\\w+/`\n- `r\"pattern\"` format: e.g., `r\"\\w+@\\w+\\.\\w+\"`\n- Strings containing regex special characters: e.g., `\\d{3}-\\d{4}`\n- Automatic detection and intelligent recognition of regex patterns\n\n**Match Type Display**:\n- `[keyword:xxx]` Shows regular keyword matches\n- `[regex:pattern=matched_text]` Shows regex matches and specific matched content\n\n**Use Cases**:\n- **Priority-based search**: Assign different weights to control result ranking\n- Composite condition searches: Scenarios requiring matching multiple keywords and regex simultaneously\n- Unordered matching: Data retrieval where keyword occurrence order is not fixed\n- Pattern matching: Complex data retrieval needing specific formats (email, phone, date)\n- Relevance sorting: Prioritize most relevant results by weight score\n- Hybrid retrieval: Advanced search combining keyword exact matching and regex pattern matching",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"patterns": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"pattern": {
|
||
"type": "string"
|
||
},
|
||
"weight": {
|
||
"type": "number",
|
||
"minimum": 0.000001
|
||
}
|
||
},
|
||
"required": ["pattern", "weight"]
|
||
},
|
||
"description": "Array of search patterns (keywords and regex) with weights. Each item must have 'pattern' and 'weight' fields. Pattern can be a regular keyword or regex format like /pattern/ or r\"pattern\". Weight must be a positive number."
|
||
},
|
||
"file_paths": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "List of file paths to search"
|
||
},
|
||
"limit": {
|
||
"type": "integer",
|
||
"description": "Maximum number of results to return, default 50",
|
||
"default": 50
|
||
},
|
||
"case_sensitive": {
|
||
"type": "boolean",
|
||
"description": "Whether to distinguish case sensitivity, default false",
|
||
"default": false
|
||
}
|
||
},
|
||
"required": [
|
||
"patterns",
|
||
"file_paths"
|
||
]
|
||
}
|
||
}
|
||
]
|