Yolk SDK
Connectors

Connectors package

Define external API actions and turn them into agent tools.

Use @yolk-sdk/connectors when you want reusable, typed actions for external services such as Afloat, Dropbox, Fortnox, generic IMAP/POP3/SMTP email, GitHub, Google Gmail/Calendar/Drive, Kie image and video generation, LinkedIn search, Microsoft Outlook/OneDrive, Notion, Telegram, Todoist, R2, Figma, or custom APIs.

Install:

pnpm add @yolk-sdk/connectors@canary @yolk-sdk/agent@canary effect@4.2.0

Invoke a connector action

import { Effect } from 'effect'
import { makeCredentialBinding, makeIntegration } from '@yolk-sdk/connectors'
import { TelegramBotTokenSlot, TelegramConnector } from '@yolk-sdk/connectors/telegram'

const integration = makeIntegration({
  connectorId: 'telegram',
  config: { chatId: '123456' },
  credentialBindings: [
    makeCredentialBinding({
      slotId: TelegramBotTokenSlot.id,
      credentialRef: 'telegram-bot-token'
    })
  ]
})

const program = TelegramConnector.invoke({
  integration,
  action: 'telegram.send_message',
  input: { message: 'Hello from Yolk' }
})

const result = await Effect.runPromise(program.pipe(Effect.provide(HostConnectorLayer)))

HostConnectorLayer provides CredentialResolver, ConnectorHttpClient, and any provider-specific ports.

Turn connector actions into agent tools

Wiring fragment; provide host HTTP and credential layers for a separate Google integration:

import { makeCredentialBinding, makeIntegration } from '@yolk-sdk/connectors'
import { makeConnectorToolModule } from '@yolk-sdk/connectors/agent'
import { GoogleConnector, GoogleOAuthCredentialSlot } from '@yolk-sdk/connectors/google'

const googleIntegration = makeIntegration({
  connectorId: 'google',
  credentialBindings: [
    makeCredentialBinding({
      slotId: GoogleOAuthCredentialSlot.id,
      credentialRef: 'host-google-oauth-credential'
    })
  ]
})

const destructiveGoogleActions = new Set([
  'calendar.delete_event',
  'drive.trash_file',
  'drive.delete_file',
  'gmail.trash',
  'gmail.batch_trash',
  'gmail.delete_permanently',
  'gmail.draft_delete',
  'gmail.delete_label',
  'gmail.send_message'
])

const writingGoogleActions = new Set([
  'calendar.create_event',
  'calendar.update_event',
  'drive.create_folder',
  'gmail.modify_labels',
  'gmail.create_label',
  'gmail.update_label',
  'gmail.untrash',
  'gmail.set_read',
  'gmail.batch_set_read',
  'gmail.batch_set_starred',
  'gmail.batch_modify_labels',
  'gmail.batch_untrash',
  'gmail.draft_compose',
  'gmail.draft_update',
  'gmail.draft_reply'
])

const googleTools = makeConnectorToolModule(GoogleConnector, {
  integration: googleIntegration,
  layer: HostConnectorLayer,
  access: action =>
    destructiveGoogleActions.has(action)
      ? 'destructive'
      : writingGoogleActions.has(action)
        ? 'write'
        : 'read'
})

Resolve the module with @yolk-sdk/agent/tools, pass the tool definitions into the loop, and execute through the returned tool executor.

Provider modules

