Skip to main content
Glama

MCP Smart Filesystem Server

by lofcz

search_code

Search code patterns using regex to find functions, classes, methods, and declarations across your codebase with advanced filtering options.

Instructions

Search for code patterns using ripgrep (very fast). Supports regex patterns and advanced filtering.

PATTERN EXAMPLES:

  • Exact text: "functionName"

  • Multiple options: "\b(class|struct|record|interface|enum)\s+TypeName\b" (finds: class TypeName, record TypeName, interface TypeName, etc.)

  • Regex: "async.Promise<.>" (finds async functions returning Promise)

  • Any declaration: "\b(public|private|protected)\s+\w+\s+methodName"

COMMON USE CASES:

  • Find type declaration: "\b(class|struct|interface|record|enum)\s+TypeName\b"

  • Find method: "\b(public|private|protected|internal).\s+methodName\s\("

  • Find property: "\bpublic\s+\w+\s+propertyName\s*\{"

  • Find async methods: "async.*Task<"

  • Find implementations: ":\s*IInterfaceName\b"

TIPS:

  • Use \b for word boundaries

  • Use \s+ for whitespace

  • Combine alternatives with (opt1|opt2|opt3)

  • Escape special chars: \( \) \{ \}

Input Schema

NameRequiredDescriptionDefault
patternYesRegex pattern to search. For multiple alternatives use: (class|struct|interface) to match any
pathNoLimit search to specific directory (e.g., 'src/components'). Omit to search entire workspace.
filePatternNoFile glob pattern (ripgrep -g flag). Examples: '*.js', '*.{ts,tsx}', '!*test*' (exclude). Can specify multiple patterns separated by comma.
caseInsensitiveNoIgnore case in search (ripgrep -i). Default: true for LLM-friendly searching
contextLinesNoLines of context before/after match (ripgrep -C)
maxResultsNoMaximum number of results to return (per page). Default: 100. Configure via MCP_MAX_SEARCH_RESULTS env var.
pageNoPage number for paginated results (1-based). Use to get more results beyond maxResults.
literalStringNoTreat pattern as literal string, not regex (ripgrep -F)
wordBoundaryNoMatch whole words only (ripgrep -w)

Input Schema (JSON Schema)

{ "properties": { "caseInsensitive": { "default": true, "description": "Ignore case in search (ripgrep -i). Default: true for LLM-friendly searching", "type": "boolean" }, "contextLines": { "default": 2, "description": "Lines of context before/after match (ripgrep -C)", "type": "number" }, "filePattern": { "description": "File glob pattern (ripgrep -g flag). Examples: '*.js', '*.{ts,tsx}', '!*test*' (exclude). Can specify multiple patterns separated by comma.", "type": "string" }, "literalString": { "default": false, "description": "Treat pattern as literal string, not regex (ripgrep -F)", "type": "boolean" }, "maxResults": { "default": 100, "description": "Maximum number of results to return (per page). Default: 100. Configure via MCP_MAX_SEARCH_RESULTS env var.", "type": "number" }, "page": { "default": 1, "description": "Page number for paginated results (1-based). Use to get more results beyond maxResults.", "type": "number" }, "path": { "description": "Limit search to specific directory (e.g., 'src/components'). Omit to search entire workspace.", "type": "string" }, "pattern": { "description": "Regex pattern to search. For multiple alternatives use: (class|struct|interface) to match any", "type": "string" }, "wordBoundary": { "default": false, "description": "Match whole words only (ripgrep -w)", "type": "boolean" } }, "required": [ "pattern" ], "type": "object" }

Other Tools from MCP Smart Filesystem Server

Related Tools

    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/lofcz/mcp-filesystem-smart'

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