KosmoKrator

communication

SendGrid CLI for AI Agents

Use the SendGrid CLI from KosmoKrator to call SendGrid tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write API key auth

SendGrid CLI Setup

SendGrid can be configured headlessly with `kosmokrator integrations:configure sendgrid`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure sendgrid --set api_key="$SENDGRID_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor sendgrid --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key SENDGRID_API_KEY Secret secret yes API Key

Call SendGrid Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call sendgrid.sendgrid_list_contacts '{
  "page_size": 1,
  "page_token": "example_page_token"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:sendgrid sendgrid_list_contacts '{
  "page_size": 1,
  "page_token": "example_page_token"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs sendgrid --json
kosmo integrations:docs sendgrid.sendgrid_list_contacts --json
kosmo integrations:schema sendgrid.sendgrid_list_contacts --json
kosmo integrations:search "SendGrid" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to SendGrid.

sendgrid.sendgrid_list_contacts

Read read

List contacts in your SendGrid marketing contacts database. Supports pagination.

Parameters
page_size, page_token

Generic CLI call

kosmo integrations:call sendgrid.sendgrid_list_contacts '{"page_size":1,"page_token":"example_page_token"}' --json

Provider shortcut

kosmo integrations:sendgrid sendgrid_list_contacts '{"page_size":1,"page_token":"example_page_token"}' --json

sendgrid.sendgrid_send_email

Write write

Send an email via SendGrid. Specify sender, recipients, subject, and HTML or text content.

Parameters
from, to, subject, htmlContent, textContent

Generic CLI call

kosmo integrations:call sendgrid.sendgrid_send_email '{"from":"example_from","to":"example_to","subject":"example_subject","htmlContent":"example_htmlContent","textContent":"example_textContent"}' --json

Provider shortcut

kosmo integrations:sendgrid sendgrid_send_email '{"from":"example_from","to":"example_to","subject":"example_subject","htmlContent":"example_htmlContent","textContent":"example_textContent"}' --json

sendgrid.sendgrid_get_contact

Read read

Get details of a specific contact in SendGrid by their contact ID. Returns email, custom fields, and list memberships.

Parameters
id

Generic CLI call

kosmo integrations:call sendgrid.sendgrid_get_contact '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:sendgrid sendgrid_get_contact '{"id":"example_id"}' --json

sendgrid.sendgrid_get_current_user

Read read

Get the profile of the currently authenticated SendGrid user, including email, first name, and last name.

Parameters
none

Generic CLI call

kosmo integrations:call sendgrid.sendgrid_get_current_user '{}' --json

Provider shortcut

kosmo integrations:sendgrid sendgrid_get_current_user '{}' --json

sendgrid.sendgrid_get_template

Read read

Get details of a specific email template in SendGrid by its ID. Returns template name, versions, and active version content.

Parameters
id

Generic CLI call

kosmo integrations:call sendgrid.sendgrid_get_template '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:sendgrid sendgrid_get_template '{"id":"example_id"}' --json

sendgrid.sendgrid_list_emails

Read read

List emails in your SendGrid account. Supports filtering by query and pagination.

Parameters
limit, query

Generic CLI call

kosmo integrations:call sendgrid.sendgrid_list_emails '{"limit":1,"query":"example_query"}' --json

Provider shortcut

kosmo integrations:sendgrid sendgrid_list_emails '{"limit":1,"query":"example_query"}' --json

sendgrid.sendgrid_list_templates

Read read

List email templates in your SendGrid account. Supports pagination.

Parameters
page_size, page_token

Generic CLI call

kosmo integrations:call sendgrid.sendgrid_list_templates '{"page_size":1,"page_token":"example_page_token"}' --json

Provider shortcut

kosmo integrations:sendgrid sendgrid_list_templates '{"page_size":1,"page_token":"example_page_token"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

sendgrid.sendgrid_list_contacts

List contacts in your SendGrid marketing contacts database. Supports pagination.

Operation
Read read
Schema command
kosmo integrations:schema sendgrid.sendgrid_list_contacts --json
ParameterTypeRequiredDescription
page_size integer no Number of contacts to return per page (default: 50, max: 100).
page_token string no Token for the next page of results.

sendgrid.sendgrid_send_email

Send an email via SendGrid. Specify sender, recipients, subject, and HTML or text content.

Operation
Write write
Schema command
kosmo integrations:schema sendgrid.sendgrid_send_email --json
ParameterTypeRequiredDescription
from object yes Sender details as an object with "email" and optionally "name" keys, e.g. {"email": "[email protected]", "name": "My App"}.
to array yes Array of recipient objects, each with "email" and optionally "name", e.g. [{"email": "[email protected]", "name": "John"}].
subject string yes The email subject line.
htmlContent string no HTML body of the email.
textContent string no Plain text body of the email.

sendgrid.sendgrid_get_contact

Get details of a specific contact in SendGrid by their contact ID. Returns email, custom fields, and list memberships.

Operation
Read read
Schema command
kosmo integrations:schema sendgrid.sendgrid_get_contact --json
ParameterTypeRequiredDescription
id string yes The ID of the contact to retrieve.

sendgrid.sendgrid_get_current_user

Get the profile of the currently authenticated SendGrid user, including email, first name, and last name.

Operation
Read read
Schema command
kosmo integrations:schema sendgrid.sendgrid_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

sendgrid.sendgrid_get_template

Get details of a specific email template in SendGrid by its ID. Returns template name, versions, and active version content.

Operation
Read read
Schema command
kosmo integrations:schema sendgrid.sendgrid_get_template --json
ParameterTypeRequiredDescription
id string yes The ID of the template to retrieve.

sendgrid.sendgrid_list_emails

List emails in your SendGrid account. Supports filtering by query and pagination.

Operation
Read read
Schema command
kosmo integrations:schema sendgrid.sendgrid_list_emails --json
ParameterTypeRequiredDescription
limit integer no Maximum number of emails to return (default: 20, max: 100).
query string no Search query to filter emails (e.g., "subject=\"Welcome\"").

sendgrid.sendgrid_list_templates

List email templates in your SendGrid account. Supports pagination.

Operation
Read read
Schema command
kosmo integrations:schema sendgrid.sendgrid_list_templates --json
ParameterTypeRequiredDescription
page_size integer no Number of templates to return per page (default: 20, max: 100).
page_token string no Token for the next page of results.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.