qwen_agent/mcp/tools/multi_keyword_search_tools.json
2025-10-22 00:45:32 +08:00

92 lines
6.3 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[
{
"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": "search_count",
"description": "**Statistical Analysis Function**: Provides comprehensive matching statistics and evaluation for keyword and regex patterns with weight-based scoring.\n\n**Applicable Scenarios**: Analyzing search pattern effectiveness, evaluating content coverage, and assessing match distribution across files.\n\n**Statistical Metrics Provided**:\n- Overall search statistics (files searched, total lines, match rate)\n- File-level breakdown (matches per file, weight scores)\n- Pattern-level analysis (match frequency, effectiveness ranking)\n- Weight-based scoring distribution\n\n**Key Features**:\n- Calculates match rate percentage across all searched content\n- Ranks files and patterns by weight score contribution\n- Shows both match count and unique lines matched for each pattern\n- Provides total weight score aggregation\n- Detailed breakdown by file and by search pattern\n\n**Output Format**:\n```\n=== Matching Statistics Evaluation ===\nFiles searched: X\nTotal lines searched: Y\nTotal matched lines: Z\nTotal weight score: W.WW\nMatch rate: R.RR%\n\n=== Statistics by File ===\nFile: filename1\n Matched lines: N\n Weight score: S.SS\n\n=== Statistics by Pattern ===\nPattern: pattern1\n Match count: M\n Matched lines: L\n Weight score: P.PP\n```\n\n**Use Cases**:\n- Content analysis effectiveness evaluation\n- Search pattern optimization\n- File relevance assessment\n- Keyword performance measurement\n- Content coverage analysis",
"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"
},
"case_sensitive": {
"type": "boolean",
"description": "Whether to distinguish case sensitivity, default false",
"default": false
}
},
"required": [
"patterns",
"file_paths"
]
}
}
]