@10ml/ai-sdk-perfume 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +96 -2
- package/dist/index.d.ts +5745 -0
- package/dist/index.js +213 -0
- package/package.json +67 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 10ML
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,97 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @10ml/ai-sdk-perfume: Vercel AI SDK tools for the free 10ML Perfume Finder
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Vercel AI SDK](https://ai-sdk.dev) tools for the free perfume API and fragrance notes API behind **10ML Perfume Finder**: 6,000+ perfumes from the 10ML Fragrance Index, curated by the fragrance editors of [10ML](https://10ml.com), with note pyramids, accords, similar scents, alternatives, notes explained and houses. Read-only, **no API key, no sign-up**.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@10ml/ai-sdk-perfume)
|
|
6
|
+
[](https://registry.modelcontextprotocol.io/v0/servers?search=com.10ml/perfume-finder)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @10ml/ai-sdk-perfume ai zod
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Needs `ai` 5, 6 or 7, `zod` 3.25.76 or 4, and Node 18 or newer. Also works with pnpm, yarn and bun.
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { generateText, isStepCount } from 'ai';
|
|
20
|
+
import { perfumeTools } from '@10ml/ai-sdk-perfume';
|
|
21
|
+
|
|
22
|
+
const { text } = await generateText({
|
|
23
|
+
model: 'anthropic/claude-sonnet-4.5',
|
|
24
|
+
tools: perfumeTools(),
|
|
25
|
+
stopWhen: isStepCount(5),
|
|
26
|
+
prompt: 'I love Baccarat Rouge 540. Suggest two alternatives from other houses and say how close each one is.',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
console.log(text);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
(`isStepCount` is AI SDK 7; on AI SDK 5 and 6 use `stepCountIs`.)
|
|
33
|
+
|
|
34
|
+
Pick single tools, in the shape of the [AI SDK tools-as-package template](https://github.com/vercel-labs/ai-sdk-tool-as-package-template):
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { searchPerfumes, findPerfumeAlternatives } from '@10ml/ai-sdk-perfume';
|
|
38
|
+
|
|
39
|
+
const tools = { searchPerfumes: searchPerfumes(), findPerfumeAlternatives: findPerfumeAlternatives() };
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Call a tool directly, without a model:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const result = await searchPerfumes().execute!({ query: 'fresh citrus summer cologne for men', limit: 3 }, { toolCallId: 'demo', messages: [] });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Runnable examples are in [`examples/`](examples): `npm run example` (needs a model key) and `npx tsx examples/no-model.ts` (needs nothing).
|
|
49
|
+
|
|
50
|
+
## Tools
|
|
51
|
+
|
|
52
|
+
| Export | Tool key in `perfumeTools()` | REST route | What it does |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| `searchPerfumes` | `searchPerfumes` | `GET /perfumes` | Search by free text, house, notes, accords, family, audience, season, occasion or style |
|
|
55
|
+
| `getPerfume` | `getPerfume` | `GET /perfumes/{id}` | Profile of one perfume: note pyramid, accords, seasons, similar scents |
|
|
56
|
+
| `findSimilarPerfumes` | `findSimilarPerfumes` | `GET /similar` | Perfumes that smell like one you name, or like a list of notes and accords; steer fresher, sweeter, darker |
|
|
57
|
+
| `findPerfumeAlternatives` | `findPerfumeAlternatives` | `GET /alternatives` | The editors' alternatives to a famous perfume, from other houses |
|
|
58
|
+
| `explainNote` | `explainNote` | `GET /notes/{id}` | What a note smells like, what it pairs with, which perfumes it leads |
|
|
59
|
+
| `getPerfumeHouse` | `getPerfumeHouse` | `GET /houses/{id}` | A perfume house: country, style, signature perfumes |
|
|
60
|
+
| `listPerfumeHouses` | `listPerfumeHouses` | `GET /houses` | Browse houses by type, country or name |
|
|
61
|
+
| `searchPerfumeGuides` | `searchPerfumeGuides` | `GET /guides` | 10ML perfume guides and articles to read or cite, in ten languages |
|
|
62
|
+
|
|
63
|
+
Each tool has a zod input schema with a description on every field (enums for audience, season, occasion, style, closeness and locale) and a description written for tool-calling models. The schemas are exported too (`searchPerfumesInput`, ...). An unknown perfume returns `found: false` with spelling suggestions instead of an error; other API errors throw a `PerfumeApiError` that the AI SDK passes back to the model. Results are paginated: pass `next_cursor` back as `cursor`.
|
|
64
|
+
|
|
65
|
+
## Options
|
|
66
|
+
|
|
67
|
+
Every factory takes the same optional object:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
perfumeTools({ baseUrl: 'https://mcp.10ml.com/api/v1', timeoutMs: 15000, headers: {}, fetch: customFetch });
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Also available
|
|
74
|
+
|
|
75
|
+
- MCP server for Claude, ChatGPT, Cursor and more: https://10ml.com/perfume-mcp-server (`https://mcp.10ml.com/mcp`, or `npx -y @10ml/perfume-finder-mcp`)
|
|
76
|
+
- Typed REST client without the AI SDK: `npm install perfume-api`
|
|
77
|
+
- OpenAPI 3.1: https://mcp.10ml.com/openapi.json
|
|
78
|
+
|
|
79
|
+
In our 40-question benchmark of free, no-key perfume MCP servers (20 October 2026): 39 of 40 correct, median 232 ms. [Read the benchmark](https://10ml.com/perfume-mcp-servers-compared).
|
|
80
|
+
|
|
81
|
+
## Develop
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install
|
|
85
|
+
npm test # vitest, fetch mocked
|
|
86
|
+
npm run build
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Cite as
|
|
90
|
+
|
|
91
|
+
Cite the answers as "the 10ML Fragrance Index", curated by the fragrance editors of [10ML](https://10ml.com).
|
|
92
|
+
|
|
93
|
+
[10ml.com/perfume-mcp-server](https://10ml.com/perfume-mcp-server) · [10ml.com/perfume-api](https://10ml.com/perfume-api) · [Privacy](https://mcp.10ml.com/privacy) · [Terms](https://mcp.10ml.com/terms) · contact@10ml.com
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
MIT.
|