Open History to see the last commit
1import { toolDefinition } from '@tanstack/ai'
2
3// Shared by the server and the browser, so it holds no server code. The
4// server adds `run` and the tool's `.server()` in `agents.ts`. The browser
5// passes the list to the chat UI factory, which types each card from it.
6
7// The researcher calls this tool, so its card shows a tool call and a result.
8export const lookupWikipedia = toolDefinition({
9 name: 'lookupWikipedia',
10 description:
11 'Get the Wikipedia summary of one topic. Pass a short page title, for example "Octopus".',
12 inputSchema: {
13 type: 'object',
14 properties: { title: { type: 'string' } },
15 required: ['title'],
16 },
17})
18
19export const researcher = {
20 name: 'researcher',
21 description:
22 'Does this turn need facts or sources? Answer yes when the user asks to look something up, even if they also ask for a draft or for SEO. Answer no when they do not ask to look anything up.',
23 tools: [lookupWikipedia],
24} as const
25
26export const writer = {
27 name: 'writer',
28 description:
29 'Does this turn need a written article, post, or rewrite? Answer yes only when the user asks for an article, post, draft, or rewrite. Answer no when they ask for research or SEO and do not ask for an article.',
30} as const
31
32export const seo = {
33 name: 'seo',
34 description:
35 'Does this turn need SEO work? Answer yes when the user asks for SEO, search titles, a meta description, or tags. Answer no when they do not mention SEO, titles, a meta description, or tags.',
36} as const
37
38export const blogAgents = [researcher, writer, seo] as const