# glob_search

> **Function** in `langchain_anthropic`

📖 [View in docs](https://reference.langchain.com/python/langchain-anthropic/middleware/file_search/StateFileSearchMiddleware/__init__/glob_search)

Fast file pattern matching tool that works with any codebase size.

Supports glob patterns like `**/*.js` or `src/**/*.ts`.

Returns matching file paths sorted by modification time.

Use this tool when you need to find files by name patterns.

## Signature

```python
glob_search(
    runtime: ToolRuntime[None, AnthropicToolsState],
    pattern: str,
    path: str = '/',
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `pattern` | `str` | Yes | The glob pattern to match files against. |
| `path` | `str` | No | The directory to search in.  If not specified, searches from root. (default: `'/'`) |

## Returns

`str`

Newline-separated list of matching file paths, sorted by modification
time (most recently modified first).

Returns `'No files found'` if no matches.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/c59e83a1ffba63d709ea4847445845edd82085dc/libs/partners/anthropic/langchain_anthropic/middleware/file_search.py#L131)