.do
Mcp

Triggers MCP

Model Context Protocol reference for triggers.do - Initiate workflows based on business or system events

Triggers MCP

Initiate workflows based on business or system events

Overview

The Model Context Protocol (MCP) provides AI models with direct access to triggers.do through a standardized interface.

Installation

pnpm add @modelcontextprotocol/sdk

Configuration

Add to your MCP server configuration:

{
  "mcpServers": {
    "triggers": {
      "command": "npx",
      "args": ["-y", "@dotdo/mcp-server"],
      "env": {
        "DO_API_KEY": "your-api-key"
      }
    }
  }
}

Tools

triggers/invoke

Main tool for triggers.do operations.

{
  "name": "triggers/invoke",
  "description": "Initiate workflows based on business or system events",
  "inputSchema": {
    "type": "object",
    "properties": {
      "operation": {
        "type": "string",
        "description": "Operation to perform"
      },
      "parameters": {
        "type": "object",
        "description": "Operation parameters"
      }
    },
    "required": ["operation"]
  }
}

Usage in AI Models

Claude Desktop

// ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "triggers": {
      "command": "npx",
      "args": ["-y", "@dotdo/mcp-server", "--tool=triggers"],
      "env": {
        "DO_API_KEY": "undefined"
      }
    }
  }
}

OpenAI GPTs

# Custom GPT configuration
tools:
  - type: mcp
    server: triggers
    operations:
      - invoke
      - query
      - execute

Custom Integration

import { Client } from '@modelcontextprotocol/sdk/client/index.js'
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'

const transport = new StdioClientTransport({
  command: 'npx',
  args: ['-y', '@dotdo/mcp-server', '--tool=triggers'],
})

const client = new Client(
  {
    name: 'triggers-client',
    version: '1.0.0',
  },
  {
    capabilities: {},
  }
)

await client.connect(transport)

// Call tool
const result = await client.callTool({
  name: 'triggers/invoke',
  arguments: {
    operation: 'triggers',
    parameters: {},
  },
})

Tool Definitions

Available Tools

{
  "tools": [
    {
      "name": "triggers/invoke",
      "description": "Invoke triggers.do",
      "inputSchema": {
        /* ... */
      }
    },
    {
      "name": "triggers/query",
      "description": "Query triggers.do resources",
      "inputSchema": {
        /* ... */
      }
    },
    {
      "name": "triggers/status",
      "description": "Check triggers.do status",
      "inputSchema": {
        /* ... */
      }
    }
  ]
}

Resources

Available Resources

{
  "resources": [
    {
      "uri": "triggers://config",
      "name": "Triggers Configuration",
      "mimeType": "application/json"
    },
    {
      "uri": "triggers://docs",
      "name": "Triggers Documentation",
      "mimeType": "text/markdown"
    }
  ]
}

Prompts

Pre-configured Prompts

{
  "prompts": [
    {
      "name": "triggers-quick-start",
      "description": "Quick start guide for triggers.do",
      "arguments": []
    },
    {
      "name": "triggers-best-practices",
      "description": "Best practices for triggers.do",
      "arguments": []
    }
  ]
}

Examples

Basic Usage

// AI model calls tool via MCP
mcp call triggers/on

With Parameters

// Call with parameters
await mcp.callTool('triggers/invoke', {
  operation: 'process',
  parameters: {
    // Operation-specific parameters
  },
  options: {
    timeout: 30000,
  },
})

Error Handling

try {
  const result = await mcp.callTool('triggers/invoke', {
    operation: 'process',
  })
  return result
} catch (error) {
  if (error.code === 'TOOL_NOT_FOUND') {
    console.error('Triggers tool not available')
  } else {
    throw error
  }
}

AI Integration Patterns

Agentic Workflows

// AI agent uses triggers.do in workflow
const workflow = {
  steps: [
    {
      tool: 'triggers/invoke',
      operation: 'analyze',
      input: 'user-data',
    },
    {
      tool: 'triggers/process',
      operation: 'transform',
      input: 'analysis-result',
    },
  ],
}

Chain of Thought

AI models can reason about triggers.do operations:

User: "I need to process this data"

AI: "I'll use the triggers tool to:
1. Validate the data format
2. Process it through triggers.do
3. Return the results

Let me start..."

[Calls: mcp call triggers/on]

Server Implementation

Custom MCP Server

import { Server } from '@modelcontextprotocol/sdk/server/index.js'
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'

const server = new Server(
  {
    name: 'triggers-server',
    version: '1.0.0',
  },
  {
    capabilities: {
      tools: {},
      resources: {},
      prompts: {},
    },
  }
)

// Register tool
server.setRequestHandler('tools/call', async (request) => {
  if (request.params.name === 'triggers/invoke') {
    // Handle triggers.do operation
    return {
      content: [
        {
          type: 'text',
          text: JSON.stringify(result),
        },
      ],
    }
  }
})

const transport = new StdioServerTransport()
await server.connect(transport)

Best Practices

  1. Tool Design - Keep tools focused and single-purpose
  2. Error Messages - Provide clear, actionable errors
  3. Documentation - Include examples in tool descriptions
  4. Rate Limiting - Implement appropriate limits
  5. Security - Validate all inputs from AI models
  6. Monitoring - Track tool usage and errors