# at.functions.metadata

> Published by [hamburgerz.bsky.social](https://lexicon.garden/identity/did:plc:vsnj4aaxyatiht4spdht2q2t)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:vsnj4aaxyatiht4spdht2q2t/at.functions.metadata)
- [Documentation](https://lexicon.garden/lexicon/did:plc:vsnj4aaxyatiht4spdht2q2t/at.functions.metadata/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:vsnj4aaxyatiht4spdht2q2t/at.functions.metadata/examples)

## Definitions

### `at.functions.metadata`

**Type**: `record`

A WebAssembly function registered on AT Protocol

**Key**: `any`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | `blob` | Yes | Compiled WebAssembly binary |
| `mode` | `string` | Yes | Execution mode |
| `name` | `string` | Yes | Human-readable function name |
| `public` | `boolean` | No | Whether this function is publicly invocable |
| `version` | `string` | Yes | Semver string |
| `entrypoint` | `string` | Yes | WASM export name to call (always 'run') |
| `description` | `string` | No | Optional description of what the function does |
| `inputSchema` | `unknown` | No | Optional JSON Schema for input validation |
| `maxMemoryMb` | `integer` | No | Memory limit in megabytes |
| `allowedHosts` | `array` | No | For host-v1: list of AT URIs the function may read from |
| `outputSchema` | `unknown` | No | Optional JSON Schema for output description |
| `inputEncoding` | `string` | Yes | Input encoding (always application/json) |
| `maxDurationMs` | `integer` | No | Execution timeout in milliseconds |
| `outputEncoding` | `string` | Yes | Output encoding (always application/json) |

## Raw Schema

```json
{
  "id": "at.functions.metadata",
  "defs": {
    "main": {
      "key": "any",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "name",
          "version",
          "mode",
          "code",
          "entrypoint",
          "inputEncoding",
          "outputEncoding"
        ],
        "properties": {
          "code": {
            "type": "blob",
            "accept": [
              "application/wasm"
            ],
            "description": "Compiled WebAssembly binary"
          },
          "mode": {
            "type": "string",
            "description": "Execution mode",
            "knownValues": [
              "pure-v1",
              "host-v1",
              "component-v1"
            ]
          },
          "name": {
            "type": "string",
            "maxLength": 128,
            "description": "Human-readable function name"
          },
          "public": {
            "type": "boolean",
            "default": true,
            "description": "Whether this function is publicly invocable"
          },
          "version": {
            "type": "string",
            "maxLength": 32,
            "description": "Semver string"
          },
          "entrypoint": {
            "type": "string",
            "const": "run",
            "description": "WASM export name to call (always 'run')"
          },
          "description": {
            "type": "string",
            "maxLength": 2048,
            "description": "Optional description of what the function does"
          },
          "inputSchema": {
            "type": "unknown",
            "description": "Optional JSON Schema for input validation"
          },
          "maxMemoryMb": {
            "type": "integer",
            "default": 32,
            "maximum": 256,
            "minimum": 1,
            "description": "Memory limit in megabytes"
          },
          "allowedHosts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "For host-v1: list of AT URIs the function may read from"
          },
          "outputSchema": {
            "type": "unknown",
            "description": "Optional JSON Schema for output description"
          },
          "inputEncoding": {
            "type": "string",
            "const": "application/json",
            "description": "Input encoding (always application/json)"
          },
          "maxDurationMs": {
            "type": "integer",
            "default": 100,
            "maximum": 5000,
            "minimum": 1,
            "description": "Execution timeout in milliseconds"
          },
          "outputEncoding": {
            "type": "string",
            "const": "application/json",
            "description": "Output encoding (always application/json)"
          }
        }
      },
      "description": "A WebAssembly function registered on AT Protocol"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
