search_text
Search for a substring within Microsoft Office documents (Word, Excel, PowerPoint) and return match locations with surrounding context. Supports case-sensitive and case-insensitive searches.
Instructions
Search for a substring across the body of an Office file.
The location format depends on the source file's extension:
.docx→"paragraph:N"(0-based body paragraph index).xlsx→"cell:<coord>"(e.g."cell:B3").pptx→"slide:N:shape:M"(0-based slide + 0-based shape index inslide.shapes)
Each match entry has a location and a context field. The
context is a window of up to ~30 characters on each side of
the match in the original text (case preserved).
Args:
path: Path to the file to search.
query: Substring to look for. Must be a non-empty string.
case_sensitive: When True (default), the match is exact;
when False, matches are case-insensitive.
folder: Optional base folder for relative paths.
Returns:
A list of match dicts. Empty when there are no matches
(VAL-GEN-016).
Raises:
OfficeMCPError: ERR_INVALID_PARAMS if query is not a
string or is empty, ERR_FILE_NOT_FOUND if the file is
missing, ERR_UNSUPPORTED_FMT for non-Office files.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| query | Yes | ||
| case_sensitive | No | ||
| folder | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |