Browse documentation

search_text

[semantic]

Searches loaded source documents, declared additional files, and analyzer configuration for literal or regex matches.

Try it locally in the Glider playground

Parameters

NameTypeRequiredDescription
querystringNoSearch query (literal string by default). Preferred argument name.
patternstringNoBackward-compatible alias for query.
useRegexbooleanNoTreat pattern as a regex (.NET dialect). Default is false. Default: false
caseSensitivebooleanNoCase-sensitive match. Default is false. Default: false
scopejsonNoOptional scope. Omit scope to search the solution. When supplied, set mode to solution, project, document, or pathPrefix. project requires projectName. document requires filePath. pathPrefix requires pathPrefix. Paths can be absolute or relative to solutionRoot. Set includeExternal to true when the tool supports external symbols. The file filter intersects this scope.
fileGlobsjsonNoOptional array of file globs relative to solutionRoot. Maximum 64 patterns, with 1024 characters per pattern, including the ! prefix. Use * within a segment, ? for one character, or a whole ** segment across directories. **/*.cs includes root files; *.cs selects root files only. Positive patterns form a union; ! exclusions win. An exclusion-only list starts with all scoped documents. Globs ignore case. Paths accept either directory separator. Glob case rules do not widen the loaded-root boundary. Content caseSensitive remains independent. Omit or use [] to preserve the loaded-document set. With a filter, linked files outside solutionRoot are excluded. Empty patterns, absolute paths, parent traversal, brackets, and braces are invalid.
skipnumberNoPagination offset. Default is 0. Default: 0
takenumberNoPagination size. Default is 200. Default: 200
maxLineTextCharsnumberNoMax characters for lineText. Use 0 for unlimited. Default is 200. Default: 200
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root). Default: "absolute"
responseDetailstringNocompact returns results and actionable state. full adds diagnostic metadata under responseDiagnostics. Default: "compact"

Examples

Replace sample paths and symbol keys with values from your workspace.

Find TODO comments

Arguments
{
  "query": "TODO"
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search_text",
    "arguments": {
      "query": "TODO"
    }
  }
}
Illustrative response
{
  "success": true,
  "coverage": "loadedDocuments",
  "pattern": "TODO",
  "useRegex": false,
  "caseSensitive": false,
  "scopeUsed": {
    "mode": "solution"
  },
  "fileGlobs": [],
  "projectsSearched": 2,
  "totalProjectsInWorkspace": 2,
  "documentsMatchedScope": 120,
  "documentsMatchedFileGlobs": 120,
  "documentsExcludedByFileGlobs": 0,
  "documentsSearched": 120,
  "documentsWithMatches": 1,
  "documentsUnreadable": 0,
  "totalDocumentsInWorkspace": 120,
  "paging": {
    "total": 2
  },
  "matches": [
    {
      "filePath": "/path/to/Program.cs",
      "lineNumber": 12,
      "column": 1,
      "lineText": "// TODO: refactor this",
      "projectName": "MyProject"
    }
  ]
}

Find TODO comments in test files outside Generated directories

Arguments
{
  "query": "TODO",
  "fileGlobs": [
    "**/*Tests.cs",
    "!**/Generated/**"
  ],
  "take": 50
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search_text",
    "arguments": {
      "query": "TODO",
      "fileGlobs": [
        "**/*Tests.cs",
        "!**/Generated/**"
      ],
      "take": 50
    }
  }
}

Response Notes

The loaded set includes source, declared additional files, and analyzer config. The file watcher keeps results current with saved files; sync and reload force a refresh. Use fileGlobs to filter paths within the existing scope. Requires a completed workspace load. Use Scout to search files that no loaded project references.

Returns text occurrences with skip/take pages after both filters. coverage remains 'loadedDocuments'. The response echoes fileGlobs. documentsMatchedScope counts documents before the file filter; documentsMatchedFileGlobs counts eligible documents after it. documentsExcludedByFileGlobs reports the difference. Compare documentsSearched with documentsMatchedFileGlobs and check documentsUnreadable. hints.scopeNote explains an empty scope; hints.fileGlobsNote explains when the file filter removes every scoped document. hints.noMatchNote explains zero text matches among eligible documents. Use Scout for text outside the loaded-document set. Results use top-level fields with success. Compact is the default; full adds responseDiagnostics. Both modes retain errors, coverage, partial state, and recovery advice.