Skip to main content
Glama

Serena

by oraios

search_for_pattern

Identify and extract patterns in project files using regex. Specify context lines, include/exclude files with glob patterns, and target code files only. Returns matches with file paths and contextual lines in JSON format.

Instructions

Search for a pattern in the project. You can select whether all files or only code files should be searched. Generally, symbolic operations like find_symbol or find_referencing_symbols should be preferred if you know which symbols you are looking for. Returns A JSON object mapping file paths to lists of matched consecutive lines (with context, if requested).

Input Schema

NameRequiredDescriptionDefault
context_lines_afterNoNumber of lines of context to include after each match.
context_lines_beforeNoNumber of lines of context to include before each match.
max_answer_charsNoIf the output is longer than this number of characters, no content will be returned. Don't adjust unless there is really no other way to get the content required for the task. Instead, if the output is too long, you should make a stricter query.
only_in_code_filesNoWhether to search only in code files or in the entire code base. The explicitly ignored files (from serena config and gitignore) are never searched.
paths_exclude_globNoOptional glob pattern specifying files to exclude from the search (takes precedence over paths_include_glob).
paths_include_globNoOptional glob pattern specifying files to include in the search; if not provided, search globally.
patternYesRegular expression pattern to search for, either as a compiled Pattern or string.

Input Schema (JSON Schema)

{ "properties": { "context_lines_after": { "default": 0, "description": "Number of lines of context to include after each match.", "title": "Context Lines After", "type": "integer" }, "context_lines_before": { "default": 0, "description": "Number of lines of context to include before each match.", "title": "Context Lines Before", "type": "integer" }, "max_answer_chars": { "default": 200000, "description": "If the output is longer than this number of characters,\nno content will be returned. Don't adjust unless there is really no other way to get the content\nrequired for the task. Instead, if the output is too long, you should\nmake a stricter query.", "title": "Max Answer Chars", "type": "integer" }, "only_in_code_files": { "default": true, "description": "Whether to search only in code files or in the entire code base.\nThe explicitly ignored files (from serena config and gitignore) are never searched.", "title": "Only In Code Files", "type": "boolean" }, "paths_exclude_glob": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional glob pattern specifying files to exclude from the search (takes precedence over paths_include_glob).", "title": "Paths Exclude Glob" }, "paths_include_glob": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional glob pattern specifying files to include in the search; if not provided, search globally.", "title": "Paths Include Glob" }, "pattern": { "description": "Regular expression pattern to search for, either as a compiled Pattern or string.", "title": "Pattern", "type": "string" } }, "required": [ "pattern" ], "title": "applyArguments", "type": "object" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oraios/serena'

If you have feedback or need assistance with the MCP directory API, please join our Discord server