# glob

Canonical URL: https://developers.iagenify.com/sdk/agent/tools/glob/
Language: en

`glob({ pattern, path? })`

Find files by name pattern. One call instead of walking a tree folder by folder.

Status: category: read · free · returns paths

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `pattern` | string | required | `**/*.md`, `notes/*.{txt,md}`, `src/**/*.test.js`. |
| `path` | string |  | Folder to search in. The workspace root by default. |

## The patterns {#patterns}

| Written | Matches |
| --- | --- |
| `*.md` | Markdown files at that level |
| `**/*.md` | Markdown files at any depth |
| `src/**/*.{ts,tsx}` | Either extension, under `src` |
| `**/test-*` | Anything whose name starts with `test-` |

## Why it matters to the bill {#why}

> **A walk is one turn per folder**
>
> Listing a tree by hand costs a turn for each level. A pattern costs one. The system prompt tells the agent to use glob and grep instead of guessing paths, for exactly that reason.

## What usually follows {#then}

`read { paths }` with several of the matches in one call — the two together are how an agent takes in a project in two turns.

- [grep](/sdk/agent/tools/grep): Finding by content instead.
- [read](/sdk/agent/tools/read): Reading several at once.
- [Agent tools](/sdk/agent/tools): The 35, by family.
