# call

The call() method for the SurrealDB Mojo SDK runs a SurrealQL function.

Runs a SurrealQL function, built-in or custom, and returns its result.

```python title="Method Syntax"
client.call(fn_name, args, session, txn)
```

## Arguments

<table>
    <thead>
        <tr>
            <th colspan="2" scope="col">Argument</th>
            <th colspan="2" scope="col">Description</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td colspan="2" scope="row" data-label="Argument"><code>fn_name</code></td>
            <td colspan="2" scope="row" data-label="Description">The function name, for example <code>fn::greet</code> or <code>time::now</code>.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Argument"><code>args</code></td>
            <td colspan="2" scope="row" data-label="Description">The function arguments, each CBOR-encoded, as a <code>List[List[UInt8]]</code>.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Argument"><code>session</code></td>
            <td colspan="2" scope="row" data-label="Description">An optional session id.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Argument"><code>txn</code></td>
            <td colspan="2" scope="row" data-label="Description">An optional transaction id.</td>
        </tr>
    </tbody>
</table>

## Example usage

```python
from surrealdb import CborCodec
from std.collections import List

var codec = CborCodec()
var args = List[List[UInt8]]()
args.append(codec.encode_text("Chiru"))

var resp = client.call("fn::greet", args)
```
