Listing Tools
Copy
import { RunTools } from '@runtools/sdk';
const rt = new RunTools({ apiKey: process.env.RUNTOOLS_API_KEY });
// List installed tools
const tools = await rt.tools.list();
// List marketplace tools
const marketplace = await rt.marketplace.list();
// Filter by category
const emailTools = await rt.marketplace.list({
category: 'communication'
});
// Search
const results = await rt.marketplace.search('send notification');
Installing Tools
Copy
// Install from marketplace
await rt.tools.install('gmail');
await rt.tools.install('slack');
await rt.tools.install('github');
// Check if installed
const isInstalled = await rt.tools.isInstalled('gmail');
Configuring Tools
Copy
// Configure with credentials
await rt.tools.configure('gmail', {
refreshToken: process.env.GMAIL_REFRESH_TOKEN,
});
await rt.tools.configure('slack', {
botToken: process.env.SLACK_BOT_TOKEN,
});
await rt.tools.configure('github', {
token: process.env.GITHUB_TOKEN,
});
// OAuth flow (opens browser)
await rt.tools.configureOAuth('gmail');
Executing Tools
Copy
// Send email
const result = await rt.tools.execute('gmail', {
action: 'send_email',
to: '[email protected]',
subject: 'Hello from RunTools',
body: 'This email was sent via the Tools API!',
});
// Post to Slack
await rt.tools.execute('slack', {
action: 'post_message',
channel: '#general',
text: 'Hello from RunTools!',
});
// Create GitHub issue
await rt.tools.execute('github', {
action: 'create_issue',
repo: 'myorg/myrepo',
title: 'Bug report',
body: 'Description of the bug...',
});
// Query database
const result = await rt.tools.execute('postgres', {
action: 'query',
sql: 'SELECT * FROM users LIMIT 10',
});
Tool Actions
Each tool supports different actions:Gmail
Copy
// Send email
await rt.tools.execute('gmail', {
action: 'send_email',
to: '[email protected]',
subject: 'Subject',
body: 'Body',
});
// Read emails
const emails = await rt.tools.execute('gmail', {
action: 'list_emails',
query: 'is:unread',
maxResults: 10,
});
// Get email
const email = await rt.tools.execute('gmail', {
action: 'get_email',
id: 'email-id',
});
Slack
Copy
// Post message
await rt.tools.execute('slack', {
action: 'post_message',
channel: '#general',
text: 'Hello!',
});
// List channels
const channels = await rt.tools.execute('slack', {
action: 'list_channels',
});
// Read messages
const messages = await rt.tools.execute('slack', {
action: 'read_messages',
channel: '#general',
limit: 20,
});
GitHub
Copy
// Create issue
await rt.tools.execute('github', {
action: 'create_issue',
repo: 'owner/repo',
title: 'Title',
body: 'Body',
});
// Create PR
await rt.tools.execute('github', {
action: 'create_pr',
repo: 'owner/repo',
title: 'PR Title',
head: 'feature-branch',
base: 'main',
});
// List repos
const repos = await rt.tools.execute('github', {
action: 'list_repos',
});
Uninstalling Tools
Copy
await rt.tools.uninstall('gmail');
Tool Search Configuration
Copy
// Enable tool for tool_search
await rt.tools.configure('gmail', {
searchable: true,
});
// Disable from tool_search
await rt.tools.configure('stripe', {
searchable: false,
});
Types
Copy
import type {
Tool,
ToolConfig,
ToolExecuteResult,
MarketplaceTool,
} from '@runtools/sdk';