Linear API tools for OpenAI, Anthropic, and AI SDK
npm install @tooly/linearLinear API tools for AI applications, compatible with OpenAI function calling, Anthropic tool use, and AI SDK.
``bash`
npm install @tooly/linearor
yarn add @tooly/linearor
pnpm add @tooly/linear
Get your Linear API key from your Linear settings.
`typescript
import { LinearTools } from '@tooly/linear'
const linear = new LinearTools('your-linear-api-key')
// Get available tools for function calling
const tools = linear.getTools()
// Execute a function
const result = await linear.executeFunction('createIssue', {
title: 'New bug report',
description: 'Bug description here',
teamId: 'team-id-here',
})
`
`typescript
import { createAITools } from '@tooly/linear'
const tools = createAITools('your-linear-api-key')
// Use with generateText
import { generateText } from 'ai'
const result = await generateText({
model: openai('gpt-4.1-nano'),
messages: [{ role: 'user', content: 'Create a new issue' }],
tools,
})
`
`typescript
import { createOpenAIFunctions } from '@tooly/linear'
const { tools, executeFunction } = createOpenAIFunctions('your-linear-api-key')
// Use with OpenAI client
const completion = await openai.chat.completions.create({
model: 'gpt-4.1-nano',
messages: [{ role: 'user', content: 'List my assigned issues' }],
tools,
})
// Execute function calls
for (const toolCall of completion.choices[0].message.tool_calls || []) {
const result = await executeFunction(toolCall.function.name, JSON.parse(toolCall.function.arguments))
}
`
`typescript
import { createAnthropicTools } from '@tooly/linear'
const { tools, executeFunction } = createAnthropicTools('your-linear-api-key')
// Use with Anthropic client
const message = await anthropic.messages.create({
model: 'claude-sonnet-4-20250514',
messages: [{ role: 'user', content: 'Create a new project' }],
tools,
})
// Execute tool calls
for (const toolUse of message.content.filter((c) => c.type === 'tool_use')) {
const result = await executeFunction(toolUse.name, toolUse.input)
}
`
- createIssue - Create a new issuegetIssue
- - Get issue details by IDupdateIssue
- - Update an existing issuesearchIssues
- - Search for issuescreateProject
- - Create a new projectgetTeams
- - Get all teamsgetUser` - Get current user details
-
MIT