SubpathUse for
@yolk-sdk/connectors/afloatAfloat remote MCP auth data
@yolk-sdk/connectors/dropboxDropbox metadata, search, file management, and host-only file download
@yolk-sdk/connectors/emailGeneric IMAP reads/drafts/message state, POP3 reads, and SMTP submission
@yolk-sdk/connectors/figmaFigma remote MCP auth data
@yolk-sdk/connectors/fortnoxCompany, customers, invoices, suppliers, articles, prices, cost centers, payments, offers, inbox, settings, profile, bookkeeping (vouchers, accounts, financial years, SIE)
@yolk-sdk/connectors/githubGitHub issues, pull requests, reviews, and repository context for one configured repo
@yolk-sdk/connectors/googleGmail, Calendar, and Drive
@yolk-sdk/connectors/kieKie image/video generation tasks (GPT Image 2, Wan 2.7) and task status
@yolk-sdk/connectors/linkedin-searchExa people search and Enrich Layer profile/email
@yolk-sdk/connectors/microsoftMicrosoft Outlook and OneDrive through Microsoft Graph
@yolk-sdk/connectors/notionNotion pages, blocks, databases, data sources, comments, users
@yolk-sdk/connectors/r2-storageR2 upload URL with host presigner
@yolk-sdk/connectors/telegramTelegram bot send/validate
@yolk-sdk/connectors/todoistTodoist projects, tasks, labels

Fortnox exposes 51 read, 32 write, and 19 destructive actions through one fortnox.oauth binding. Fortnox scopes themselves permit both read and write; action metadata helps hosts authorize connector calls but does not narrow the underlying token. Destructive actions (deletes, payment bookkeeping, creating a voucher, offer conversion, cancellation, emailing, marking sent) need host approval. Customer-invoice sending and booking are not exposed. Hosts own consent and token lifecycle.

Microsoft Outlook and OneDrive are exposed from the provider-level microsoft subpath because Microsoft Graph is their shared API and OAuth resource boundary. Workload action ids remain outlook.* and onedrive.*, while every scoped slot uses the same microsoft.oauth binding. One credential can therefore cover both workloads when consent includes their Mail.* and Files.* permissions.

Outlook inputs use /me by default; set mailbox for an explicit Exchange Online mailbox. Delegated message calls use Shared scopes unless mailbox matches OAuthCredential.accountId case-insensitively, in the same Graph ID/principal-name form; see Microsoft mailbox permissions. Application hosts use mailboxAccessMode: 'application'. OneDrive inputs use /me/drive by default; set driveId for an explicit drive, oneDriveAccessMode: 'delegated_all' for broader delegated permissions, or oneDriveAccessMode: 'application' for application tokens. Discovery, metadata, same-drive move, asynchronous copy, and copy-status polling stay on onedrive.* actions. Original file bytes use host-only downloadOneDriveItem with ConnectorBinaryHttpClient; create/update use the separate binary-write port. OneDrive resumable sessions remain unimplemented; host-only addOutlookAttachment attaches files to Outlook drafts, with upload sessions for 3–150 MiB. Default Microsoft tools still need CredentialResolver and ConnectorHttpClient. The host still owns Entra tenant policy, OAuth callbacks, refresh, storage, consent, application resource scoping, Exchange grants, network policy, and file materialization.

Dropbox follows the same split: dropbox.* actions cover discovery, metadata, and file management, while original file bytes use host-only downloadDropboxFile with ConnectorBinaryHttpClient and the files.content.read scope. Host-only create/update require files.content.write.

Google's gmail.get_thread action returns normalized messages with decoded message text and attachment metadata, without raw MIME or attachment content. See the Connectors catalog for its required format, its optional metadataHeaders selection (also on gmail.get_message, only with format: 'metadata'), and output contract.

Google Drive actions stay in the provider-level google subpath and share the existing google.oauth credential binding with Gmail and Calendar. Metadata reads request drive.metadata.readonly; folder creation, trash, and permanent deletion request drive.file, which is limited to files created by or explicitly opened/shared with the app. The host owns OAuth refresh, consent policy, Google Picker integration, restricted-scope compliance, and binary file transfer.

Outlook and generic IMAP email support set_read (with boolean isRead), set_flag (with boolean isFlagged), trash, and untrash actions in their respective outlook.* and email.* namespaces, plus outlook.move_message for Graph folder moves. Outlook calls Graph directly; generic email requires optional host EmailClient.setRead, trash, and untrash methods. Generic email additionally supports email.move to any folder through optional EmailClient.move host support; the destination folder is required and the returned message ID uses destination UIDVALIDITY/UID when the host can map it. POP3/SMTP do not support these mailbox-state actions. Restore defaults to the inbox rather than remembering the original folder. See the Connectors catalog for inputs, permissions, and safe IMAP adapter requirements.

