120 lines
7.4 KiB
JSON
120 lines
7.4 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"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "regex_grep",
|
||
"description": "**Regex Pattern Search**: Search files using regular expressions with context lines support.\n\n**Core Features**:\n- Pure regex pattern matching without weight requirements\n- Context lines support for showing surrounding code\n- Case-sensitive/insensitive search options\n- File grouping in results for better organization\n\n**Parameters**:\n- **pattern**: Regular expression pattern to search for\n- **file_paths**: List of files to search in\n- **context_lines**: Number of lines before and after each match (default: 0)\n- **case_sensitive**: Whether to match case (default: false)\n- **limit**: Maximum number of matches to return (default: 50)\n\n**Use Cases**:\n- Pattern-based code search when you know the exact regex\n- Finding function definitions, class declarations, imports\n- Searching for specific code patterns or structures\n- Context-aware search when you need surrounding lines\n- Debugging and code navigation\n\n**Output Format**:\n- Shows total matches found\n- Groups results by file\n- Displays line numbers with matched content\n- Includes context lines when specified",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"pattern": {
|
||
"type": "string",
|
||
"description": "Regular expression pattern to search for"
|
||
},
|
||
"file_paths": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "List of file paths to search"
|
||
},
|
||
"context_lines": {
|
||
"type": "integer",
|
||
"description": "Number of context lines before and after each match",
|
||
"default": 0,
|
||
"minimum": 0
|
||
},
|
||
"case_sensitive": {
|
||
"type": "boolean",
|
||
"description": "Whether to distinguish case sensitivity",
|
||
"default": false
|
||
},
|
||
"limit": {
|
||
"type": "integer",
|
||
"description": "Maximum number of matches to return",
|
||
"default": 50,
|
||
"minimum": 1
|
||
}
|
||
},
|
||
"required": [
|
||
"pattern",
|
||
"file_paths"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "regex_grep_count",
|
||
"description": "**Regex Match Statistics**: Count regex pattern matches across files without returning actual content.\n\n**Core Features**:\n- Pure regex pattern counting without weight requirements\n- Comprehensive match statistics per file\n- Total match and line counts\n- Case-sensitive/insensitive search options\n\n**Parameters**:\n- **pattern**: Regular expression pattern to search for\n- **file_paths**: List of files to search in\n- **case_sensitive**: Whether to match case (default: false)\n\n**Use Cases**:\n- Quick assessment of pattern prevalence across codebase\n- Counting occurrences of specific functions, variables, or patterns\n- Measuring code complexity or usage statistics\n- Pre-search analysis to understand scope\n- Quality metrics and code analysis\n\n**Output Format**:\n- Summary statistics with total matches and files searched\n- Per-file breakdown with match counts and lines affected\n- Clear formatting for easy analysis and reporting",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"pattern": {
|
||
"type": "string",
|
||
"description": "Regular expression pattern to search for"
|
||
},
|
||
"file_paths": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "List of file paths to search"
|
||
},
|
||
"case_sensitive": {
|
||
"type": "boolean",
|
||
"description": "Whether to distinguish case sensitivity",
|
||
"default": false
|
||
}
|
||
},
|
||
"required": [
|
||
"pattern",
|
||
"file_paths"
|
||
]
|
||
}
|
||
}
|
||
]
|