# AI agents

> Two tools an agent calls over HTTP: search by name, and read the record.

Source: https://new.wasmenia.com/en/developers/use-cases/agents

An agent that answers about brand identities from the archive, not from memory: it searches by name, reads the record, and answers from its fields. A missing field is `null`, never a placeholder, so the agent can’t mix up what’s known and what isn’t.

- `GET https://new.wasmenia.com/api/v1/search/suggest`
- `GET https://new.wasmenia.com/api/v1/brands/{slug}`

- **Products**: Search, identity data
- **Pulls**: One per brand asked about
- **Tools**: Ready-made JSON definitions

> **There is no MCP server**
>
> There is no public Wasmenia MCP server yet, and no date for one. What works today is two tools over HTTP from your server.

## The problem, and the fix

A language model guesses a brand’s colours or when its logo changed, and states the guess with confidence.

Give the agent two tools: `search_brands` searches by name and returns slugs, and `get_brand` reads the record. Answers are JSON with stable fields, all described in the [reference](https://new.wasmenia.com/developers/docs/reference.md). Both tool definitions are ready, with an OpenAPI spec and a docs index for models, in [Docs for AI](https://new.wasmenia.com/developers/docs/ai.md#agents) (Arabic).

## Who it’s for

### Design assistants

«What are this brand’s colours?» answered from its guidelines.

### Content agents

An article or deck with the brand’s current logo and right name.

### Search and research

A brand’s identity history with its versions and dates.

## Build it

### Get a key

Open a developer account in the console and make a key. The free plan is enough to start, and the key stays on your server in an environment variable.

### Define the two tools

`search_brands` with `q`, and `get_brand` with `slug`.

### Run them on your server

When the model asks for a tool, your code calls Wasmenia with the key and returns the answer as it is.

### Tell it what an empty field means

In the instructions: a `null` field is unknown, so say «unknown».

### Keep what it read

A brand’s record isn’t read twice in the same conversation.

## The two tools

`tools.json`

```json
[
  {
    "name": "search_brands",
    "description": "Search Wasmenia's archive of logos by brand name, in Arabic or English. Returns up to 8 matches, closest first, each with its slug.",
    "input_schema": {
      "type": "object",
      "properties": {
        "q": { "type": "string", "minLength": 2, "maxLength": 120 }
      },
      "required": ["q"]
    }
  },
  {
    "name": "get_brand",
    "description": "Read one brand's record by its slug: names, country, colours, current logo files and older versions. Fields the archive does not know are null. Each call counts as one pull.",
    "input_schema": {
      "type": "object",
      "properties": { "slug": { "type": "string" } },
      "required": ["slug"]
    }
  }
]
```

`tools.js`

```javascript
// On your server: the model asks for a tool, your code calls Wasmenia with the key.
const base = 'https://new.wasmenia.com';
const headers = { Authorization: `Bearer ${process.env.WASMENIA_API_KEY}` };

export async function runTool(name, input) {
  const url =
    name === 'search_brands'
      ? `${base}/api/v1/search/suggest?q=${encodeURIComponent(input.q)}`
      : `${base}/api/v1/brands/${encodeURIComponent(input.slug)}`;
  const res = await fetch(url, { headers });
  if (res.status === 404) return { error: 'not_found' };
  if (res.status === 429) return { error: 'rate_limited', retryAfter: res.headers.get('Retry-After') };
  if (!res.ok) return { error: `http_${res.status}` };
  return res.json();
}
```

## How many pulls it costs

Search isn’t counted, and each `get_brand` call is one pull. Keep the record by slug during the conversation, so ten questions about one brand are one pull.

## Questions

### When is the MCP server coming?

It isn’t built, and has no date. If it matters to you, tell us what you’re building on the ways-to-connect page.

### Does the agent read text from brands?

Descriptions and names are text written by the archive or the brands. Treat them as data, not instructions to the model.

**Docs for AI**

The two tool definitions, the OpenAPI spec, and the docs index for models.
