json_search_kv
Search key-value pairs in JSON files within a directory, filtering by specified key and optional value. Supports recursive search, match types, and customizable parameters for file size, depth, and results.
Instructions
Search for key-value pairs in JSON files within a directory. Requires maxBytes
(default 10KB), maxDepth
(default 2), and maxResults
(default 10) parameters. Returns all key-value pairs that match the search pattern. The path must be within allowed directories.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
directoryPath | Yes | Directory to search in | |
key | Yes | Key to search for | |
matchType | No | How to match values - only applies if value is provided | exact |
maxBytes | Yes | Maximum bytes to read from each file. Must be a positive integer. Handler default: 10KB. | |
maxDepth | Yes | Maximum directory depth to search. Must be a positive integer. Handler default: 2. | |
maxResults | Yes | Maximum number of results to return. Must be a positive integer. Handler default: 10. | |
recursive | No | Whether to search recursively in subdirectories | |
value | No | Optional value to match against the key |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"directoryPath": {
"description": "Directory to search in",
"type": "string"
},
"key": {
"description": "Key to search for",
"type": "string"
},
"matchType": {
"default": "exact",
"description": "How to match values - only applies if value is provided",
"enum": [
"exact",
"contains",
"startsWith",
"endsWith"
],
"type": "string"
},
"maxBytes": {
"description": "Maximum bytes to read from each file. Must be a positive integer. Handler default: 10KB.",
"exclusiveMinimum": 0,
"type": "integer"
},
"maxDepth": {
"description": "Maximum directory depth to search. Must be a positive integer. Handler default: 2.",
"exclusiveMinimum": 0,
"type": "integer"
},
"maxResults": {
"description": "Maximum number of results to return. Must be a positive integer. Handler default: 10.",
"exclusiveMinimum": 0,
"type": "integer"
},
"recursive": {
"default": true,
"description": "Whether to search recursively in subdirectories",
"type": "boolean"
},
"value": {
"description": "Optional value to match against the key"
}
},
"required": [
"directoryPath",
"key",
"maxBytes",
"maxResults",
"maxDepth"
],
"type": "object"
}