# Get Available Modules

The following functions are used in order to get available modules, as exist in the [Modules Registry](/for-developers/hats-modules/building-hats-modules/modules-registry.md).

See the Module type [here](/for-developers/hats-modules/modules-sdk/types.md#module).

### <mark style="color:purple;">getModules</mark>

Get all available modules, optionally use a filter function in order to retrieve only a subset of the modules.

```typescript
const modules = hatsModulesClient.getAllModules();
```

***Arguments***:

```typescript
filter?: (module: Module) => boolean
```

An optional filter function. For each [Module](/for-developers/hats-modules/modules-sdk/types.md#module), should return `true` if the module should be included, `false` otherwise.

***Response***:

```typescript
{ [id: string]: Module }
```

An object that maps between module IDs and the corresponding module objects. A module ID is its implementation address.

### <mark style="color:purple;">getModuleById</mark>

Get a module object by its ID.

```typescript
const module = hatsModulesClient.getModuleById(moduleId);
```

***Arguments***:

```typescript
string
```

Module's ID (implementation address).

***Response***:

<pre class="language-typescript"><code class="lang-typescript"><strong>Module | undefined
</strong></code></pre>

The module that matches the provided ID, or `undefined` in case no matching module was found.

### <mark style="color:purple;">getModuleByImplementation</mark>

Get a module object by its implementation address.

```typescript
const module = hatsModulesClient.getModuleByImplementation(address);
```

***Arguments***:

```typescript
`0x${string}`
```

Module's implementation address.

***Response***:

<pre class="language-typescript"><code class="lang-typescript"><strong>Module | undefined
</strong></code></pre>

The module that matches the provided address, or `undefined` in case no matching module was found.

### <mark style="color:purple;">getModuleByInstance</mark>

Get the module object of an instance.

```typescript
const module = await hatsModulesClient.getModuleByInstance(address);
```

***Arguments***:

```typescript
`0x${string}`
```

Module's instance address.

***Response***:

<pre class="language-typescript"><code class="lang-typescript"><strong>Module | undefined
</strong></code></pre>

The module that matches the provided address, or `undefined` in case no matching module was found.

### <mark style="color:purple;">getModulesByInstances</mark>

Get the module objects of instances.

```typescript
const modules = await hatsModulesClient.getModulesByInstances(addresses);
```

***Arguments***:

```typescript
`0x${string}`[]
```

Addresses of the module instances.

***Response***:

<pre class="language-typescript"><code class="lang-typescript"><strong>(Module | undefined)[]
</strong></code></pre>

The modules matching the provided addresses. For every address that is not an instance of a registry module, the corresponding return value in the array will be `undefined`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hatsprotocol.xyz/for-developers/hats-modules/modules-sdk/get-available-modules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
