Skip to content

Mastra

Use Chronary’s calendar tools in Mastra. createChronaryMastraToolkit returns tools ready to pass to a Mastra Agent.

Terminal window
npm install @chronary/toolkit @chronary/sdk @mastra/core
import { Agent } from '@mastra/core/agent';
import { openai } from '@ai-sdk/openai';
import { createChronaryMastraToolkit } from '@chronary/toolkit/mastra';
const tools = createChronaryMastraToolkit({
apiKey: process.env.CHRONARY_API_KEY!,
});
const agent = new Agent({
name: 'scheduler',
instructions: 'You manage the user’s calendar: check availability and book meetings.',
model: openai('gpt-4o'),
tools,
});
const res = await agent.generate('Find a 30-min slot with Alex this week and book it.');
console.log(res.text);