Gmail reports read state from the UNREAD label and flag state from the STARRED label through optional isRead/isFlagged fields (absent when labels are omitted), with matching typed filters on gmail.search, gmail.list, and gmail.list_threads (one decoded page of thread ids, snippets, and history ids). gmail.set_read flips UNREAD via gmail.modify consent and returns the normalized message. Outlook reports isRead plus follow-up flag state as isFlagged (flagged is true; not-flagged and completed are false; anything else asserts nothing), with matching typed filters composed into $filter on outlook.list_messages. These are provider-native models: Gmail labels, Outlook flags/folders/categories, and IMAP flags/keywords/folders are not identical, and the connector never pretends they are.

Explicit batch actions cover 1-100 unique messages with complete per-ID outcomes in messageIds order (succeeded, failed, unknown, not_attempted) plus exact summary counts, sanitized codes only, and provider-safe chunking: Gmail issues individually addressed requests sequentially (gmail.batch_set_read, gmail.batch_set_starred, gmail.batch_modify_labels, gmail.batch_trash, gmail.batch_untrash); Outlook uses Graph JSON batching with at most 20 subrequests per envelope (outlook.batch_set_read, outlook.batch_set_flag, outlook.batch_move, outlook.batch_trash, outlook.batch_untrash, outlook.batch_modify_categories); generic email forwards to matching optional host EmailClient.batch* methods. A batch report returns ActionResult.success even when every item failed: success means a valid report exists, not that every mutation worked. unknown means the mutation may or may not have executed, so hosts must reconcile before retrying; cancellation may prevent a report entirely, and durable reconciliation stays host-owned.

Permanent deletion is a separate destructive batch-shaped action on each provider (gmail.delete_permanently, outlook.delete_permanently, email.delete_permanently). Gmail deletes immediately (not trash) and requires opt-in full-mail (https://mail.google.com/) consent, which is never added to combined/default consent; gmail.modify is insufficient. Outlook permanentDelete moves items into Recoverable Items/Purges, so retention or holds may still preserve them: it is not compliance erasure. Generic email deletes exactly the identified UID-scoped messages without blanket-expunge and claims no backup erasure. Approval, auditing, retention policy, and reconciliation remain host-owned.

Manage email labels

Gmail supports label create/get/update/delete through gmail.create_label, gmail.get_label, gmail.update_label, and gmail.delete_label, alongside existing list and message assignment via gmail.modify_labels. Mutations reuse gmail.modify consent.

Outlook exposes outlook.list_categories, outlook.create_category, and outlook.delete_category with opt-in MailboxSettings.Read / MailboxSettings.ReadWrite consent. Message assignment uses category names, not IDs: outlook.set_categories replaces all names ([] clears), while outlook.modify_categories merges additions/removals through a non-atomic read followed by PATCH. Both use ordinary/shared message write permissions.

Generic email exposes email.modify_labels through optional EmailClient.modifyLabels host support. Labels are IMAP keywords, not system flags; hosts preserve unrelated flags and check server keyword support. email.set_flag stars through optional EmailClient.setFlag host support, and Gmail stars through gmail.set_starred with the STARRED system label. IMAP has no standalone label catalog, and POP3/SMTP cannot persist labels. See the Connectors catalog for inputs and host contracts.

Transfer files

See Transfer connector files for the full capability matrix, raw-byte download/export and create/update helpers, consent, provider limits, concurrency guarantees and host transport duties. This also covers Outlook draft attachment uploads, R2, Drive, Fortnox, Notion, email, Telegram, Todoist and reuse of Afloat/Figma MCP. Bytes and write helpers are never added to generic connector action serialization.

What the host provides

Your app stores, encrypts, refreshes, revokes, and audits credentials. It also owns OAuth routes, callbacks, consent scopes, identity mapping, authorization, and HTTP execution policy.

On this page