This is page 1 of 2. Use http://codebase.md/maton-ai/agent-toolkit?lines=true&page={x} to view the full context. # Directory Structure ``` ├── .github │ └── workflows │ ├── main.yml │ └── release.yml ├── .gitignore ├── .vscode │ ├── extensions.json │ └── settings.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── glama.json ├── LICENSE ├── modelcontextprotocol │ ├── .gitignore │ ├── .prettierrc │ ├── Dockerfile │ ├── eslint.config.mjs │ ├── jest.config.ts │ ├── package.json │ ├── pnpm-lock.yaml │ ├── README.md │ ├── scripts │ │ └── publish │ ├── smithery.yaml │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── README.md ├── SECURITY.md └── typescript ├── .gitignore ├── .prettierrc ├── eslint.config.mjs ├── examples │ ├── ai-sdk │ │ ├── .env.template │ │ ├── index.ts │ │ ├── package.json │ │ ├── README.md │ │ └── tsconfig.json │ ├── langchain │ │ ├── .env.template │ │ ├── index.ts │ │ ├── package.json │ │ ├── README.md │ │ └── tsconfig.json │ └── openai │ ├── .env.template │ ├── index.ts │ ├── package.json │ ├── README.md │ └── tsconfig.json ├── jest.config.ts ├── package.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── README.md ├── scripts │ └── publish ├── src │ ├── ai-sdk │ │ ├── index.ts │ │ ├── tool.ts │ │ └── toolkit.ts │ ├── langchain │ │ ├── index.ts │ │ ├── tool.ts │ │ └── toolkit.ts │ ├── modelcontextprotocol │ │ ├── index.ts │ │ └── toolkit.ts │ ├── openai │ │ ├── index.ts │ │ └── toolkit.ts │ └── shared │ ├── api.ts │ ├── configuration.ts │ ├── parameters │ │ ├── airtable.ts │ │ ├── asana.ts │ │ ├── aws.ts │ │ ├── calendly.ts │ │ ├── clickup.ts │ │ ├── google-calendar.ts │ │ ├── google-docs.ts │ │ ├── google-drive.ts │ │ ├── google-mail.ts │ │ ├── google-sheet.ts │ │ ├── hubspot.ts │ │ ├── jira.ts │ │ ├── jotform.ts │ │ ├── klaviyo.ts │ │ ├── mailchimp.ts │ │ ├── notion.ts │ │ ├── outlook.ts │ │ ├── pipedrive.ts │ │ ├── salesforce.ts │ │ ├── shopify.ts │ │ ├── slack.ts │ │ ├── stripe.ts │ │ ├── typeform.ts │ │ └── youtube.ts │ ├── prompts │ │ ├── airtable.ts │ │ ├── asana.ts │ │ ├── aws.ts │ │ ├── calendly.ts │ │ ├── clickup.ts │ │ ├── google-calendar.ts │ │ ├── google-docs.ts │ │ ├── google-drive.ts │ │ ├── google-mail.ts │ │ ├── google-sheet.ts │ │ ├── hubspot.ts │ │ ├── jira.ts │ │ ├── jotform.ts │ │ ├── klaviyo.ts │ │ ├── mailchimp.ts │ │ ├── notion.ts │ │ ├── outlook.ts │ │ ├── pipedrive.ts │ │ ├── salesforce.ts │ │ ├── shopify.ts │ │ ├── slack.ts │ │ ├── stripe.ts │ │ ├── typeform.ts │ │ └── youtube.ts │ └── tools.ts ├── tsconfig.json └── tsup.config.ts ``` # Files -------------------------------------------------------------------------------- /modelcontextprotocol/.gitignore: -------------------------------------------------------------------------------- ``` 1 | dist/ 2 | node_modules/ ``` -------------------------------------------------------------------------------- /typescript/examples/openai/.env.template: -------------------------------------------------------------------------------- ``` 1 | OPENAI_API_KEY="" 2 | MATON_API_KEY="" ``` -------------------------------------------------------------------------------- /typescript/examples/ai-sdk/.env.template: -------------------------------------------------------------------------------- ``` 1 | MATON_API_KEY="" 2 | OPENAI_API_KEY="" 3 | ``` -------------------------------------------------------------------------------- /typescript/examples/langchain/.env.template: -------------------------------------------------------------------------------- ``` 1 | MATON_API_KEY="" 2 | OPENAI_API_KEY="" 3 | ``` -------------------------------------------------------------------------------- /modelcontextprotocol/.prettierrc: -------------------------------------------------------------------------------- ``` 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5", 4 | "bracketSpacing": false 5 | } 6 | ``` -------------------------------------------------------------------------------- /typescript/.prettierrc: -------------------------------------------------------------------------------- ``` 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5", 4 | "bracketSpacing": false 5 | } 6 | ``` -------------------------------------------------------------------------------- /typescript/.gitignore: -------------------------------------------------------------------------------- ``` 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional stylelint cache 58 | .stylelintcache 59 | 60 | # Microbundle cache 61 | .rpt2_cache/ 62 | .rts2_cache_cjs/ 63 | .rts2_cache_es/ 64 | .rts2_cache_umd/ 65 | 66 | # Optional REPL history 67 | .node_repl_history 68 | 69 | # Output of 'npm pack' 70 | *.tgz 71 | 72 | # Yarn Integrity file 73 | .yarn-integrity 74 | 75 | # dotenv environment variable files 76 | .env 77 | .env.development.local 78 | .env.test.local 79 | .env.production.local 80 | .env.local 81 | 82 | # parcel-bundler cache (https://parceljs.org/) 83 | .cache 84 | .parcel-cache 85 | 86 | # Next.js build output 87 | .next 88 | out 89 | 90 | # Nuxt.js build / generate output 91 | .nuxt 92 | dist 93 | 94 | # Gatsby files 95 | .cache/ 96 | # Comment in the public line in if your project uses Gatsby and not Next.js 97 | # https://nextjs.org/blog/next-9-1#public-directory-support 98 | # public 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # vuepress v2.x temp and cache directory 104 | .temp 105 | .cache 106 | 107 | # Docusaurus cache and generated files 108 | .docusaurus 109 | 110 | # Serverless directories 111 | .serverless/ 112 | 113 | # FuseBox cache 114 | .fusebox/ 115 | 116 | # DynamoDB Local files 117 | .dynamodb/ 118 | 119 | # TernJS port file 120 | .tern-port 121 | 122 | # Stores VSCode versions used for testing VSCode extensions 123 | .vscode-test 124 | 125 | # yarn v2 126 | .yarn/cache 127 | .yarn/unplugged 128 | .yarn/build-state.yml 129 | .yarn/install-state.gz 130 | .pnp.* 131 | 132 | .turbo 133 | ``` -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- ``` 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | #.idea/ 161 | ``` -------------------------------------------------------------------------------- /typescript/examples/ai-sdk/README.md: -------------------------------------------------------------------------------- ```markdown 1 | # AI SDK Example 2 | 3 | ## Setup 4 | 5 | Copy the `.env.template` and populate with your values. 6 | 7 | ``` 8 | cp .env.template .env 9 | ``` 10 | 11 | ## Usage 12 | 13 | ``` 14 | npx ts-node index.ts --env 15 | ``` 16 | ``` -------------------------------------------------------------------------------- /typescript/examples/openai/README.md: -------------------------------------------------------------------------------- ```markdown 1 | # OpenAI Example 2 | 3 | ## Setup 4 | 5 | Copy the `.env.template` and populate with your values. 6 | 7 | ``` 8 | cp .env.template .env 9 | ``` 10 | 11 | ## Usage 12 | 13 | ``` 14 | npx ts-node index.ts --env 15 | ``` 16 | ``` -------------------------------------------------------------------------------- /typescript/examples/langchain/README.md: -------------------------------------------------------------------------------- ```markdown 1 | # LangChain Example 2 | 3 | ## Setup 4 | 5 | Copy the `.env.template` and populate with your values. 6 | 7 | ``` 8 | cp .env.template .env 9 | ``` 10 | 11 | ## Usage 12 | 13 | ``` 14 | npx ts-node index.ts --env 15 | ``` 16 | ``` -------------------------------------------------------------------------------- /typescript/README.md: -------------------------------------------------------------------------------- ```markdown 1 | # Maton Agent Toolkit - TypeScript 2 | 3 | The Maton Agent Toolkit enables popular agent frameworks including LangChain and Vercel's AI SDK to integrate with Maton APIs through function calling. It also provides tooling to quickly integrate metered billing for prompt and completion token usage. 4 | 5 | To get started, get your API key in your [Maton Dashboard][api-keys] and check out [documentation][docs]. 6 | 7 | ## Installation 8 | 9 | You don't need this source code unless you want to modify the package. If you just 10 | want to use the package run: 11 | 12 | ``` 13 | npm install @maton/agent-toolkit 14 | ``` 15 | 16 | ### Requirements 17 | 18 | - Node 18+ 19 | 20 | ### Usage 21 | 22 | ## Model Context Protocol 23 | 24 | The Maton Agent Toolkit also supports the [Model Context Protocol (MCP)](https://modelcontextprotocol.com/). 25 | 26 | To run the Maton MCP server using npx, use the following command: 27 | 28 | ### API Agent (Beta) 29 | 30 | ```bash 31 | # To use API agent 32 | npx -y @maton/mcp hubspot --agent --api-key=YOUR_MATON_API_KEY 33 | ``` 34 | 35 | ### API Action 36 | 37 | ```bash 38 | # To set up all available API actions 39 | npx -y @maton/mcp hubspot --actions=all --api-key=YOUR_MATON_API_KEY 40 | 41 | # To set up all available API actions 42 | npx -y @maton/mcp hubspot --actions=create-contact,list-contacts --api-key=YOUR_MATON_API_KEY 43 | ``` 44 | 45 | Replace `YOUR_MATON_API_KEY` with your actual Maton API key. Or, you could set the MATON_API_KEY in your environment variables. You can get your API key in your [Maton Dashboard][api-keys]. 46 | 47 | ### Usage with Claude Desktop 48 | 49 | Add the following to your `claude_desktop_config.json`. See [here](https://modelcontextprotocol.io/quickstart/user) for more details. 50 | 51 | ``` 52 | { 53 | "mcpServers": { 54 | "maton": { 55 | "command": "npx", 56 | "args": [ 57 | "-y", 58 | "@maton/mcp@latest", 59 | "hubspot", 60 | "--actions=all", 61 | "--api-key=YOUR_MATON_API_KEY" 62 | ] 63 | } 64 | } 65 | } 66 | ``` 67 | 68 | Make sure to replace `YOUR_MATON_API_KEY` with your actual Maton API key. Alternatively, you could set the MATON_API_KEY in `env` variables. You can get your API key in your [Maton Dashboard][api-keys]. 69 | 70 | ## Available API actions 71 | 72 | | App | Action | 73 | | ----------------- | ------------------------------------- | 74 | | `airtable` | `list-bases` | 75 | | `airtable` | `list-records` | 76 | | `airtable` | `list-tables` | 77 | | `asana` | `create-task` | 78 | | `asana` | `get-task` | 79 | | `asana` | `list-projects` | 80 | | `asana` | `list-tasks` | 81 | | `asana` | `list-workspaces` | 82 | | `aws` | `get-s3-object` | 83 | | `aws` | `list-s3-buckets` | 84 | | `aws` | `list-s3-objects` | 85 | | `calendly` | `get-event` | 86 | | `calendly` | `list-event-invitees` | 87 | | `calendly` | `list-event-types` | 88 | | `calendly` | `list-events` | 89 | | `clickup` | `create-task` | 90 | | `clickup` | `delete-task` | 91 | | `clickup` | `get-task` | 92 | | `clickup` | `list-folders` | 93 | | `clickup` | `list-lists` | 94 | | `clickup` | `list-spaces` | 95 | | `clickup` | `list-tasks` | 96 | | `clickup` | `list-workspaces` | 97 | | `google-calendar` | `create-event` | 98 | | `google-calendar` | `delete-event` | 99 | | `google-calendar` | `get-calendar` | 100 | | `google-calendar` | `get-event` | 101 | | `google-calendar` | `list-calendars` | 102 | | `google-calendar` | `list-events` | 103 | | `google-calendar` | `update-event` | 104 | | `google-docs` | `append-text` | 105 | | `google-docs` | `create-document` | 106 | | `google-docs` | `find-document` | 107 | | `google-docs` | `get-document` | 108 | | `google-drive` | `create-file` | 109 | | `google-drive` | `create-folder` | 110 | | `google-drive` | `delete-file` | 111 | | `google-drive` | `find-file` | 112 | | `google-drive` | `find-folder` | 113 | | `google-drive` | `get-file` | 114 | | `google-drive` | `list-files` | 115 | | `google-mail` | `add-label-to-email` | 116 | | `google-mail` | `create-draft` | 117 | | `google-mail` | `find-email` | 118 | | `google-mail` | `list-labels` | 119 | | `google-mail` | `send-email` | 120 | | `google-mail` | `remove-label-from-email` | 121 | | `google-sheet` | `add-column` | 122 | | `google-sheet` | `add-multiple-rows` | 123 | | `google-sheet` | `clear-cell` | 124 | | `google-sheet` | `clear-rows` | 125 | | `google-sheet` | `create-spreadsheet` | 126 | | `google-sheet` | `create-worksheet` | 127 | | `google-sheet` | `delete-rows` | 128 | | `google-sheet` | `delete-worksheet` | 129 | | `google-sheet` | `find-row` | 130 | | `google-sheet` | `get-cell` | 131 | | `google-sheet` | `get-spreadsheet` | 132 | | `google-sheet` | `get-values-in-range` | 133 | | `google-sheet` | `list-worksheets` | 134 | | `google-sheet` | `update-cell` | 135 | | `google-sheet` | `update-multiple-rows` | 136 | | `google-sheet` | `update-row` | 137 | | `hubspot` | `create-contact` | 138 | | `hubspot` | `get-contact` | 139 | | `hubspot` | `list-contacts` | 140 | | `hubspot` | `search-contacts` | 141 | | `hubspot` | `merge-contacts` | 142 | | `hubspot` | `update-contact` | 143 | | `hubspot` | `delete-contact` | 144 | | `hubspot` | `create-deal` | 145 | | `hubspot` | `get-deal` | 146 | | `hubspot` | `list-deals` | 147 | | `hubspot` | `search-deals` | 148 | | `hubspot` | `merge-deals` | 149 | | `hubspot` | `update-deal` | 150 | | `hubspot` | `delete-deal` | 151 | | `jira` | `list-clouds` | 152 | | `jira` | `get-issue` | 153 | | `jira` | `list-issues` | 154 | | `jira` | `add-comment-to-issue` | 155 | | `jira` | `list-comments` | 156 | | `jira` | `update-comment` | 157 | | `jira` | `list-projects` | 158 | | `jira` | `get-user` | 159 | | `jira` | `list-users` | 160 | | `jotform` | `list-forms` | 161 | | `jotform` | `list-submissions` | 162 | | `klaviyo` | `add-profiles-to-list` | 163 | | `klaviyo` | `assign-template-to-campaign-message` | 164 | | `klaviyo` | `create-campaign` | 165 | | `klaviyo` | `create-list` | 166 | | `klaviyo` | `create-profile` | 167 | | `klaviyo` | `create-template` | 168 | | `klaviyo` | `get-campaign-messages` | 169 | | `klaviyo` | `get-campaign-send-job` | 170 | | `klaviyo` | `get-campaigns` | 171 | | `klaviyo` | `get-lists` | 172 | | `klaviyo` | `get-profiles-for-list` | 173 | | `klaviyo` | `get-profiles` | 174 | | `klaviyo` | `get-templates` | 175 | | `klaviyo` | `send-campaign` | 176 | | `mailchimp` | `get-campaign` | 177 | | `mailchimp` | `search-campaign` | 178 | | `notion` | `create-page` | 179 | | `notion` | `find-page` | 180 | | `notion` | `get-page` | 181 | | `outlook` | `create-draft` | 182 | | `outlook` | `find-email` | 183 | | `outlook` | `send-email` | 184 | | `pipedrive` | `search-people` | 185 | | `salesforce` | `create-contact` | 186 | | `salesforce` | `get-contact` | 187 | | `salesforce` | `list-contacts` | 188 | | `shopify` | `create-order` | 189 | | `shopify` | `get-order` | 190 | | `shopify` | `list-orders` | 191 | | `slack` | `list-channels` | 192 | | `slack` | `list-messages` | 193 | | `slack` | `list-replies` | 194 | | `slack` | `send-message` | 195 | | `stripe` | `create-customer` | 196 | | `stripe` | `create-invoice-item` | 197 | | `stripe` | `create-invoice` | 198 | | `stripe` | `delete-customer` | 199 | | `stripe` | `get-customer` | 200 | | `stripe` | `get-invoice` | 201 | | `stripe` | `list-customers` | 202 | | `stripe` | `list-invoices` | 203 | | `typeform` | `get-form` | 204 | | `typeform` | `list-forms` | 205 | | `typeform` | `list-responses` | 206 | | `youtube` | `list-videos` | 207 | | `youtube` | `search-videos` | 208 | 209 | [api-keys]: https://maton.ai/api-keys 210 | [docs]: https://maton.ai/docs/api-reference 211 | ``` -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- ```markdown 1 | # Maton Agent Toolkit 2 | 3 | The Maton Agent Toolkit enables popular agent frameworks including Model Context Protocol (MCP) to integrate with Maton APIs through function calling. The library is not exhaustive of the entire Maton API. It includes support for Typescript. 4 | 5 | The toolkit was inspired by [Stripe Agent Toolkit][stripe-agent-toolkit], and its implementation shares similarities with the Stripe Agent Toolkit codebase. 6 | 7 | Included below are basic instructions, but refer to the [TypeScript](/typescript) package for more information. 8 | 9 | To get started, get your API key in your [Maton Dashboard][api-keys] and check out [documentation][docs]. 10 | 11 | ## TypeScript 12 | 13 | ### Installation 14 | 15 | You don't need this source code unless you want to modify the package. If you just 16 | want to use the package run: 17 | 18 | ``` 19 | npm install @maton/agent-toolkit 20 | ``` 21 | 22 | #### Requirements 23 | 24 | - Node 18+ 25 | 26 | ### Usage 27 | 28 | ## Model Context Protocol 29 | 30 | The Maton Agent Toolkit also supports the [Model Context Protocol (MCP)](https://modelcontextprotocol.com/). 31 | 32 | To run the Maton MCP server using npx, use the following command: 33 | 34 | ### API Agent (Beta) 35 | 36 | ```bash 37 | # To use API agent 38 | npx -y @maton/mcp hubspot --agent --api-key=YOUR_MATON_API_KEY 39 | ``` 40 | 41 | ### API Action 42 | 43 | ```bash 44 | # To set up all available API actions 45 | npx -y @maton/mcp hubspot --actions=all --api-key=YOUR_MATON_API_KEY 46 | 47 | # To set up all available API actions 48 | npx -y @maton/mcp hubspot --actions=create-contact,list-contacts --api-key=YOUR_MATON_API_KEY 49 | ``` 50 | 51 | Replace `YOUR_MATON_API_KEY` with your actual Maton API key. Or, you could set the MATON_API_KEY in your environment variables. You can get your API key in your [Maton Dashboard][api-keys]. 52 | 53 | ### Usage with Claude Desktop 54 | 55 | Add the following to your `claude_desktop_config.json`. See [here](https://modelcontextprotocol.io/quickstart/user) for more details. 56 | 57 | ``` 58 | { 59 | "mcpServers": { 60 | "maton": { 61 | "command": "npx", 62 | "args": [ 63 | "-y", 64 | "@maton/mcp@latest", 65 | "hubspot", 66 | "--actions=all", 67 | "--api-key=YOUR_MATON_API_KEY" 68 | ] 69 | } 70 | } 71 | } 72 | ``` 73 | 74 | Make sure to replace `YOUR_MATON_API_KEY` with your actual Maton API key. Alternatively, you could set the MATON_API_KEY in `env` variables. You can get your API key in your [Maton Dashboard][api-keys]. 75 | 76 | ## Available API actions 77 | 78 | | App | Action | 79 | | ----------------- | ------------------------------------- | 80 | | `airtable` | `list-bases` | 81 | | `airtable` | `list-records` | 82 | | `airtable` | `list-tables` | 83 | | `asana` | `create-task` | 84 | | `asana` | `get-task` | 85 | | `asana` | `list-projects` | 86 | | `asana` | `list-tasks` | 87 | | `asana` | `list-workspaces` | 88 | | `aws` | `get-s3-object` | 89 | | `aws` | `list-s3-buckets` | 90 | | `aws` | `list-s3-objects` | 91 | | `calendly` | `get-event` | 92 | | `calendly` | `list-event-invitees` | 93 | | `calendly` | `list-event-types` | 94 | | `calendly` | `list-events` | 95 | | `clickup` | `create-task` | 96 | | `clickup` | `delete-task` | 97 | | `clickup` | `get-task` | 98 | | `clickup` | `list-folders` | 99 | | `clickup` | `list-lists` | 100 | | `clickup` | `list-spaces` | 101 | | `clickup` | `list-tasks` | 102 | | `clickup` | `list-workspaces` | 103 | | `google-calendar` | `create-event` | 104 | | `google-calendar` | `delete-event` | 105 | | `google-calendar` | `get-calendar` | 106 | | `google-calendar` | `get-event` | 107 | | `google-calendar` | `list-calendars` | 108 | | `google-calendar` | `list-events` | 109 | | `google-calendar` | `update-event` | 110 | | `google-docs` | `append-text` | 111 | | `google-docs` | `create-document` | 112 | | `google-docs` | `find-document` | 113 | | `google-docs` | `get-document` | 114 | | `google-drive` | `create-file` | 115 | | `google-drive` | `create-folder` | 116 | | `google-drive` | `delete-file` | 117 | | `google-drive` | `find-file` | 118 | | `google-drive` | `find-folder` | 119 | | `google-drive` | `get-file` | 120 | | `google-drive` | `list-files` | 121 | | `google-mail` | `add-label-to-email` | 122 | | `google-mail` | `create-draft` | 123 | | `google-mail` | `find-email` | 124 | | `google-mail` | `list-labels` | 125 | | `google-mail` | `send-email` | 126 | | `google-mail` | `remove-label-from-email` | 127 | | `google-sheet` | `add-column` | 128 | | `google-sheet` | `add-multiple-rows` | 129 | | `google-sheet` | `clear-cell` | 130 | | `google-sheet` | `clear-rows` | 131 | | `google-sheet` | `create-spreadsheet` | 132 | | `google-sheet` | `create-worksheet` | 133 | | `google-sheet` | `delete-rows` | 134 | | `google-sheet` | `delete-worksheet` | 135 | | `google-sheet` | `find-row` | 136 | | `google-sheet` | `get-cell` | 137 | | `google-sheet` | `get-spreadsheet` | 138 | | `google-sheet` | `get-values-in-range` | 139 | | `google-sheet` | `list-worksheets` | 140 | | `google-sheet` | `update-cell` | 141 | | `google-sheet` | `update-multiple-rows` | 142 | | `google-sheet` | `update-row` | 143 | | `hubspot` | `create-contact` | 144 | | `hubspot` | `get-contact` | 145 | | `hubspot` | `list-contacts` | 146 | | `hubspot` | `search-contacts` | 147 | | `hubspot` | `merge-contacts` | 148 | | `hubspot` | `update-contact` | 149 | | `hubspot` | `delete-contact` | 150 | | `hubspot` | `create-deal` | 151 | | `hubspot` | `get-deal` | 152 | | `hubspot` | `list-deals` | 153 | | `hubspot` | `search-deals` | 154 | | `hubspot` | `merge-deals` | 155 | | `hubspot` | `update-deal` | 156 | | `hubspot` | `delete-deal` | 157 | | `jira` | `list-clouds` | 158 | | `jira` | `get-issue` | 159 | | `jira` | `list-issues` | 160 | | `jira` | `add-comment-to-issue` | 161 | | `jira` | `list-comments` | 162 | | `jira` | `update-comment` | 163 | | `jira` | `list-projects` | 164 | | `jira` | `get-user` | 165 | | `jira` | `list-users` | 166 | | `jotform` | `list-forms` | 167 | | `jotform` | `list-submissions` | 168 | | `klaviyo` | `add-profiles-to-list` | 169 | | `klaviyo` | `assign-template-to-campaign-message` | 170 | | `klaviyo` | `create-campaign` | 171 | | `klaviyo` | `create-list` | 172 | | `klaviyo` | `create-profile` | 173 | | `klaviyo` | `create-template` | 174 | | `klaviyo` | `get-campaign-messages` | 175 | | `klaviyo` | `get-campaign-send-job` | 176 | | `klaviyo` | `get-campaigns` | 177 | | `klaviyo` | `get-lists` | 178 | | `klaviyo` | `get-profiles-for-list` | 179 | | `klaviyo` | `get-profiles` | 180 | | `klaviyo` | `get-templates` | 181 | | `klaviyo` | `send-campaign` | 182 | | `mailchimp` | `get-campaign` | 183 | | `mailchimp` | `search-campaign` | 184 | | `notion` | `create-page` | 185 | | `notion` | `find-page` | 186 | | `notion` | `get-page` | 187 | | `outlook` | `create-draft` | 188 | | `outlook` | `find-email` | 189 | | `outlook` | `send-email` | 190 | | `pipedrive` | `search-people` | 191 | | `salesforce` | `create-contact` | 192 | | `salesforce` | `get-contact` | 193 | | `salesforce` | `list-contacts` | 194 | | `shopify` | `create-order` | 195 | | `shopify` | `get-order` | 196 | | `shopify` | `list-orders` | 197 | | `slack` | `list-channels` | 198 | | `slack` | `list-messages` | 199 | | `slack` | `list-replies` | 200 | | `slack` | `send-message` | 201 | | `stripe` | `create-customer` | 202 | | `stripe` | `create-invoice-item` | 203 | | `stripe` | `create-invoice` | 204 | | `stripe` | `delete-customer` | 205 | | `stripe` | `get-customer` | 206 | | `stripe` | `get-invoice` | 207 | | `stripe` | `list-customers` | 208 | | `stripe` | `list-invoices` | 209 | | `typeform` | `get-form` | 210 | | `typeform` | `list-forms` | 211 | | `typeform` | `list-responses` | 212 | | `youtube` | `list-videos` | 213 | | `youtube` | `search-videos` | 214 | 215 | [api-keys]: https://maton.ai/api-keys 216 | [docs]: https://maton.ai/docs/api-reference 217 | [stripe-agent-toolkit]: https://github.com/stripe/agent-toolkit 218 | ``` -------------------------------------------------------------------------------- /modelcontextprotocol/README.md: -------------------------------------------------------------------------------- ```markdown 1 | # Maton Model Context Protocol 2 | 3 | The Maton [Model Context Protocol](https://modelcontextprotocol.com/) server allows you to integrate with Maton APIs through function calling. This protocol supports various apps and actions to interact with different Maton services. 4 | 5 | You can get your API key in your [Maton Dashboard][api-keys] and check out [documentation][docs]. 6 | 7 | ## Setup 8 | 9 | To run the Maton MCP server using npx, use the following command: 10 | 11 | ### API Agent (Beta) 12 | 13 | ```bash 14 | # To use API agent 15 | npx -y @maton/mcp hubspot --agent --api-key=YOUR_MATON_API_KEY 16 | ``` 17 | 18 | ### API Action 19 | 20 | ```bash 21 | # To set up all available API actions 22 | npx -y @maton/mcp hubspot --actions=all --api-key=YOUR_MATON_API_KEY 23 | 24 | # To set up all available API actions 25 | npx -y @maton/mcp hubspot --actions=create-contact,list-contacts --api-key=YOUR_MATON_API_KEY 26 | ``` 27 | 28 | Make sure to replace `YOUR_MATON_API_KEY` with your actual Maton API key. Alternatively, you could set the MATON_API_KEY in your environment variables. You can get your API key in your [Maton Dashboard][api-keys]. 29 | 30 | ### Usage with Claude Desktop 31 | 32 | Add the following to your `claude_desktop_config.json`. See [here](https://modelcontextprotocol.io/quickstart/user) for more details. 33 | 34 | ``` 35 | { 36 | "mcpServers": { 37 | "maton": { 38 | "command": "npx", 39 | "args": [ 40 | "-y", 41 | "@maton/mcp@latest", 42 | "hubspot", 43 | "--actions=all", 44 | "--api-key=YOUR_MATON_API_KEY" 45 | ] 46 | } 47 | } 48 | } 49 | ``` 50 | 51 | Make sure to replace `YOUR_MATON_API_KEY` with your actual Maton API key. Alternatively, you could set the MATON_API_KEY in `env` variables. You can get your API key in your [Maton Dashboard][api-keys]. 52 | 53 | ## Debugging the Server 54 | 55 | To debug your server, you can use the [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector). 56 | 57 | First build the server 58 | 59 | ``` 60 | npm run build 61 | ``` 62 | 63 | Run the following command in your terminal: 64 | 65 | ```bash 66 | # Start MCP Inspector and server with all tools 67 | npx @modelcontextprotocol/inspector node dist/index.js salesforce --actions=all --api-key=YOUR_MATON_API_KEY 68 | ``` 69 | 70 | ### Instructions 71 | 72 | 1. Replace `YOUR_MATON_API_KEY` with your actual Maton API secret key. 73 | 2. Run the command to start the MCP Inspector. 74 | 3. Open the MCP Inspector UI in your browser and click Connect to start the MCP server. 75 | 4. You can see the list of tools you selected and test each tool individually. 76 | 77 | ## Available API actions 78 | 79 | | App | Action | 80 | | ----------------- | ------------------------------------- | 81 | | `airtable` | `list-bases` | 82 | | `airtable` | `list-records` | 83 | | `airtable` | `list-tables` | 84 | | `asana` | `create-task` | 85 | | `asana` | `get-task` | 86 | | `asana` | `list-projects` | 87 | | `asana` | `list-tasks` | 88 | | `asana` | `list-workspaces` | 89 | | `aws` | `get-s3-object` | 90 | | `aws` | `list-s3-buckets` | 91 | | `aws` | `list-s3-objects` | 92 | | `calendly` | `get-event` | 93 | | `calendly` | `list-event-invitees` | 94 | | `calendly` | `list-event-types` | 95 | | `calendly` | `list-events` | 96 | | `clickup` | `create-task` | 97 | | `clickup` | `delete-task` | 98 | | `clickup` | `get-task` | 99 | | `clickup` | `list-folders` | 100 | | `clickup` | `list-lists` | 101 | | `clickup` | `list-spaces` | 102 | | `clickup` | `list-tasks` | 103 | | `clickup` | `list-workspaces` | 104 | | `google-calendar` | `create-event` | 105 | | `google-calendar` | `delete-event` | 106 | | `google-calendar` | `get-calendar` | 107 | | `google-calendar` | `get-event` | 108 | | `google-calendar` | `list-calendars` | 109 | | `google-calendar` | `list-events` | 110 | | `google-calendar` | `update-event` | 111 | | `google-docs` | `append-text` | 112 | | `google-docs` | `create-document` | 113 | | `google-docs` | `find-document` | 114 | | `google-docs` | `get-document` | 115 | | `google-drive` | `create-file` | 116 | | `google-drive` | `create-folder` | 117 | | `google-drive` | `delete-file` | 118 | | `google-drive` | `find-file` | 119 | | `google-drive` | `find-folder` | 120 | | `google-drive` | `get-file` | 121 | | `google-drive` | `list-files` | 122 | | `google-mail` | `add-label-to-email` | 123 | | `google-mail` | `create-draft` | 124 | | `google-mail` | `find-email` | 125 | | `google-mail` | `list-labels` | 126 | | `google-mail` | `send-email` | 127 | | `google-mail` | `remove-label-from-email` | 128 | | `google-sheet` | `add-column` | 129 | | `google-sheet` | `add-multiple-rows` | 130 | | `google-sheet` | `clear-cell` | 131 | | `google-sheet` | `clear-rows` | 132 | | `google-sheet` | `create-spreadsheet` | 133 | | `google-sheet` | `create-worksheet` | 134 | | `google-sheet` | `delete-rows` | 135 | | `google-sheet` | `delete-worksheet` | 136 | | `google-sheet` | `find-row` | 137 | | `google-sheet` | `get-cell` | 138 | | `google-sheet` | `get-spreadsheet` | 139 | | `google-sheet` | `get-values-in-range` | 140 | | `google-sheet` | `list-worksheets` | 141 | | `google-sheet` | `update-cell` | 142 | | `google-sheet` | `update-multiple-rows` | 143 | | `google-sheet` | `update-row` | 144 | | `hubspot` | `create-contact` | 145 | | `hubspot` | `get-contact` | 146 | | `hubspot` | `list-contacts` | 147 | | `hubspot` | `search-contacts` | 148 | | `hubspot` | `merge-contacts` | 149 | | `hubspot` | `update-contact` | 150 | | `hubspot` | `delete-contact` | 151 | | `hubspot` | `create-deal` | 152 | | `hubspot` | `get-deal` | 153 | | `hubspot` | `list-deals` | 154 | | `hubspot` | `search-deals` | 155 | | `hubspot` | `merge-deals` | 156 | | `hubspot` | `update-deal` | 157 | | `hubspot` | `delete-deal` | 158 | | `jira` | `list-clouds` | 159 | | `jira` | `get-issue` | 160 | | `jira` | `list-issues` | 161 | | `jira` | `add-comment-to-issue` | 162 | | `jira` | `list-comments` | 163 | | `jira` | `update-comment` | 164 | | `jira` | `list-projects` | 165 | | `jira` | `get-user` | 166 | | `jira` | `list-users` | 167 | | `jotform` | `list-forms` | 168 | | `jotform` | `list-submissions` | 169 | | `klaviyo` | `add-profiles-to-list` | 170 | | `klaviyo` | `assign-template-to-campaign-message` | 171 | | `klaviyo` | `create-campaign` | 172 | | `klaviyo` | `create-list` | 173 | | `klaviyo` | `create-profile` | 174 | | `klaviyo` | `create-template` | 175 | | `klaviyo` | `get-campaign-messages` | 176 | | `klaviyo` | `get-campaign-send-job` | 177 | | `klaviyo` | `get-campaigns` | 178 | | `klaviyo` | `get-lists` | 179 | | `klaviyo` | `get-profiles-for-list` | 180 | | `klaviyo` | `get-profiles` | 181 | | `klaviyo` | `get-templates` | 182 | | `klaviyo` | `send-campaign` | 183 | | `mailchimp` | `get-campaign` | 184 | | `mailchimp` | `search-campaign` | 185 | | `notion` | `create-page` | 186 | | `notion` | `find-page` | 187 | | `notion` | `get-page` | 188 | | `outlook` | `create-draft` | 189 | | `outlook` | `find-email` | 190 | | `outlook` | `send-email` | 191 | | `pipedrive` | `search-people` | 192 | | `salesforce` | `create-contact` | 193 | | `salesforce` | `get-contact` | 194 | | `salesforce` | `list-contacts` | 195 | | `shopify` | `create-order` | 196 | | `shopify` | `get-order` | 197 | | `shopify` | `list-orders` | 198 | | `slack` | `list-channels` | 199 | | `slack` | `list-messages` | 200 | | `slack` | `list-replies` | 201 | | `slack` | `send-message` | 202 | | `stripe` | `create-customer` | 203 | | `stripe` | `create-invoice-item` | 204 | | `stripe` | `create-invoice` | 205 | | `stripe` | `delete-customer` | 206 | | `stripe` | `get-customer` | 207 | | `stripe` | `get-invoice` | 208 | | `stripe` | `list-customers` | 209 | | `stripe` | `list-invoices` | 210 | | `typeform` | `get-form` | 211 | | `typeform` | `list-forms` | 212 | | `typeform` | `list-responses` | 213 | | `youtube` | `list-videos` | 214 | | `youtube` | `search-videos` | 215 | 216 | [api-keys]: https://maton.ai/api-keys 217 | [docs]: https://maton.ai/docs/api-reference 218 | ``` -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- ```markdown 1 | # Security Policy 2 | 3 | ### Reporting a vulnerability 4 | 5 | Please do not open GitHub issues or pull requests - this makes the problem immediately visible to everyone, including malicious actors. 6 | 7 | Security issues in this open-source project can be safely reported to Maton support ([email protected]). 8 | ``` -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- ```markdown 1 | # Contributing 2 | 3 | Contributions of any kind are welcome! If you've found a bug or have a feature request, please feel free to [open an issue](/issues). 4 | 5 | <!-- We will try and respond to your issue or pull request within a week. --> 6 | 7 | To make changes yourself, follow these steps: 8 | 9 | 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository and [clone](https://help.github.com/articles/cloning-a-repository/) it locally. 10 | <!-- 1. TODO add install step(s), e.g. "Run `npm install`" --> 11 | <!-- 1. TODO add build step(s), e.g. "Build the library using `npm run build`" --> 12 | 2. Make your changes 13 | <!-- 1. TODO add test step(s), e.g. "Test your changes with `npm test`" --> 14 | 3. Submit a [pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) 15 | 16 | ## Contributor License Agreement ([CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement)) 17 | 18 | Once you have submitted a pull request, sign the CLA by clicking on the badge in the comment from [@CLAassistant](https://github.com/CLAassistant). 19 | 20 | <img width="910" alt="image" src="https://user-images.githubusercontent.com/62121649/198740836-70aeb322-5755-49fc-af55-93c8e8a39058.png"> 21 | 22 | <br /> 23 | Thanks for contributing to Stripe! :sparkles: 24 | ``` -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- ```markdown 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to make participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies within all project spaces, and it also applies when 49 | an individual is representing the project or its community in public spaces. 50 | Examples of representing a project or community include using an official 51 | project e-mail address, posting via an official social media account, or acting 52 | as an appointed representative at an online or offline event. Representation of 53 | a project may be further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [email protected]. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | ``` -------------------------------------------------------------------------------- /typescript/pnpm-workspace.yaml: -------------------------------------------------------------------------------- ```yaml 1 | packages: 2 | - '.' 3 | - 'examples/*' 4 | ``` -------------------------------------------------------------------------------- /typescript/src/ai-sdk/index.ts: -------------------------------------------------------------------------------- ```typescript 1 | import MatonAgentToolkit from './toolkit'; 2 | export {MatonAgentToolkit}; 3 | ``` -------------------------------------------------------------------------------- /typescript/src/langchain/index.ts: -------------------------------------------------------------------------------- ```typescript 1 | import MatonAgentToolkit from './toolkit'; 2 | export {MatonAgentToolkit}; 3 | ``` -------------------------------------------------------------------------------- /typescript/src/modelcontextprotocol/index.ts: -------------------------------------------------------------------------------- ```typescript 1 | import MatonAgentToolkit from './toolkit'; 2 | export {MatonAgentToolkit}; 3 | ``` -------------------------------------------------------------------------------- /typescript/src/openai/index.ts: -------------------------------------------------------------------------------- ```typescript 1 | import MatonAgentToolkit from './toolkit'; 2 | export {MatonAgentToolkit}; 3 | ``` -------------------------------------------------------------------------------- /glama.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "$schema": "https://glama.ai/mcp/schemas/server.json", 3 | "maintainers": [ 4 | "byungkyu", 5 | "rich-song" 6 | ] 7 | } ``` -------------------------------------------------------------------------------- /typescript/examples/ai-sdk/tsconfig.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["index.ts"], 7 | "exclude": ["node_modules", "dist"] 8 | } 9 | ``` -------------------------------------------------------------------------------- /typescript/examples/langchain/tsconfig.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["index.ts"], 7 | "exclude": ["node_modules", "dist"] 8 | } 9 | ``` -------------------------------------------------------------------------------- /typescript/examples/openai/tsconfig.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["index.ts"], 7 | "exclude": ["node_modules", "dist"] 8 | } 9 | ``` -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "recommendations": [ 3 | "EditorConfig.editorconfig", // default 4 | "ms-python.python", // intellisense 5 | "ms-python.flake8", // linting 6 | "charliermarsh.ruff" // formatting 7 | ] 8 | } 9 | ``` -------------------------------------------------------------------------------- /modelcontextprotocol/jest.config.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type {Config} from 'jest'; 2 | 3 | const config: Config = { 4 | preset: 'ts-jest', 5 | testEnvironment: 'node', 6 | roots: ['<rootDir>/src'], 7 | testMatch: ['**/test/**/*.ts?(x)'], 8 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 9 | }; 10 | 11 | export default config; 12 | ``` -------------------------------------------------------------------------------- /typescript/jest.config.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type {Config} from 'jest'; 2 | 3 | const config: Config = { 4 | preset: 'ts-jest', 5 | testEnvironment: 'node', 6 | roots: ['<rootDir>/src'], 7 | testMatch: ['**/test/**/*.ts?(x)'], 8 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 9 | }; 10 | 11 | export default config; 12 | ``` -------------------------------------------------------------------------------- /modelcontextprotocol/tsconfig.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "Node16", 5 | "moduleResolution": "Node16", 6 | "outDir": "./dist", 7 | "rootDir": "./src", 8 | "strict": true, 9 | "esModuleInterop": true, 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["src/**/*"], 14 | "exclude": ["node_modules"] 15 | } 16 | ``` -------------------------------------------------------------------------------- /typescript/tsconfig.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Default", 4 | "compilerOptions": { 5 | "outDir": "./dist", 6 | "target": "es2022", 7 | "moduleDetection": "force", 8 | "esModuleInterop": true, 9 | "skipLibCheck": true, 10 | "strict": true, 11 | "module": "NodeNext" 12 | }, 13 | "include": ["**/*.ts"], 14 | "exclude": ["node_modules", "examples"] 15 | } 16 | ``` -------------------------------------------------------------------------------- /modelcontextprotocol/smithery.yaml: -------------------------------------------------------------------------------- ```yaml 1 | # Smithery.ai configuration 2 | startCommand: 3 | type: stdio 4 | configSchema: 5 | # JSON Schema defining the configuration options for the MCP. 6 | {} 7 | commandFunction: 8 | # A function that produces the CLI command to start the MCP on stdio. 9 | |- 10 | (config) => ({ 11 | "command": "node", 12 | "args": [ 13 | "dist/index.js" 14 | ], 15 | "env": {} 16 | }) 17 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/pipedrive.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Outlook app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Outlook app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Outlook agent. 11 | `; 12 | 13 | export const searchPeoplePrompt = ` 14 | Search people in Pipedrive. 15 | `; 16 | ``` -------------------------------------------------------------------------------- /typescript/examples/openai/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "maton-agent-toolkit-examples-openai", 3 | "version": "0.1.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "dotenv": "^16.4.5", 13 | "openai": "^4.86.1", 14 | "@maton/agent-toolkit": "^0.0.8" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "^22.7.4" 18 | } 19 | } 20 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/jotform.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const listFormsParameters = z.object({}); 12 | 13 | export const listSubmissionsParameters = z.object({ 14 | form_id: z.string().describe('The ID of form'), 15 | }); 16 | ``` -------------------------------------------------------------------------------- /typescript/examples/ai-sdk/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "exfunc-agent-toolkit-examples-ai-sdk", 3 | "version": "0.1.0", 4 | "description": "", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "author": "", 9 | "license": "MIT", 10 | "dependencies": { 11 | "@ai-sdk/openai": "^0.0.63", 12 | "@maton/agent-toolkit": "^0.0.8", 13 | "ai": "^3.4.7", 14 | "dotenv": "^16.4.5" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "^22.7.4" 18 | } 19 | } 20 | ``` -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "editor.formatOnSave": true, 3 | "python.defaultInterpreterPath": "./venv/bin/python", 4 | "[python]": { 5 | "editor.defaultFormatter": "charliermarsh.ruff", 6 | "editor.codeActionsOnSave": { 7 | "source.organizeImports": "never" 8 | } 9 | }, 10 | "[typescript]": { 11 | "editor.defaultFormatter": "esbenp.prettier-vscode" 12 | }, 13 | "[json]": { 14 | "editor.defaultFormatter": "esbenp.prettier-vscode" 15 | }, 16 | "ruff.lint.enable": false 17 | } 18 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/youtube.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the YouTube app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the YouTube app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the YouTube agent. 11 | `; 12 | 13 | export const listVideosPrompt = ` 14 | List videos in YouTube. 15 | `; 16 | 17 | export const searchVideosPrompt = ` 18 | Search videos in YouTube. 19 | `; 20 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/jotform.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Jotform app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Jotform app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Jotform agent. 11 | `; 12 | 13 | export const listFormsPrompt = ` 14 | List forms in Jotform. 15 | `; 16 | 17 | export const listSubmissionsPrompt = ` 18 | List form submissions in Jotform. 19 | `; 20 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/mailchimp.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const getCampaignParameters = z.object({ 12 | campaign_id: z.string().describe('The ID of the campaign'), 13 | }); 14 | 15 | export const searchCampaignsParameters = z.object({ 16 | q: z.string().describe('The search query'), 17 | }); 18 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/mailchimp.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Mailchimp app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Mailchimp app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Mailchimp agent. 11 | `; 12 | 13 | export const getCampaignPrompt = ` 14 | Get campaign in Mailchimp. 15 | `; 16 | 17 | export const searchCampaignPrompt = ` 18 | Search campaign in Mailchimp. 19 | `; 20 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/pipedrive.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const searchPeopleParameters = z.object({ 12 | q: z.string().describe('The search query'), 13 | max_results: z 14 | .number() 15 | .describe('The maximum number of results to return. Default is 20.') 16 | .optional(), 17 | }); 18 | ``` -------------------------------------------------------------------------------- /typescript/src/ai-sdk/tool.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type {CoreTool} from 'ai'; 2 | import {tool} from 'ai'; 3 | import {z} from 'zod'; 4 | import MatonAPI from '../shared/api'; 5 | 6 | export default function MatonTool( 7 | matonAPI: MatonAPI, 8 | method: string, 9 | description: string, 10 | schema: z.ZodObject<any, any, any, any, {[x: string]: any}> 11 | ): CoreTool { 12 | return tool({ 13 | description: description, 14 | parameters: schema, 15 | execute: (arg: z.output<typeof schema>) => { 16 | return matonAPI.run(method, arg); 17 | }, 18 | }); 19 | } 20 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/notion.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Notion app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Notion app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Notion agent. 11 | `; 12 | 13 | export const createPagePrompt = ` 14 | Create a page in Notion. 15 | `; 16 | 17 | export const findPagePrompt = ` 18 | Find page in Notion. 19 | `; 20 | 21 | export const getPagePrompt = ` 22 | Get a page in Notion. 23 | `; 24 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/outlook.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Outlook app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Outlook app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Outlook agent. 11 | `; 12 | 13 | export const createDraftPrompt = ` 14 | Create draft in Outlook. 15 | `; 16 | 17 | export const findEmailPrompt = ` 18 | Find email in Outlook. 19 | `; 20 | 21 | export const sendEmailPrompt = ` 22 | Send email in Outlook. 23 | `; 24 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/shopify.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Shopify app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Shopify app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Shopify agent. 11 | `; 12 | 13 | export const createOrderPrompt = ` 14 | Create order in Shopify. 15 | `; 16 | 17 | export const getOrderPrompt = ` 18 | Get order in Shopify. 19 | `; 20 | 21 | export const listOrdersPrompt = ` 22 | List orders in Shopify. 23 | `; 24 | ``` -------------------------------------------------------------------------------- /typescript/examples/langchain/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "exfunc-agent-toolkit-examples-langchain", 3 | "version": "0.1.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@langchain/core": "^0.3.43", 13 | "@langchain/langgraph": "^0.2.62", 14 | "@langchain/openai": "^0.3.17", 15 | "@maton/agent-toolkit": "^0.0.8", 16 | "dotenv": "^16.4.5", 17 | "langchain": "^0.3.2" 18 | }, 19 | "devDependencies": { 20 | "@types/node": "^22.7.4" 21 | } 22 | } 23 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/typeform.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Typeform app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Typeform app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Typeform agent. 11 | `; 12 | 13 | export const getFormPrompt = ` 14 | Get form in Typeform. 15 | `; 16 | 17 | export const listFormsPrompt = ` 18 | List forms in Typeform. 19 | `; 20 | 21 | export const listResponsesPrompt = ` 22 | List responses in a form in Typeform. 23 | `; 24 | ``` -------------------------------------------------------------------------------- /typescript/examples/ai-sdk/index.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {MatonAgentToolkit} from '@maton/agent-toolkit/ai-sdk'; 2 | import {openai} from '@ai-sdk/openai'; 3 | import {generateText} from 'ai'; 4 | 5 | require('dotenv').config(); 6 | 7 | const matonAgentToolkit = new MatonAgentToolkit({ 8 | app: 'hubspot', 9 | actions: ['create-contact', 'list-contacts'], 10 | }); 11 | 12 | (async () => { 13 | const result = await generateText({ 14 | model: openai('gpt-4o-mini'), 15 | tools: { 16 | ...matonAgentToolkit.getTools(), 17 | }, 18 | maxSteps: 10, 19 | prompt: 'create contact for [email protected] and list contacts', 20 | }); 21 | 22 | console.log(result.text); 23 | })(); 24 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/airtable.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Airtable app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Airtable app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Airtable agent. 11 | `; 12 | 13 | export const listBasesPrompt = ` 14 | This tool will list bases in Airtable. 15 | `; 16 | 17 | export const listRecordsPrompt = ` 18 | This tool will list records in a table in Airtable. 19 | `; 20 | 21 | export const listTablesPrompt = ` 22 | This tool will list tables in Airtable. 23 | `; 24 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/aws.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the AWS app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the AWS app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the AWS agent. 11 | `; 12 | 13 | export const getS3ObjectPrompt = ` 14 | This tool will get an S3 object through a presigned URL. 15 | `; 16 | 17 | export const listS3BucketsPrompt = ` 18 | This tool will list all S3 buckets in the account. 19 | `; 20 | 21 | export const listS3ObjectsPrompt = ` 22 | This tool will list all S3 objects in a bucket. 23 | `; 24 | ``` -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- ```dockerfile 1 | FROM node:22.12-alpine AS builder 2 | 3 | COPY modelcontextprotocol /app 4 | COPY modelcontextprotocol/tsconfig.json /tsconfig.json 5 | 6 | WORKDIR /app 7 | 8 | RUN --mount=type=cache,target=/root/.npm npm install 9 | 10 | RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev 11 | 12 | FROM node:22-alpine AS release 13 | 14 | COPY --from=builder /app/dist /app/dist 15 | COPY --from=builder /app/package.json /app/package.json 16 | COPY --from=builder /app/package-lock.json /app/package-lock.json 17 | 18 | ENV NODE_ENV=production 19 | 20 | WORKDIR /app 21 | 22 | RUN npm ci --ignore-scripts --omit-dev 23 | 24 | ENTRYPOINT ["node", "dist/index.js"] ``` -------------------------------------------------------------------------------- /modelcontextprotocol/Dockerfile: -------------------------------------------------------------------------------- ```dockerfile 1 | FROM node:22.12-alpine AS builder 2 | 3 | COPY modelcontextprotocol /app 4 | COPY modelcontextprotocol/tsconfig.json /tsconfig.json 5 | 6 | WORKDIR /app 7 | 8 | RUN --mount=type=cache,target=/root/.npm npm install 9 | 10 | RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev 11 | 12 | FROM node:22-alpine AS release 13 | 14 | COPY --from=builder /app/dist /app/dist 15 | COPY --from=builder /app/package.json /app/package.json 16 | COPY --from=builder /app/package-lock.json /app/package-lock.json 17 | 18 | ENV NODE_ENV=production 19 | 20 | WORKDIR /app 21 | 22 | RUN npm ci --ignore-scripts --omit-dev 23 | 24 | ENTRYPOINT ["node", "dist/index.js"] ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/airtable.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const listBasesParameters = z.object({}); 12 | 13 | export const listRecordsParameters = z.object({ 14 | base_id: z.string().describe('The base ID of the Airtable app'), 15 | table_id: z.string().describe('The ID of the table'), 16 | }); 17 | 18 | export const listTablesParameters = z.object({ 19 | base_id: z.string().describe('The base ID of the Airtable app'), 20 | }); 21 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/salesforce.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the salesforce app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the salesforce app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Salesforce agent. 11 | `; 12 | 13 | export const createContactPrompt = ` 14 | This tool will create a contact in Salesforce. 15 | `; 16 | 17 | export const getContactPrompt = ` 18 | This tool will get a contact from Salesforce. 19 | `; 20 | 21 | export const listContactsPrompt = ` 22 | This tool will list all contacts in Salesforce. 23 | `; 24 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/aws.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const getS3ObjectParameters = z.object({ 12 | bucket_name: z.string().describe('The name of the S3 bucket'), 13 | object_key: z.string().describe('The key of the S3 object'), 14 | }); 15 | 16 | export const listS3BucketsParameters = z.object({}); 17 | 18 | export const listS3ObjectsParameters = z.object({ 19 | bucket_name: z.string().describe('The name of the S3 bucket'), 20 | }); 21 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/slack.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Slack app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Slack app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Slack agent. 11 | `; 12 | 13 | export const listChannelsPrompt = ` 14 | List channels for the workspace in Slack. 15 | `; 16 | 17 | export const listMessagesPrompt = ` 18 | List messages in a channel in Slack. 19 | `; 20 | 21 | export const listRepliesPrompt = ` 22 | List replies in a channel in Slack. 23 | `; 24 | 25 | export const sendMessagePrompt = ` 26 | Send message to a channel in Slack. 27 | `; 28 | ``` -------------------------------------------------------------------------------- /typescript/tsup.config.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {defineConfig} from 'tsup'; 2 | 3 | export default defineConfig([ 4 | { 5 | entry: ['src/langchain/index.ts'], 6 | outDir: 'langchain', 7 | format: ['cjs', 'esm'], 8 | dts: true, 9 | sourcemap: true, 10 | }, 11 | { 12 | entry: ['src/ai-sdk/index.ts'], 13 | outDir: 'ai-sdk', 14 | format: ['cjs', 'esm'], 15 | dts: true, 16 | sourcemap: true, 17 | }, 18 | { 19 | entry: ['src/modelcontextprotocol/index.ts'], 20 | outDir: 'modelcontextprotocol', 21 | format: ['cjs', 'esm'], 22 | dts: true, 23 | sourcemap: true, 24 | }, 25 | { 26 | entry: ['src/openai/index.ts'], 27 | outDir: 'openai', 28 | format: ['cjs', 'esm'], 29 | dts: true, 30 | sourcemap: true, 31 | }, 32 | ]); 33 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/calendly.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Calendly app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Calendly app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Calendly agent. 11 | `; 12 | 13 | export const getEventPrompt = ` 14 | This tool will get an event in Calendly. 15 | `; 16 | 17 | export const listEventInviteesPrompt = ` 18 | This tool will list event invitees in Calendly. 19 | `; 20 | 21 | export const listEventTypesPrompt = ` 22 | This tool will list event types in Calendly. 23 | `; 24 | 25 | export const listEventsPrompt = ` 26 | This tool will list events in Calendly. 27 | `; 28 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/google-docs.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Google Docs app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Google Docs app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Google Docs agent. 11 | `; 12 | 13 | export const appendTextPrompt = ` 14 | This tool will append text to a Google document. 15 | `; 16 | 17 | export const createDocumentPrompt = ` 18 | This tool will create a Google document. 19 | `; 20 | 21 | export const findDocumentPrompt = ` 22 | This tool will find a Google document. 23 | `; 24 | 25 | export const getDocumentPrompt = ` 26 | This tool will get a Google document. 27 | `; 28 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/asana.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Asana app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Asana app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Asana agent. 11 | `; 12 | 13 | export const createTaskPrompt = ` 14 | This tool will create a task in Asana. 15 | `; 16 | 17 | export const getTaskPrompt = ` 18 | This tool will get a task in Asana. 19 | `; 20 | 21 | export const listProjectsPrompt = ` 22 | This tool will list projects in Asana. 23 | `; 24 | 25 | export const listTasksPrompt = ` 26 | This tool will list tasks in Asana. 27 | `; 28 | 29 | export const listWorkspacesPrompt = ` 30 | This tool will list workspaces in Asana. 31 | `; 32 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/notion.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createPageParameters = z.object({ 12 | parent_page_id: z 13 | .string() 14 | .describe('The identifier for a Notion parent page'), 15 | title: z.string().describe('The title of the page'), 16 | content: z.string().describe('Content of the page'), 17 | }); 18 | 19 | export const findPageParameters = z.object({ 20 | title: z.string().describe('The title of the page to search'), 21 | }); 22 | 23 | export const getPageParameters = z.object({ 24 | page_id: z.string().describe('The ID of page'), 25 | }); 26 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/slack.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const listChannelsParameters = z.object({}); 12 | 13 | export const listMessagesParameters = z.object({ 14 | channel_id: z.string().describe('The ID of channel'), 15 | }); 16 | 17 | export const listRepliesParameters = z.object({ 18 | channel_id: z.string().describe('The ID of channel'), 19 | ts: z.string().describe('The timestamp of the message'), 20 | }); 21 | 22 | export const sendMessageParameters = z.object({ 23 | channel_id: z.string().describe('The ID of channel'), 24 | text: z.string().describe('The text of the message'), 25 | }); 26 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/google-mail.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Gmail app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Gmail app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Gmail agent. 11 | `; 12 | 13 | export const addLabelToEmailPrompt = ` 14 | This tool will add label to an email in Gmail. 15 | `; 16 | 17 | export const createDraftPrompt = ` 18 | This tool will create draft in Gmail. 19 | `; 20 | 21 | export const findEmailPrompt = ` 22 | This tool will find email in Gmail. 23 | `; 24 | 25 | export const listLabelsPrompt = ` 26 | This tool will list labels in Gmail. 27 | `; 28 | 29 | export const sendEmailPrompt = ` 30 | This tool will send email in Gmail. 31 | `; 32 | 33 | export const removeLabelFromEmailPrompt = ` 34 | This tool will remove label from an email in Gmail. 35 | `; 36 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/google-docs.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const appendTextParameters = z.object({ 12 | doc_id: z.string().describe('The ID of Google document'), 13 | text: z.string().describe('The text of Google document'), 14 | }); 15 | 16 | export const createDocumentParameters = z.object({ 17 | title: z.string().describe('The title of Google document'), 18 | text: z.string().describe('The text of Google document'), 19 | }); 20 | 21 | export const findDocumentParameters = z.object({ 22 | q: z.string().describe('The search query'), 23 | }); 24 | 25 | export const getDocumentParameters = z.object({ 26 | doc_id: z.string().describe('The ID of Google document'), 27 | }); 28 | ``` -------------------------------------------------------------------------------- /typescript/src/langchain/toolkit.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {BaseToolkit} from '@langchain/core/tools'; 2 | import MatonTool from './tool'; 3 | import MatonAPI from '../shared/api'; 4 | import tools from '../shared/tools'; 5 | import {isToolAllowed, type Configuration} from '../shared/configuration'; 6 | 7 | class MatonAgentToolkit implements BaseToolkit { 8 | private _maton: MatonAPI; 9 | 10 | tools: MatonTool[]; 11 | 12 | constructor(configuration: Configuration) { 13 | this._maton = new MatonAPI(configuration.apiKey); 14 | 15 | const filteredTools = tools.filter((tool) => 16 | isToolAllowed(tool, configuration) 17 | ); 18 | 19 | this.tools = filteredTools.map( 20 | (tool) => 21 | new MatonTool( 22 | this._maton, 23 | tool.method, 24 | tool.description, 25 | tool.parameters 26 | ) 27 | ); 28 | } 29 | 30 | getTools(): MatonTool[] { 31 | return this.tools; 32 | } 33 | } 34 | 35 | export default MatonAgentToolkit; 36 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/salesforce.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createContactParameters = z.object({ 12 | first_name: z.string().describe('The first name of the contact'), 13 | last_name: z.string().describe('The last name of the contact'), 14 | description: z.string().optional().describe('The description of the contact'), 15 | email: z.string().email().optional().describe('The email of the contact'), 16 | phone: z.string().optional().describe('The phone number of the contact'), 17 | }); 18 | 19 | export const getContactParameters = z.object({ 20 | contact_id: z.string().describe('The ID of the contact'), 21 | }); 22 | 23 | export const listContactsParameters = z.object({}); 24 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/calendly.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const getEventParameters = z.object({ 12 | event_id: z.string().describe('The ID of the event'), 13 | }); 14 | 15 | export const listEventInviteesParameters = z.object({ 16 | event_id: z.string().describe('The ID of the event'), 17 | }); 18 | 19 | export const listEventTypesParameters = z.object({}); 20 | 21 | export const listEventsParameters = z.object({ 22 | invitee: z.string().describe('The email address of the invitee').optional(), 23 | status: z 24 | .enum(['active', 'cancelled']) 25 | .describe('The status of the event') 26 | .optional(), 27 | max_results: z 28 | .number() 29 | .describe('The maximum number of results to return. Default: 20.') 30 | .optional(), 31 | }); 32 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/stripe.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Stripe app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Stripe app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Stripe agent. 11 | `; 12 | 13 | export const createCustomerPrompt = ` 14 | Create a customer in Stripe. 15 | `; 16 | 17 | export const createInvoiceItemPrompt = ` 18 | Create an invoice item on an invoice in Stripe. 19 | `; 20 | 21 | export const createInvoicePrompt = ` 22 | Create an invoice on a customer in Stripe. 23 | `; 24 | 25 | export const deleteCustomerPrompt = ` 26 | Delete customer in Stripe. 27 | `; 28 | 29 | export const getCustomerPrompt = ` 30 | Get customer in Stripe. 31 | `; 32 | 33 | export const getInvoicePrompt = ` 34 | Get an invoice in Stripe. 35 | `; 36 | 37 | export const listCustomersPrompt = ` 38 | List customers in Stripe. 39 | `; 40 | 41 | export const listInvoicesPrompt = ` 42 | List invoices in Stripe. 43 | `; 44 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/google-drive.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Google Drive app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Google Drive app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Google Drive agent. 11 | `; 12 | 13 | export const createFilePrompt = ` 14 | This tool will create a file in Google Drive. 15 | `; 16 | 17 | export const createFolderPrompt = ` 18 | This tool will create a folder in Google Drive. 19 | `; 20 | 21 | export const deleteFilePrompt = ` 22 | This tool will delete a file from Google Drive. 23 | `; 24 | 25 | export const findFilePrompt = ` 26 | This tool will find a file in Google Drive. 27 | `; 28 | 29 | export const findFolderPrompt = ` 30 | This tool will find a folder in Google Drive. 31 | `; 32 | 33 | export const getFilePrompt = ` 34 | This tool will get a file from Google Drive. 35 | `; 36 | 37 | export const listFilesPrompt = ` 38 | This tool will list files in Google Drive. 39 | `; 40 | ``` -------------------------------------------------------------------------------- /typescript/src/ai-sdk/toolkit.ts: -------------------------------------------------------------------------------- ```typescript 1 | import MatonAPI from '../shared/api'; 2 | import tools from '../shared/tools'; 3 | import { 4 | checkConfiguration, 5 | isToolAllowed, 6 | type Configuration, 7 | } from '../shared/configuration'; 8 | import type {CoreTool} from 'ai'; 9 | import MatonTool from './tool'; 10 | 11 | class MatonAgentToolkit { 12 | private _maton: MatonAPI; 13 | 14 | tools: {[key: string]: CoreTool}; 15 | 16 | constructor(configuration: Configuration) { 17 | this._maton = new MatonAPI(configuration.apiKey); 18 | this.tools = {}; 19 | 20 | checkConfiguration(configuration); 21 | 22 | const filteredTools = tools.filter((tool) => 23 | isToolAllowed(tool, configuration) 24 | ); 25 | 26 | filteredTools.forEach((tool) => { 27 | // @ts-ignore 28 | this.tools[tool.method] = MatonTool( 29 | this._maton, 30 | tool.method, 31 | tool.description, 32 | tool.parameters 33 | ); 34 | }); 35 | } 36 | 37 | getTools(): {[key: string]: CoreTool} { 38 | return this.tools; 39 | } 40 | } 41 | 42 | export default MatonAgentToolkit; 43 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/clickup.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the ClickUp app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the ClickUp app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the ClickUp agent. 11 | `; 12 | 13 | export const createTaskPrompt = ` 14 | This tool will create a task in ClickUp. 15 | `; 16 | 17 | export const deleteTaskPrompt = ` 18 | This tool will delete a task in ClickUp. 19 | `; 20 | 21 | export const getTaskPrompt = ` 22 | This tool will get a task in ClickUp. 23 | `; 24 | 25 | export const listFoldersPrompt = ` 26 | This tool will list folders in ClickUp. 27 | `; 28 | 29 | export const listListsPrompt = ` 30 | This tool will list lists in ClickUp. 31 | `; 32 | 33 | export const listSpacesPrompt = ` 34 | This tool will list spaces in ClickUp. 35 | `; 36 | 37 | export const listTasksPrompt = ` 38 | This tool will list tasks in ClickUp. 39 | `; 40 | 41 | export const listWorkspacesPrompt = ` 42 | This tool will list workspaces in ClickUp. 43 | `; 44 | ``` -------------------------------------------------------------------------------- /typescript/src/langchain/tool.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | import {StructuredTool} from '@langchain/core/tools'; 3 | import {CallbackManagerForToolRun} from '@langchain/core/callbacks/manager'; 4 | import {RunnableConfig} from '@langchain/core/runnables'; 5 | import MatonAPI from '../shared/api'; 6 | 7 | class MatonTool extends StructuredTool { 8 | matonAPI: MatonAPI; 9 | 10 | method: string; 11 | 12 | name: string; 13 | 14 | description: string; 15 | 16 | schema: z.ZodObject<any, any, any, any>; 17 | 18 | constructor( 19 | MatonAPI: MatonAPI, 20 | method: string, 21 | description: string, 22 | schema: z.ZodObject<any, any, any, any, {[x: string]: any}> 23 | ) { 24 | super(); 25 | 26 | this.matonAPI = MatonAPI; 27 | this.method = method; 28 | this.name = method; 29 | this.description = description; 30 | this.schema = schema; 31 | } 32 | 33 | _call( 34 | arg: z.output<typeof this.schema>, 35 | _runManager?: CallbackManagerForToolRun, 36 | _parentConfig?: RunnableConfig 37 | ): Promise<any> { 38 | return this.matonAPI.run(this.method, arg); 39 | } 40 | } 41 | 42 | export default MatonTool; 43 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/shopify.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createOrderParameters = z.object({ 12 | line_items: z 13 | .array( 14 | z.object({ 15 | title: z.string().describe('The title of the product'), 16 | price: z.number().describe('The price of the product'), 17 | quantity: z 18 | .number() 19 | .optional() 20 | .describe('The quantity of the product to add to the order'), 21 | }) 22 | ) 23 | .describe('List of dictionaries containing the following keys'), 24 | }); 25 | 26 | export const getOrderParameters = z.object({ 27 | order_id: z.string().describe('The ID of the order'), 28 | }); 29 | 30 | export const listOrdersParameters = z.object({ 31 | fulfillment_status: z 32 | .enum(['shipped', 'partial', 'unshipped']) 33 | .optional() 34 | .describe('The fulfillment status of the orders'), 35 | }); 36 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/google-calendar.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Google Calendar app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Google Calendar app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Google Calendar agent. 11 | `; 12 | 13 | export const createEventPrompt = ` 14 | This tool will create an event in a calendar in Google Calendar. 15 | `; 16 | 17 | export const deleteEventPrompt = ` 18 | This tool will delete an event in a calendar in Google Calendar. 19 | `; 20 | 21 | export const getCalendarPrompt = ` 22 | This tool will get a calendar in Google Calendar. 23 | `; 24 | 25 | export const getEventPrompt = ` 26 | This tool will get an event in a calendar in Google Calendar. 27 | `; 28 | 29 | export const listCalendarsPrompt = ` 30 | This tool will list calendars in Google Calendar. 31 | `; 32 | 33 | export const listEventsPrompt = ` 34 | This tool will list events in a calendar in Google Calendar. 35 | `; 36 | 37 | export const updateEventPrompt = ` 38 | This tool will update an event in a calendar in Google Calendar. 39 | `; 40 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/jira.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Jira app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Jira app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Jira agent. 11 | `; 12 | 13 | export const listCloudsPrompt = ` 14 | This tool will list all clouds in Jira. 15 | `; 16 | 17 | export const getIssuePrompt = ` 18 | This tool will get an issue from Jira. 19 | `; 20 | 21 | export const listIssuesPrompt = ` 22 | This tool will list issues in Jira. 23 | `; 24 | 25 | export const addCommentToIssuePrompt = ` 26 | This tool will add a comment to an issue in Jira. 27 | `; 28 | 29 | export const listCommentsPrompt = ` 30 | This tool will list all comments in an issue in Jira. 31 | `; 32 | 33 | export const updateCommentPrompt = ` 34 | This tool will update a comment in an issue in Jira. 35 | `; 36 | 37 | export const listProjectsPrompt = ` 38 | This tool will list all projects in Jira. 39 | `; 40 | 41 | export const getUserPrompt = ` 42 | This tool will get a user from Jira. 43 | `; 44 | 45 | export const listUsersPrompt = ` 46 | This tool will list all users in Jira. 47 | `; 48 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/klaviyo.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the klaviyo app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the klaviyo app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the klaviyo agent. 11 | `; 12 | 13 | export const addProfilesToListPrompt = ` 14 | Add profiles to a list. 15 | `; 16 | 17 | export const assignTemplateToCampaignMessagePrompt = ` 18 | Assign a template to a campaign message. 19 | `; 20 | 21 | export const createCampaignPrompt = ` 22 | Create a campaign. 23 | `; 24 | 25 | export const createListPrompt = ` 26 | Create a list. 27 | `; 28 | 29 | export const createProfilePrompt = ` 30 | Create a profile. 31 | `; 32 | 33 | export const createTemplatePrompt = ` 34 | Create a template. 35 | `; 36 | 37 | export const getCampaignMessagesPrompt = ` 38 | Get messages for campaign. 39 | `; 40 | 41 | export const getCampaignSendJobPrompt = ` 42 | Get send job for campaign. 43 | `; 44 | 45 | export const getCampaignsPrompt = ` 46 | Get campaigns. 47 | `; 48 | 49 | export const getListsPrompt = ` 50 | Get lists. 51 | `; 52 | 53 | export const getProfilesForListPrompt = ` 54 | Get profiles for list. 55 | `; 56 | 57 | export const getProfilesPrompt = ` 58 | Get profiles. 59 | `; 60 | 61 | export const getTemplatesPrompt = ` 62 | Get templates. 63 | `; 64 | 65 | export const sendCampaignPrompt = ` 66 | Send campaign. 67 | `; 68 | ``` -------------------------------------------------------------------------------- /typescript/src/modelcontextprotocol/toolkit.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js'; 2 | import {RequestHandlerExtra} from '@modelcontextprotocol/sdk/shared/protocol.js'; 3 | import { 4 | Configuration, 5 | checkConfiguration, 6 | isToolAllowed, 7 | } from '../shared/configuration'; 8 | import MatonAPI from '../shared/api'; 9 | import tools from '../shared/tools'; 10 | 11 | class MatonAgentToolkit extends McpServer { 12 | private _maton: MatonAPI; 13 | 14 | constructor(configuration: Configuration) { 15 | super({ 16 | name: 'Maton', 17 | version: '0.0.1', 18 | }); 19 | 20 | this._maton = new MatonAPI(configuration.apiKey); 21 | 22 | checkConfiguration(configuration); 23 | 24 | const filteredTools = tools.filter((tool) => 25 | isToolAllowed(tool, configuration) 26 | ); 27 | 28 | filteredTools.forEach((tool) => { 29 | this.tool( 30 | tool.method, 31 | tool.description, 32 | tool.parameters.shape, 33 | async (arg: any, _extra: RequestHandlerExtra) => { 34 | const result = await this._maton.run(tool.method, arg); 35 | return { 36 | content: [ 37 | { 38 | type: 'text' as const, 39 | text: String(result), 40 | }, 41 | ], 42 | }; 43 | } 44 | ); 45 | }); 46 | } 47 | } 48 | 49 | export default MatonAgentToolkit; 50 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/typeform.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const getFormParameters = z.object({ 12 | form_id: z.string().describe('The ID of the form'), 13 | }); 14 | 15 | export const listFormsParameters = z.object({ 16 | q: z.string().describe('The search query').optional(), 17 | page: z.number().describe('The page number').optional(), 18 | per_page: z.number().describe('The number of items per page').optional(), 19 | }); 20 | 21 | export const listResponsesParameters = z.object({ 22 | form_id: z.string().describe('The ID of the form'), 23 | sort: z 24 | .string() 25 | .describe( 26 | 'Responses order in {fieldID},{asc|desc} format. You can use built-in submitted_at/staged_at/landed_at field IDs or any field ID from your typeform, possible directions are asc/desc. Default value is submitted_at,desc for completed responses, staged_at,desc for partial responses and landed_at,desc for started responses.' 27 | ) 28 | .optional(), 29 | q: z.string().describe('The search query').optional(), 30 | per_page: z.number().describe('The number of items per page').optional(), 31 | }); 32 | ``` -------------------------------------------------------------------------------- /typescript/examples/openai/index.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {MatonAgentToolkit} from '@maton/agent-toolkit/openai'; 2 | import OpenAI from 'openai'; 3 | import type {ChatCompletionMessageParam} from 'openai/resources'; 4 | 5 | require('dotenv').config(); 6 | 7 | const openai = new OpenAI(); 8 | 9 | const matonAgentToolkit = new MatonAgentToolkit({ 10 | app: 'hubspot', 11 | actions: ['create-contact', 'list-contacts'], 12 | }); 13 | 14 | (async (): Promise<void> => { 15 | let messages: ChatCompletionMessageParam[] = [ 16 | { 17 | role: 'user', 18 | content: `create contact for [email protected] and list contacts`, 19 | }, 20 | ]; 21 | 22 | while (true) { 23 | // eslint-disable-next-line no-await-in-loop 24 | const completion = await openai.chat.completions.create({ 25 | model: 'gpt-4o-mini', 26 | messages, 27 | tools: matonAgentToolkit.getTools(), 28 | }); 29 | 30 | const message = completion.choices[0].message; 31 | 32 | messages.push(message); 33 | 34 | if (message.tool_calls) { 35 | console.log(JSON.stringify(message.tool_calls, null, 2)); 36 | // eslint-disable-next-line no-await-in-loop 37 | const toolMessages = await Promise.all( 38 | message.tool_calls.map((tc) => matonAgentToolkit.handleToolCall(tc)) 39 | ); 40 | messages = [...messages, ...toolMessages]; 41 | } else { 42 | console.log(completion.choices[0].message); 43 | break; 44 | } 45 | } 46 | })(); 47 | ``` -------------------------------------------------------------------------------- /typescript/examples/langchain/index.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {MatonAgentToolkit} from '@maton/agent-toolkit/langchain'; 2 | import {createReactAgent} from '@langchain/langgraph/prebuilt'; 3 | import {ChatOpenAI} from '@langchain/openai'; 4 | 5 | require('dotenv').config(); 6 | 7 | const llm = new ChatOpenAI({ 8 | model: 'o3-mini', 9 | }); 10 | 11 | const matonAgentToolkit = new MatonAgentToolkit({ 12 | app: 'hubspot', 13 | actions: ['create-contact', 'list-contacts'], 14 | }); 15 | 16 | const agent = createReactAgent({ 17 | llm, 18 | tools: matonAgentToolkit.getTools(), 19 | }); 20 | 21 | (async (): Promise<void> => { 22 | const stream = await agent.stream({ 23 | messages: [ 24 | ['human', 'create contact for [email protected] and list hubspot contacts'], 25 | ], 26 | }); 27 | 28 | for await (const chunk of stream) { 29 | if (chunk.agent) { 30 | console.log( 31 | `================================= AI Message =================================` 32 | ); 33 | const message = chunk.agent.messages[0]; 34 | if (message.tool_calls && message.tool_calls.length > 0) { 35 | console.log(JSON.stringify(message.tool_calls, undefined, 2)); 36 | } else { 37 | console.log(message.content); 38 | } 39 | } else if (chunk.tools) { 40 | console.log( 41 | `================================= Tool Message =================================` 42 | ); 43 | console.log(chunk.tools.messages[0].content); 44 | } 45 | } 46 | })(); 47 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/asana.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createTaskParameters = z.object({ 12 | project_id: z.string().describe('The project ID'), 13 | name: z.string().describe('Name of the task'), 14 | assignee: z.string().describe('The email of the user').optional(), 15 | completed: z 16 | .boolean() 17 | .describe('True if the task is currently marked complete, false if not') 18 | .optional(), 19 | due_at: z 20 | .string() 21 | .describe( 22 | 'The UTC date and time on which this task is due, or null if the task has no due time. This takes an ISO 8601 date string in UTC and should not be used together with due_on.' 23 | ) 24 | .optional(), 25 | notes: z 26 | .string() 27 | .describe('Free-form textual information associated with the task'), 28 | }); 29 | 30 | export const getTaskParameters = z.object({ 31 | task_id: z.string().describe('The task ID'), 32 | }); 33 | 34 | export const listProjectsParameters = z.object({ 35 | workspace_id: z.string().describe('The workspace ID'), 36 | }); 37 | 38 | export const listTasksParameters = z.object({ 39 | project_id: z.string().describe('The project ID'), 40 | }); 41 | 42 | export const listWorkspacesParameters = z.object({}); 43 | ``` -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- ```yaml 1 | name: Release 2 | 3 | on: 4 | workflow_dispatch: {} 5 | 6 | jobs: 7 | python-build: 8 | name: Build for PyPi 9 | runs-on: ubuntu-latest 10 | environment: pypi 11 | 12 | defaults: 13 | run: 14 | working-directory: ./python 15 | 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | 20 | - name: Python 21 | uses: actions/setup-python@v4 22 | with: 23 | python-version: "3.11" 24 | 25 | - name: Install 26 | run: make venv 27 | 28 | - name: Build 29 | run: | 30 | set -x 31 | source venv/bin/activate 32 | rm -rf build dist *.egg-info 33 | make build 34 | python -m twine check dist/* 35 | 36 | - name: Test 37 | run: | 38 | make venv 39 | make test 40 | 41 | - name: Upload artifact 42 | uses: actions/upload-artifact@v4 43 | with: 44 | name: release-dists 45 | path: ./python/dist/ 46 | 47 | python-release: 48 | name: Publish to PyPi 49 | runs-on: ubuntu-latest 50 | environment: pypi 51 | needs: 52 | - python-build 53 | 54 | defaults: 55 | run: 56 | working-directory: ./python 57 | 58 | permissions: 59 | id-token: write 60 | 61 | steps: 62 | - name: Retrieve distribution 63 | uses: actions/download-artifact@v4 64 | with: 65 | name: release-dists 66 | path: dist/ 67 | 68 | - name: Publish package distributions to PyPI 69 | uses: pypa/gh-action-pypi-publish@release/v1 70 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/clickup.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createTaskParameters = z.object({ 12 | list_id: z.string().describe('The ID of the list'), 13 | name: z.string().describe('Name of the task'), 14 | description: z.string().describe('Description of the task'), 15 | priority: z 16 | .enum(['Low', 'Medium', 'High', 'Urgent']) 17 | .describe('Priority of the task'), 18 | assignees: z.array(z.string()).describe('List of assignees'), 19 | due_date: z.string().describe('Due date of the task').optional(), 20 | }); 21 | 22 | export const deleteTaskParameters = z.object({ 23 | task_id: z.string().describe('The ID of the task'), 24 | }); 25 | 26 | export const getTaskParameters = z.object({ 27 | task_id: z.string().describe('The ID of the task'), 28 | }); 29 | 30 | export const listFoldersParameters = z.object({ 31 | space_id: z.string().describe('The ID of the space'), 32 | }); 33 | 34 | export const listListsParameters = z.object({ 35 | folder_id: z.string().describe('The ID of the folder'), 36 | }); 37 | 38 | export const listSpacesParameters = z.object({ 39 | workspace_id: z.string().describe('The ID of the workspace'), 40 | }); 41 | 42 | export const listTasksParameters = z.object({ 43 | list_id: z.string().describe('The ID of the list'), 44 | }); 45 | 46 | export const listWorkspacesParameters = z.object({}); 47 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/google-drive.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createFileParameters = z.object({ 12 | content: z.string().describe('The text content of the file to create'), 13 | mime_type: z.string().describe('The MIME type of the file to create'), 14 | name: z.string().optional().describe('The name of the file to create'), 15 | parent_id: z 16 | .string() 17 | .optional() 18 | .describe('The ID of the parent folder to create the file in'), 19 | }); 20 | 21 | export const createFolderParameters = z.object({ 22 | parent_id: z 23 | .string() 24 | .describe('The ID of the parent folder to create the folder in'), 25 | }); 26 | 27 | export const deleteFileParameters = z.object({ 28 | file_id: z.string().describe('The ID of the file to delete'), 29 | }); 30 | 31 | export const findFileParameters = z.object({ 32 | q: z.string().describe('The search query'), 33 | }); 34 | 35 | export const findFolderParameters = z.object({ 36 | q: z.string().describe('The search query'), 37 | include_trashed: z 38 | .boolean() 39 | .optional() 40 | .describe('Whether to include trashed folders'), 41 | }); 42 | 43 | export const getFileParameters = z.object({ 44 | file_id: z.string().describe('The ID of the file to retrieve'), 45 | }); 46 | 47 | export const listFilesParameters = z.object({ 48 | folder_id: z.string().optional().describe('The ID of folder'), 49 | }); 50 | ``` -------------------------------------------------------------------------------- /modelcontextprotocol/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "@maton/mcp", 3 | "version": "0.0.10", 4 | "homepage": "https://github.com/maton-ai/agent-toolkit/tree/main/modelcontextprotocol", 5 | "description": "A command line tool for setting up Maton MCP server", 6 | "bin": "dist/index.js", 7 | "files": [ 8 | "dist/index.js", 9 | "LICENSE", 10 | "README.md", 11 | "VERSION", 12 | "package.json" 13 | ], 14 | "scripts": { 15 | "build": "tsc && node -e \"require('fs').chmodSync('dist/index.js', '755')\"", 16 | "clean": "rm -rf dist", 17 | "lint": "eslint \"./**/*.ts*\"", 18 | "prettier": "prettier './**/*.{js,ts,md,html,css}' --write", 19 | "prettier-check": "prettier './**/*.{js,ts,md,html,css}' --check" 20 | }, 21 | "packageManager": "[email protected]", 22 | "engines": { 23 | "node": ">=18" 24 | }, 25 | "dependencies": { 26 | "@modelcontextprotocol/sdk": "^1.4.1", 27 | "@maton/agent-toolkit": "latest", 28 | "colors": "^1.4.0" 29 | }, 30 | "keywords": [ 31 | "mcp", 32 | "modelcontextprotocol", 33 | "maton" 34 | ], 35 | "author": "Maton <[email protected]> (https://maton.ai)", 36 | "license": "MIT", 37 | "devDependencies": { 38 | "@eslint/compat": "^1.2.6", 39 | "@types/jest": "^29.5.14", 40 | "@types/node": "^22.13.4", 41 | "@typescript-eslint/eslint-plugin": "^8.24.1", 42 | "eslint-config-prettier": "^10.0.1", 43 | "eslint-plugin-import": "^2.31.0", 44 | "eslint-plugin-jest": "^28.11.0", 45 | "eslint-plugin-prettier": "^5.2.3", 46 | "globals": "^15.15.0", 47 | "jest": "^29.7.0", 48 | "prettier": "^3.5.1", 49 | "ts-jest": "^29.2.5", 50 | "ts-node": "^10.9.2" 51 | } 52 | } 53 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/outlook.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createDraftParameters = z.object({ 12 | to: z.array(z.string()).describe('List of recipient emails'), 13 | subject: z.string().describe('The subject of the email'), 14 | body: z.string().describe('The body of the email'), 15 | cc: z.array(z.string()).describe('List of emails to CC').optional(), 16 | bcc: z.array(z.string()).describe('List of emails to BCC').optional(), 17 | body_type: z 18 | .enum(['plaintext', 'html']) 19 | .describe( 20 | 'The type of the email body. Default: plaintext. Possible values are: plaintext, html' 21 | ) 22 | .optional(), 23 | }); 24 | 25 | export const findEmailParameters = z.object({ 26 | q: z.string().describe('The search query'), 27 | max_results: z 28 | .number() 29 | .describe('The maximum number of results to return. Default is 10.') 30 | .optional(), 31 | }); 32 | 33 | export const sendEmailParameters = z.object({ 34 | to: z.array(z.string()).describe('List of recipient emails'), 35 | subject: z.string().describe('The subject of the email'), 36 | body: z.string().describe('The body of the email'), 37 | cc: z.array(z.string()).describe('List of emails to CC').optional(), 38 | bcc: z.array(z.string()).describe('List of emails to BCC').optional(), 39 | body_type: z 40 | .enum(['plaintext', 'html']) 41 | .describe( 42 | 'The type of the email body. Default: plaintext. Possible values are: plaintext, html' 43 | ) 44 | .optional(), 45 | }); 46 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/jira.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const listCloudsParameters = z.object({}); 12 | 13 | export const getIssueParameters = z.object({ 14 | cloud_id: z.string().describe('The ID of the cloud'), 15 | issue_id: z.string().describe('The ID of the issue'), 16 | }); 17 | 18 | export const listIssuesParameters = z.object({ 19 | cloud_id: z.string().describe('The ID of the cloud'), 20 | }); 21 | 22 | export const addCommentToIssueParameters = z.object({ 23 | cloud_id: z.string().describe('The ID of the cloud'), 24 | issue_id: z.string().describe('The ID of the issue'), 25 | comment: z.string().describe('The comment to add to the issue'), 26 | }); 27 | 28 | export const listCommentsParameters = z.object({ 29 | cloud_id: z.string().describe('The ID of the cloud'), 30 | issue_id: z.string().describe('The ID of the issue'), 31 | }); 32 | 33 | export const updateCommentParameters = z.object({ 34 | cloud_id: z.string().describe('The ID of the cloud'), 35 | issue_id: z.string().describe('The ID of the issue'), 36 | comment_id: z.string().describe('The ID of the comment'), 37 | comment: z.string().describe('The new comment'), 38 | }); 39 | 40 | export const listProjectsParameters = z.object({ 41 | cloud_id: z.string().describe('The ID of the cloud'), 42 | }); 43 | 44 | export const getUserParameters = z.object({ 45 | account_id: z.string().describe('The ID of the user account'), 46 | }); 47 | 48 | export const listUsersParameters = z.object({ 49 | cloud_id: z.string().describe('The ID of the cloud'), 50 | }); 51 | ``` -------------------------------------------------------------------------------- /typescript/src/openai/toolkit.ts: -------------------------------------------------------------------------------- ```typescript 1 | import MatonAPI from '../shared/api'; 2 | import tools from '../shared/tools'; 3 | import {isToolAllowed, type Configuration} from '../shared/configuration'; 4 | import {zodToJsonSchema} from 'zod-to-json-schema'; 5 | import type { 6 | ChatCompletionTool, 7 | ChatCompletionMessageToolCall, 8 | ChatCompletionToolMessageParam, 9 | } from 'openai/resources'; 10 | 11 | class MatonAgentToolkit { 12 | private _maton: MatonAPI; 13 | 14 | tools: ChatCompletionTool[]; 15 | 16 | constructor(configuration: Configuration) { 17 | this._maton = new MatonAPI(configuration.apiKey); 18 | 19 | const filteredTools = tools.filter((tool) => 20 | isToolAllowed(tool, configuration) 21 | ); 22 | 23 | this.tools = filteredTools.map((tool) => ({ 24 | type: 'function', 25 | function: { 26 | name: tool.method, 27 | description: tool.description, 28 | parameters: zodToJsonSchema(tool.parameters), 29 | }, 30 | })); 31 | } 32 | 33 | getTools(): ChatCompletionTool[] { 34 | return this.tools; 35 | } 36 | 37 | /** 38 | * Processes a single OpenAI tool call by executing the requested function. 39 | * 40 | * @param {ChatCompletionMessageToolCall} toolCall - The tool call object from OpenAI containing 41 | * function name, arguments, and ID. 42 | * @returns {Promise<ChatCompletionToolMessageParam>} A promise that resolves to a tool message 43 | * object containing the result of the tool execution with the proper format for the OpenAI API. 44 | */ 45 | async handleToolCall(toolCall: ChatCompletionMessageToolCall) { 46 | const args = JSON.parse(toolCall.function.arguments); 47 | const response = await this._maton.run(toolCall.function.name, args); 48 | return { 49 | role: 'tool', 50 | tool_call_id: toolCall.id, 51 | content: response, 52 | } as ChatCompletionToolMessageParam; 53 | } 54 | } 55 | 56 | export default MatonAgentToolkit; 57 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/google-sheet.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the Google Sheets app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the Google Sheets app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the Google Sheets agent. 11 | `; 12 | 13 | export const addColumnPrompt = ` 14 | This tool will add a column to a Google spreadsheet. 15 | `; 16 | 17 | export const addMultipleRowsPrompt = ` 18 | This tool will add multiple rows to a Google spreadsheet. 19 | `; 20 | 21 | export const clearCellPrompt = ` 22 | This tool will clear a cell in a Google spreadsheet. 23 | `; 24 | 25 | export const clearRowsPrompt = ` 26 | This tool will clear multiple rows in a Google spreadsheet. 27 | `; 28 | 29 | export const createSpreadsheetPrompt = ` 30 | This tool will create a Google spreadsheet. 31 | `; 32 | 33 | export const createWorksheetPrompt = ` 34 | This tool will create a worksheet in a Google spreadsheet. 35 | `; 36 | 37 | export const deleteRowsPrompt = ` 38 | This tool will delete multiple rows in a Google spreadsheet. 39 | `; 40 | 41 | export const deleteWorksheetPrompt = ` 42 | This tool will delete a worksheet in a Google spreadsheet. 43 | `; 44 | 45 | export const findRowPrompt = ` 46 | This tool will find one or more rows by a column and value. 47 | `; 48 | 49 | export const getCellPrompt = ` 50 | This tool will get a cell from a Google spreadsheet. 51 | `; 52 | 53 | export const getSpreadsheetPrompt = ` 54 | This tool will get a Google spreadsheet. 55 | `; 56 | 57 | export const getValuesInRangePrompt = ` 58 | This tool will get values in a range in a Google spreadsheet. 59 | `; 60 | 61 | export const listWorksheetsPrompt = ` 62 | This tool will list worksheets in a Google spreadsheet. 63 | `; 64 | 65 | export const updateCellPrompt = ` 66 | This tool will update a cell in a Google spreadsheet. 67 | `; 68 | 69 | export const updateMultipleRowsPrompt = ` 70 | This tool will update multiple rows in a Google spreadsheet. 71 | `; 72 | 73 | export const updateRowPrompt = ` 74 | This tool will update a row in a Google spreadsheet. 75 | `; 76 | ``` -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- ```yaml 1 | name: CI 2 | 3 | on: 4 | workflow_dispatch: {} 5 | push: 6 | branches: 7 | - main 8 | pull_request: 9 | branches: 10 | - main 11 | 12 | jobs: 13 | typescript-build: 14 | name: Build - TypeScript 15 | runs-on: ubuntu-latest 16 | 17 | defaults: 18 | run: 19 | working-directory: ./typescript 20 | 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v3 24 | 25 | - name: pnpm 26 | uses: pnpm/action-setup@v4 27 | with: 28 | version: 9.11.0 29 | 30 | - name: Node 31 | uses: actions/setup-node@v4 32 | with: 33 | node-version: "18" 34 | 35 | - name: Install 36 | run: pnpm install --frozen-lockfile 37 | 38 | - name: Build 39 | run: pnpm run build 40 | 41 | - name: Clean 42 | run: pnpm run clean 43 | 44 | - name: Lint 45 | run: pnpm run lint 46 | 47 | - name: Prettier 48 | run: pnpm run prettier-check 49 | 50 | modelcontextprotocol-build: 51 | name: Build - Model Context Protocol 52 | runs-on: ubuntu-latest 53 | 54 | defaults: 55 | run: 56 | working-directory: ./modelcontextprotocol 57 | 58 | steps: 59 | - name: Checkout 60 | uses: actions/checkout@v3 61 | 62 | - name: pnpm 63 | uses: pnpm/action-setup@v4 64 | with: 65 | version: 9.11.0 66 | 67 | - name: Node 68 | uses: actions/setup-node@v4 69 | with: 70 | node-version: "18" 71 | 72 | - name: Install 73 | run: pnpm install --frozen-lockfile 74 | 75 | - name: Build 76 | run: pnpm run build 77 | 78 | - name: Clean 79 | run: pnpm run clean 80 | 81 | - name: Lint 82 | run: pnpm run lint 83 | 84 | - name: Prettier 85 | run: pnpm run prettier-check 86 | 87 | python-build: 88 | name: Build - Python 89 | runs-on: ubuntu-latest 90 | 91 | defaults: 92 | run: 93 | working-directory: ./python 94 | 95 | steps: 96 | - name: Checkout 97 | uses: actions/checkout@v3 98 | 99 | - name: Python 100 | uses: actions/setup-python@v4 101 | with: 102 | python-version: "3.11" 103 | 104 | - name: Install 105 | run: make venv 106 | 107 | - name: Build 108 | run: | 109 | set -x 110 | source venv/bin/activate 111 | rm -rf build dist *.egg-info 112 | make build 113 | python -m twine check dist/* 114 | 115 | - name: Test 116 | run: | 117 | make venv 118 | make test 119 | ``` -------------------------------------------------------------------------------- /modelcontextprotocol/src/index.ts: -------------------------------------------------------------------------------- ```typescript 1 | #!/usr/bin/env node 2 | 3 | import {MatonAgentToolkit} from '@maton/agent-toolkit/modelcontextprotocol'; 4 | import {StdioServerTransport} from '@modelcontextprotocol/sdk/server/stdio.js'; 5 | import {green, red, yellow} from 'colors'; 6 | 7 | type Options = { 8 | app?: string; 9 | agent?: boolean; 10 | actions?: string[]; 11 | apiKey?: string; 12 | }; 13 | 14 | const ACCEPTED_ARGS: string[] = ['agent', 'actions', 'api-key']; 15 | 16 | export function parseArgs(args: string[]): Options { 17 | const options: Options = {app: args[0]}; 18 | 19 | args.slice(1).forEach((arg) => { 20 | if (arg.startsWith('--')) { 21 | const [key, value] = arg.slice(2).split('='); 22 | 23 | if (key == 'agent') { 24 | options.agent = true; 25 | } else if (key == 'actions') { 26 | options.actions = value.split(','); 27 | } else if (key == 'api-key') { 28 | options.apiKey = value; 29 | } else { 30 | throw new Error( 31 | `Invalid argument: ${key}. Accepted arguments are: ${ACCEPTED_ARGS.join( 32 | ', ' 33 | )}` 34 | ); 35 | } 36 | } 37 | }); 38 | 39 | // Check if API key is either provided in args or set in environment variables 40 | const apiKey = options.apiKey || process.env.MATON_API_KEY; 41 | if (!apiKey) { 42 | throw new Error( 43 | 'Maton API key not provided. Please either pass it as an argument --api-key=$KEY or set the MATON_API_KEY environment variable.' 44 | ); 45 | } 46 | options.apiKey = apiKey; 47 | 48 | return options; 49 | } 50 | 51 | function handleError(error: any) { 52 | console.error(red('\n🚨 Error initializing Maton MCP server:\n')); 53 | console.error(yellow(` ${error.message}\n`)); 54 | } 55 | 56 | export async function main() { 57 | const options = parseArgs(process.argv.slice(2)); 58 | 59 | const server = new MatonAgentToolkit({ 60 | apiKey: options.apiKey, 61 | app: options.app, 62 | agent: options.agent, 63 | actions: options.actions, 64 | }); 65 | 66 | const transport = new StdioServerTransport(); 67 | await server.connect(transport); 68 | // We use console.error instead of console.log since console.log will output to stdio, which will confuse the MCP server 69 | console.error(green('✅ Maton MCP Server running on stdio')); 70 | } 71 | 72 | if (require.main === module) { 73 | main().catch((error) => { 74 | handleError(error); 75 | }); 76 | } 77 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/youtube.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const listVideosParameters = z.object({ 12 | part: z 13 | .array( 14 | z.enum([ 15 | 'auditDetails', 16 | 'brandingSettings', 17 | 'contentDetails', 18 | 'contentOwnerDetails', 19 | 'id', 20 | 'localizations', 21 | 'snippet', 22 | 'statistics', 23 | 'status', 24 | 'topicDetails', 25 | ]) 26 | ) 27 | .describe( 28 | 'The part parameter specifies a comma-separated list of one or more resource properties that the API response will include. Possible values are: auditDetails, brandingSettings, contentDetails, contentOwnerDetails, id, localizations, snippet, statistics, status, topicDetails' 29 | ), 30 | use_case: z 31 | .enum(['id', 'myRating', 'chart']) 32 | .describe( 33 | 'The useCase parameter specifies the type of resource to be returned. Possible values are: id, myRating, chart' 34 | ), 35 | video_ids: z 36 | .array(z.enum(['id', 'myRating', 'chart'])) 37 | .optional() 38 | .describe( 39 | 'The id parameter specifies a comma-separated list of the YouTube video ID(s) for the resource(s) that are being retrieved.' 40 | ), 41 | my_rating: z 42 | .enum(['like', 'dislike']) 43 | .optional() 44 | .describe( 45 | 'The myRating parameter specifies the rating of the authenticated user. Possible values are: like, dislike' 46 | ), 47 | region_code: z 48 | .string() 49 | .optional() 50 | .describe( 51 | 'The regionCode parameter instructs the API to return results for the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. For example: US, GB, BR' 52 | ), 53 | max_results: z 54 | .number() 55 | .optional() 56 | .describe( 57 | 'The maxResults parameter specifies the maximum number of items that should be returned in the result set. Default: 20.' 58 | ), 59 | }); 60 | 61 | export const searchVideosParameters = z.object({ 62 | q: z.string().describe('The search query'), 63 | max_results: z 64 | .number() 65 | .optional() 66 | .describe('The maximum number of results to return. Default: 20.'), 67 | }); 68 | ``` -------------------------------------------------------------------------------- /typescript/package.json: -------------------------------------------------------------------------------- ```json 1 | { 2 | "name": "@maton/agent-toolkit", 3 | "version": "0.0.10", 4 | "homepage": "https://github.com/maton-ai/agent-toolkit", 5 | "scripts": { 6 | "build": "tsup", 7 | "clean": "rm -rf langchain ai-sdk modelcontextprotocol openai", 8 | "lint": "eslint \"./**/*.ts*\"", 9 | "prettier": "prettier './**/*.{js,ts,md,html,css}' --write", 10 | "prettier-check": "prettier './**/*.{js,ts,md,html,css}' --check" 11 | }, 12 | "exports": { 13 | "./langchain": { 14 | "types": "./langchain/index.d.ts", 15 | "require": "./langchain/index.js", 16 | "import": "./langchain/index.mjs" 17 | }, 18 | "./ai-sdk": { 19 | "types": "./ai-sdk/index.d.ts", 20 | "require": "./ai-sdk/index.js", 21 | "import": "./ai-sdk/index.mjs" 22 | }, 23 | "./openai": { 24 | "types": "./openai/index.d.ts", 25 | "require": "./openai/index.js", 26 | "import": "./openai/index.mjs" 27 | }, 28 | "./modelcontextprotocol": { 29 | "types": "./modelcontextprotocol/index.d.ts", 30 | "require": "./modelcontextprotocol/index.js", 31 | "import": "./modelcontextprotocol/index.mjs" 32 | } 33 | }, 34 | "packageManager": "[email protected]", 35 | "engines": { 36 | "node": ">=18" 37 | }, 38 | "author": "Maton <[email protected]> (https://maton.ai/)", 39 | "contributors": [ 40 | "Richard Song <[email protected]>", 41 | "Byungkyu Park <[email protected]>" 42 | ], 43 | "license": "MIT", 44 | "devDependencies": { 45 | "@eslint/compat": "^1.2.4", 46 | "@types/jest": "^29.5.14", 47 | "@types/node": "^22.10.5", 48 | "@typescript-eslint/eslint-plugin": "^8.19.1", 49 | "eslint": "^9.17.0", 50 | "eslint-config-prettier": "^9.1.0", 51 | "eslint-plugin-import": "^2.31.0", 52 | "eslint-plugin-jest": "^28.10.0", 53 | "eslint-plugin-prettier": "^5.2.1", 54 | "globals": "^15.14.0", 55 | "jest": "^29.7.0", 56 | "prettier": "^3.4.2", 57 | "ts-jest": "^29.2.5", 58 | "ts-node": "^10.9.2", 59 | "tsup": "^8.3.5", 60 | "typescript": "^5.7.2" 61 | }, 62 | "dependencies": { 63 | "zod": "^3.24.1", 64 | "zod-to-json-schema": "^3.24.3" 65 | }, 66 | "peerDependencies": { 67 | "openai": "^4.86.1", 68 | "@langchain/core": "^0.3.6", 69 | "@modelcontextprotocol/sdk": "^1.4.1", 70 | "ai": "^3.4.7 || ^4.0.0" 71 | }, 72 | "workspaces": [ 73 | ".", 74 | "examples/*" 75 | ], 76 | "files": [ 77 | "ai-sdk/**/*", 78 | "langchain/**/*", 79 | "modelcontextprotocol/**/*", 80 | "openai/**/*", 81 | "LICENSE", 82 | "README.md", 83 | "VERSION", 84 | "package.json" 85 | ] 86 | } 87 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/prompts/hubspot.ts: -------------------------------------------------------------------------------- ```typescript 1 | export const checkConnectionPrompt = ` 2 | Check if there is any active connection to the salesforce app. 3 | `; 4 | 5 | export const startConnectionPrompt = ` 6 | Start a connection to the salesforce app. Active connections are required to perform actions with the app. 7 | `; 8 | 9 | export const transferAgentPrompt = ` 10 | Transfer to the HubSpot agent. 11 | `; 12 | 13 | export const createContactPrompt = ` 14 | Create a contact. Object properties should include at least one of the following properties: email, firstname, or lastname. It is recommended to always include email, because email address is the primary unique identifier to avoid duplicate contacts in HubSpot. 15 | `; 16 | 17 | export const getContactPrompt = ` 18 | Get a contact. 19 | `; 20 | 21 | export const listContactsPrompt = ` 22 | List all contacts, using query parameters to control the information that gets returned. 23 | `; 24 | 25 | export const searchContactsPrompt = ` 26 | Search for contacts by filtering on properties, searching through associations, and sorting results. To apply OR logic for filters, include multiple filters within a filter group. To apply AND logic for filters, include a list of conditions within one set of filters. 27 | `; 28 | 29 | export const mergeContactsPrompt = ` 30 | Merge two contacts. 31 | `; 32 | 33 | export const updateContactPrompt = ` 34 | Update a contact. Provided property values will be overwritten. Properties values can be cleared by passing an empty string. 35 | `; 36 | 37 | export const deleteContactPrompt = ` 38 | Delete a contact. 39 | `; 40 | 41 | export const createDealPrompt = ` 42 | Create a deal. Object properties should include the following properties: dealname, dealstage, and if you have multiple pipelines, pipeline. If a pipeline isn't specified, the default pipeline will be used. 43 | `; 44 | 45 | export const getDealPrompt = ` 46 | Get a deal. 47 | `; 48 | 49 | export const listDealsPrompt = ` 50 | List all deals, using query parameters to control the information that gets returned. 51 | `; 52 | 53 | export const searchDealsPrompt = ` 54 | Search for deals by filtering on properties, searching through associations, and sorting results. To apply OR logic for filters, include multiple filters within a filter group. To apply AND logic for filters, include a list of conditions within one set of filters. 55 | `; 56 | 57 | export const mergeDealPrompt = ` 58 | Merge two deals. 59 | `; 60 | 61 | export const updateDealPrompt = ` 62 | Update a deal. Provided property values will be overwritten. Properties values can be cleared by passing an empty string. 63 | `; 64 | 65 | export const deleteDealPrompt = ` 66 | Delete a deal. 67 | `; 68 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/google-mail.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const addLabelToEmailParameters = z.object({ 12 | message_id: z.string().describe('The ID of the message'), 13 | label_ids: z 14 | .array(z.string()) 15 | .describe('List of label IDs to add to the message'), 16 | }); 17 | 18 | export const createDraftParameters = z.object({ 19 | to: z.array(z.string()).describe('List of recipient emails'), 20 | subject: z.string().describe('The subject of the email'), 21 | body: z.string().describe('The body of the email'), 22 | cc: z.array(z.string()).describe('List of emails to CC').optional(), 23 | bcc: z.array(z.string()).describe('List of emails to BCC').optional(), 24 | body_type: z 25 | .enum(['plaintext', 'html']) 26 | .describe( 27 | 'The type of the email body. Default: plaintext. Possible values are: plaintext, html' 28 | ) 29 | .optional(), 30 | }); 31 | 32 | export const findEmailParameters = z.object({ 33 | q: z.string().describe('The search query'), 34 | label_ids: z 35 | .array(z.string()) 36 | .describe( 37 | 'List of label IDs. Only messages that match all of the specified labels are returned.' 38 | ) 39 | .optional(), 40 | include_spam_trash: z 41 | .boolean() 42 | .describe( 43 | 'Whether to include messages from `SPAM` and `TRASH` in the results. Default: False.' 44 | ) 45 | .optional(), 46 | max_results: z 47 | .number() 48 | .describe('The maximum number of results to return. Default: 10. Max: 500.') 49 | .optional(), 50 | }); 51 | 52 | export const listLabelsParameters = z.object({}); 53 | 54 | export const removeLabelFromEmailParameters = z.object({ 55 | message_id: z.string().describe('The ID of the message'), 56 | label_ids: z 57 | .array(z.string()) 58 | .describe('List of label IDs to remove from the message'), 59 | }); 60 | 61 | export const sendEmailParameters = z.object({ 62 | to: z.array(z.string()).describe('List of recipient emails'), 63 | subject: z.string().describe('The subject of the email'), 64 | body: z.string().describe('The body of the email'), 65 | cc: z.array(z.string()).describe('List of emails to CC').optional(), 66 | bcc: z.array(z.string()).describe('List of emails to BCC').optional(), 67 | body_type: z 68 | .enum(['plaintext', 'html']) 69 | .describe( 70 | 'The type of the email body. Default: plaintext. Possible values are: plaintext, html' 71 | ) 72 | .optional(), 73 | }); 74 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/stripe.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createCustomerParameters = z.object({ 12 | name: z.string().describe('The name of the customer'), 13 | email: z.string().describe('The email address of the customer'), 14 | phone: z.string().describe('The phone number of the customer'), 15 | description: z.string().describe('The description of the customer'), 16 | address1: z.string().describe('The first line of the address'), 17 | address2: z.string().describe('The second line of the address'), 18 | city: z.string().describe('The city of the address'), 19 | state: z.string().describe('The state of the address'), 20 | postal_code: z.string().describe('The postal code of the address'), 21 | country: z.string().describe('The country of the address'), 22 | }); 23 | 24 | export const createInvoiceItemParameters = z.object({ 25 | customer_id: z.string().describe('The ID of the customer'), 26 | invoice_id: z.string().describe('The ID of the invoice'), 27 | subscription_id: z.string().describe('The ID of the subscription'), 28 | price_id: z.string().describe('The ID of the price'), 29 | quantity: z.number().describe('The quantity of the invoice item'), 30 | amount: z.number().describe('The amount of the invoice item'), 31 | description: z.string().describe('The description of the invoice item'), 32 | currency: z.string().describe('The currency of the invoice item'), 33 | }); 34 | 35 | export const createInvoiceParameters = z.object({ 36 | customer_id: z.string().describe('The ID of the customer'), 37 | subscription_id: z.string().describe('The ID of the subscription'), 38 | description: z.string().describe('The description of the invoice'), 39 | collection_method: z 40 | .enum(['charge_automatically', 'send_invoice']) 41 | .describe('The collection method of the invoice'), 42 | days_until_due: z 43 | .number() 44 | .describe('The number of days until the invoice is due'), 45 | }); 46 | 47 | export const deleteCustomerParameters = z.object({ 48 | customer_id: z.string().describe('The ID of the customer'), 49 | }); 50 | 51 | export const getCustomerParameters = z.object({ 52 | customer_id: z.string().describe('The ID of the customer'), 53 | }); 54 | 55 | export const getInvoiceParameters = z.object({ 56 | invoice_id: z.string().describe('The ID of the invoice'), 57 | }); 58 | 59 | export const listCustomersParameters = z.object({ 60 | email: z.string().describe('The email address of the customer').optional(), 61 | limit: z.number().describe('The number of results to return').optional(), 62 | }); 63 | 64 | export const listInvoicesParameters = z.object({ 65 | email: z.string().describe('The email address of the customer').optional(), 66 | limit: z.number().describe('The number of results to return').optional(), 67 | }); 68 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/api.ts: -------------------------------------------------------------------------------- ```typescript 1 | class MatonClient { 2 | private headers: {'x-api-key': string}; 3 | 4 | constructor(apiKey: string) { 5 | this.headers = {'x-api-key': apiKey}; 6 | } 7 | 8 | async createConnection(app: string): Promise<any> { 9 | const body = {app}; 10 | const response = await fetch('https://api.maton.ai/create-connection', { 11 | method: 'POST', 12 | headers: this.headers, 13 | body: JSON.stringify(body), 14 | }); 15 | return response.json(); 16 | } 17 | 18 | async getConnection(connectionId: string): Promise<any> { 19 | const body = {connection_id: connectionId}; 20 | const response = await fetch('https://api.maton.ai/get-connection', { 21 | method: 'POST', 22 | headers: this.headers, 23 | body: JSON.stringify(body), 24 | }); 25 | return response.json(); 26 | } 27 | 28 | async listConnections(app?: string, status?: string): Promise<any> { 29 | const body = {app, status}; 30 | const response = await fetch('https://api.maton.ai/list-connections', { 31 | method: 'POST', 32 | headers: this.headers, 33 | body: JSON.stringify(body), 34 | }); 35 | return response.json(); 36 | } 37 | 38 | async deleteConnection(connectionId: string): Promise<any> { 39 | const body = {connection_id: connectionId}; 40 | const response = await fetch('https://api.maton.ai/delete-connection', { 41 | method: 'POST', 42 | headers: this.headers, 43 | body: JSON.stringify(body), 44 | }); 45 | return response.json(); 46 | } 47 | 48 | async invokeAction( 49 | app: string, 50 | action: string, 51 | args: {[key: string]: any} 52 | ): Promise<any> { 53 | const body = { 54 | app: app, 55 | action: action, 56 | args: args, 57 | }; 58 | const response = await fetch('https://api.maton.ai/invoke-action', { 59 | method: 'POST', 60 | headers: this.headers, 61 | body: JSON.stringify(body), 62 | }); 63 | 64 | return response.json(); 65 | } 66 | 67 | async invokeAgent(app: string, userPrompt: string): Promise<any> { 68 | const body = { 69 | app: app, 70 | user_prompt: userPrompt, 71 | }; 72 | const response = await fetch('https://api.maton.ai/invoke-agent', { 73 | method: 'POST', 74 | headers: this.headers, 75 | body: JSON.stringify(body), 76 | }); 77 | 78 | return response.json(); 79 | } 80 | } 81 | 82 | class MatonAPI { 83 | maton: MatonClient; 84 | 85 | constructor(apiKey?: string) { 86 | const envApiKey = process.env.MATON_API_KEY ?? ''; 87 | if (!apiKey && !envApiKey) { 88 | throw new Error( 89 | 'Did not find MATON_API_KEY, please add an environment variable or pass it as a parameter' 90 | ); 91 | } 92 | this.maton = new MatonClient(apiKey || envApiKey); 93 | } 94 | 95 | async run(method: string, arg: any) { 96 | const [app, ...rest] = method.split('_'); 97 | const action = rest.join('-'); 98 | 99 | let output = {}; 100 | if (method.endsWith('check_connection')) { 101 | const listConnectionsResp = await this.maton.listConnections( 102 | app, 103 | 'ACTIVE' 104 | ); 105 | const connections = listConnectionsResp.connections; 106 | return connections && connections.length > 0; 107 | } else if (method.endsWith('start_connection')) { 108 | const createConnectionResp = await this.maton.createConnection(app); 109 | const getConnectionResp = await this.maton.getConnection( 110 | createConnectionResp.connection_id 111 | ); 112 | const connection = getConnectionResp.connection; 113 | if (connection) { 114 | output = { 115 | connection_id: connection.connection_id, 116 | redirect_url: connection.url, 117 | instruction: 118 | 'Ask user to open the redirect URL and complete the Oauth process. \n Once user completes the process and gets back, check again by calling check_connection', 119 | }; 120 | } 121 | } else if (method.endsWith('transfer_agent')) { 122 | output = await this.maton.invokeAgent(app, arg.user_prompt); 123 | } else { 124 | output = await this.maton.invokeAction(app, action, arg); 125 | } 126 | 127 | return JSON.stringify(output); 128 | } 129 | } 130 | 131 | export default MatonAPI; 132 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/google-sheet.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const addColumnParameters = z.object({ 12 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 13 | worksheet_id: z.string().describe('The ID of worksheet'), 14 | column: z.string().describe('The column letter'), 15 | }); 16 | 17 | export const addMultipleRowsParameters = z.object({ 18 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 19 | worksheet_id: z.string().describe('The ID of worksheet'), 20 | values: z.array(z.array(z.string())).describe('The values of the rows'), 21 | }); 22 | 23 | export const clearCellParameters = z.object({ 24 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 25 | worksheet_id: z.string().describe('The ID of worksheet'), 26 | cell: z.string().describe('The A1 notation of the cell. E.g., `A1`'), 27 | }); 28 | 29 | export const clearRowsParameters = z.object({ 30 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 31 | worksheet_id: z.string().describe('The ID of worksheet'), 32 | start_row: z.number().describe('The starting row number'), 33 | end_row: z.number().describe('The ending row number (inclusive)'), 34 | }); 35 | 36 | export const createSpreadsheetParameters = z.object({ 37 | title: z.string().describe('The title of Google spreadsheet'), 38 | }); 39 | 40 | export const createWorksheetParameters = z.object({ 41 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 42 | title: z.string().describe('The title of Google spreadsheet'), 43 | }); 44 | 45 | export const deleteRowsParameters = z.object({ 46 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 47 | worksheet_id: z.string().describe('The ID of worksheet'), 48 | start_row: z.number().describe('The starting row number'), 49 | end_row: z.number().describe('The ending row number (inclusive)'), 50 | }); 51 | 52 | export const deleteWorksheetParameters = z.object({ 53 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 54 | worksheet_id: z.string().describe('The ID of worksheet'), 55 | }); 56 | 57 | export const findRowParameters = z.object({ 58 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 59 | worksheet_id: z.string().describe('The ID of worksheet'), 60 | column: z.string().describe('The column letter'), 61 | value: z.string().describe('The value to search for'), 62 | }); 63 | 64 | export const getCellParameters = z.object({ 65 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 66 | worksheet_id: z.string().describe('The ID of worksheet'), 67 | cell: z.string().describe('The A1 notation of the cell. E.g., `A1`'), 68 | }); 69 | 70 | export const getSpreadsheetParameters = z.object({ 71 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 72 | }); 73 | 74 | export const getValuesInRangeParameters = z.object({ 75 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 76 | worksheet_id: z.string().describe('The ID of worksheet'), 77 | range: z 78 | .string() 79 | .describe('The A1 notation of the values to retrieve. E.g., `A1:E5`'), 80 | }); 81 | 82 | export const listWorksheetsParameters = z.object({ 83 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 84 | }); 85 | 86 | export const updateCellParameters = z.object({ 87 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 88 | worksheet_id: z.string().describe('The ID of worksheet'), 89 | cell: z.string().describe('The A1 notation of the cell. E.g., `A1`'), 90 | value: z.string().describe('The value to update'), 91 | }); 92 | 93 | export const updateMultipleRowsParameters = z.object({ 94 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 95 | worksheet_id: z.string().describe('The ID of worksheet'), 96 | range: z 97 | .string() 98 | .describe('The A1 notation of the values to retrieve. E.g., `A1:E5`'), 99 | values: z.array(z.array(z.string())).describe('The values to update'), 100 | }); 101 | 102 | export const updateRowParameters = z.object({ 103 | spreadsheet_id: z.string().describe('The ID of Google spreadsheet'), 104 | worksheet_id: z.string().describe('The ID of worksheet'), 105 | row: z.number().describe('The row number'), 106 | values: z.array(z.string()).describe('The values to update'), 107 | }); 108 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/configuration.ts: -------------------------------------------------------------------------------- ```typescript 1 | import type {Tool} from './tools'; 2 | 3 | const ACCEPTED_APPS: string[] = [ 4 | 'airtable', 5 | 'asana', 6 | 'aws', 7 | 'calendly', 8 | 'clickup', 9 | 'google-calendar', 10 | 'google-docs', 11 | 'google-drive', 12 | 'google-mail', 13 | 'google-sheet', 14 | 'hubspot', 15 | 'jira', 16 | 'jotform', 17 | 'klaviyo', 18 | 'mailchimp', 19 | 'notion', 20 | 'outlook', 21 | 'pipedrive', 22 | 'salesforce', 23 | 'shopify', 24 | 'slack', 25 | 'stripe', 26 | 'typeform', 27 | 'youtube', 28 | ]; 29 | const ACCEPTED_ACTIONS: {[key: string]: string[]} = { 30 | airtable: ['list-bases', 'list-records', 'list-tables'], 31 | asana: [ 32 | 'create-task', 33 | 'get-task', 34 | 'list-projects', 35 | 'list-tasks', 36 | 'list-workspaces', 37 | ], 38 | aws: ['get-s3-object', 'list-s3-buckets', 'list-s3-objects'], 39 | calendly: [ 40 | 'get-event', 41 | 'list-event-invitees', 42 | 'list-event-types', 43 | 'list-events', 44 | ], 45 | clickup: [ 46 | 'create-task', 47 | 'delete-task', 48 | 'get-task', 49 | 'list-folders', 50 | 'list-lists', 51 | 'list-spaces', 52 | 'list-tasks', 53 | 'list-workspaces', 54 | ], 55 | 'google-calendar': [ 56 | 'create-event', 57 | 'delete-event', 58 | 'get-calendar', 59 | 'get-event', 60 | 'list-calendars', 61 | 'list-events', 62 | 'update-event', 63 | ], 64 | 'google-docs': [ 65 | 'append-text', 66 | 'create-document', 67 | 'find-document', 68 | 'get-document', 69 | ], 70 | 'google-drive': [ 71 | 'create-file', 72 | 'create-folder', 73 | 'delete-file', 74 | 'find-file', 75 | 'find-folder', 76 | 'get-file', 77 | 'list-files', 78 | ], 79 | 'google-mail': [ 80 | 'add-label-to-email', 81 | 'create-draft', 82 | 'find-email', 83 | 'list-labels', 84 | 'send-email', 85 | 'remove-label-from-email', 86 | ], 87 | 'google-sheet': [ 88 | 'add-column', 89 | 'add-multiple-rows', 90 | 'clear-cell', 91 | 'clear-rows', 92 | 'create-spreadsheet', 93 | 'create-worksheet', 94 | 'delete-rows', 95 | 'delete-worksheet', 96 | 'find-row', 97 | 'get-cell', 98 | 'get-spreadsheet', 99 | 'get-values-in-range', 100 | 'list-worksheets', 101 | 'update-cell', 102 | 'update-multiple-rows', 103 | 'update-row', 104 | ], 105 | hubspot: [ 106 | 'create-contact', 107 | 'get-contact', 108 | 'list-contacts', 109 | 'search-contacts', 110 | 'merge-contacts', 111 | 'update-contact', 112 | 'delete-contact', 113 | 'create-deal', 114 | 'get-deal', 115 | 'list-deals', 116 | 'search-deals', 117 | 'merge-deals', 118 | 'update-deal', 119 | 'delete-deal', 120 | ], 121 | jira: [ 122 | 'list-clouds', 123 | 'get-issue', 124 | 'list-issues', 125 | 'add-comment-to-issue', 126 | 'list-comments', 127 | 'update-comment', 128 | 'list-projects', 129 | 'get-user', 130 | 'list-users', 131 | ], 132 | jotform: ['list-forms', 'list-submissions'], 133 | klaviyo: [ 134 | 'add-profiles-to-list', 135 | 'assign-template-to-campaign-message', 136 | 'create-campaign', 137 | 'create-list', 138 | 'create-profile', 139 | 'create-template', 140 | 'get-campaign-messages', 141 | 'get-campaign-send-job', 142 | 'get-campaigns', 143 | 'get-lists', 144 | 'get-profiles-for-list', 145 | 'get-profiles', 146 | 'get-templates', 147 | 'send-campaign', 148 | ], 149 | mailchimp: ['get-campaign', 'search-campaign'], 150 | notion: ['create-page', 'find-page', 'get-page'], 151 | outlook: ['create-draft', 'find-email', 'send-email'], 152 | pipedrive: ['search-people'], 153 | salesforce: ['create-contact', 'get-contact', 'list-contacts'], 154 | shopify: ['create-order', 'get-order', 'list-orders'], 155 | slack: ['list-channels', 'list-messages', 'list-replies', 'send-message'], 156 | stripe: [ 157 | 'create-customer', 158 | 'create-invoice-item', 159 | 'create-invoice', 160 | 'delete-customer', 161 | 'get-customer', 162 | 'get-invoice', 163 | 'list-customers', 164 | 'list-invoices', 165 | ], 166 | typeform: ['get-form', 'list-forms', 'list-responses'], 167 | youtube: ['list-videos', 'search-videos'], 168 | }; 169 | const AGENT_ACTIONS = ['transfer-agent']; 170 | const BUILTIN_ACTIONS = ['check-connection', 'start-connection']; 171 | 172 | export type Actions = { 173 | [key: string]: boolean; 174 | }; 175 | 176 | export type Configuration = { 177 | apiKey?: string; 178 | app?: string; 179 | agent?: boolean; 180 | actions?: string[]; 181 | }; 182 | 183 | function getMethod(app: string, action: string) { 184 | return `${app}_${action.replaceAll('-', '_')}`; 185 | } 186 | 187 | export const checkConfiguration = (configuration: Configuration) => { 188 | if (!configuration.app) { 189 | throw new Error('The app argument must be provided.'); 190 | } 191 | if (configuration.agent && configuration.actions) { 192 | throw new Error('Both --agent and --actions arguments cannot be provided.'); 193 | } else if (!configuration.agent && !configuration.actions) { 194 | throw new Error('Either --agent or --actions arguments must be provided.'); 195 | } 196 | 197 | if (!ACCEPTED_APPS.includes(configuration.app)) { 198 | throw new Error( 199 | `Invalid app: ${configuration.app}. Accepted apps are: ${ACCEPTED_APPS.join( 200 | ', ' 201 | )}` 202 | ); 203 | } 204 | 205 | if (configuration.actions) { 206 | configuration.actions.forEach((action: string) => { 207 | if (action == 'all') { 208 | return; 209 | } 210 | if (!ACCEPTED_ACTIONS[configuration.app!].includes(action.trim())) { 211 | throw new Error( 212 | `Invalid action: ${action}. Accepted actions are: ${ACCEPTED_ACTIONS[ 213 | configuration.app! 214 | ].join(', ')}` 215 | ); 216 | } 217 | }); 218 | } 219 | }; 220 | 221 | export const isToolAllowed = ( 222 | tool: Tool, 223 | configuration: Configuration 224 | ): boolean => { 225 | if (!configuration.app || !tool.method.startsWith(configuration.app)) { 226 | return false; 227 | } 228 | if ( 229 | BUILTIN_ACTIONS.map((action) => 230 | getMethod(configuration.app!, action) 231 | ).includes(tool.method) 232 | ) { 233 | return true; 234 | } 235 | if (configuration.agent) { 236 | return AGENT_ACTIONS.map((action) => 237 | getMethod(configuration.app!, action) 238 | ).includes(tool.method); 239 | } else if (configuration.actions) { 240 | if (configuration.actions.includes('all')) { 241 | return !AGENT_ACTIONS.map((action) => 242 | getMethod(configuration.app!, action) 243 | ).includes(tool.method); 244 | } 245 | return configuration.actions 246 | .map((action) => getMethod(configuration.app!, action)) 247 | .includes(tool.method); 248 | } else { 249 | return false; 250 | } 251 | }; 252 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/google-calendar.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const createEventParameters = z.object({ 12 | calendar_id: z.string().describe('The ID of Google Calendar'), 13 | event_start_date: z 14 | .string() 15 | .describe( 16 | 'The start date of the event in the format `yyyy-mm-dd`. For all-day events, enter the Event day in the format `yyyy-mm-dd`. For events with time, format according to RFC3339: `yyyy-mm-ddThh:mm:ss+01:00`.' 17 | ), 18 | event_end_date: z 19 | .string() 20 | .describe( 21 | 'The start date of the event in the format `yyyy-mm-dd`. For all-day events, enter the Event day in the format `yyyy-mm-dd`. For events with time, format according to RFC3339: `yyyy-mm-ddThh:mm:ss+01:00`.' 22 | ), 23 | summary: z.string().describe('The title of the event.').optional(), 24 | location: z.string().describe('The location of the event.').optional(), 25 | description: z.string().describe('The description of the event.').optional(), 26 | attendees: z 27 | .array(z.string()) 28 | .describe('The email addresses of the attendees.') 29 | .optional(), 30 | repeat_frequency: z 31 | .enum(['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY']) 32 | .describe('The frequency of the event repetition.') 33 | .optional(), 34 | repeat_times: z 35 | .number() 36 | .describe('The number of times the event repeats.') 37 | .optional(), 38 | repeat_interval: z 39 | .number() 40 | .describe( 41 | 'The interval between event repetitions. To repeat every day, enter 1. To repeat every other day, enter 2.' 42 | ) 43 | .optional(), 44 | send_updates: z 45 | .enum(['all', 'externalOnly', 'none']) 46 | .describe('Whether to send updates.') 47 | .optional(), 48 | create_meet_room: z 49 | .boolean() 50 | .describe('Whether to create a Google Meet room for this event.') 51 | .optional(), 52 | visibility: z 53 | .enum(['default', 'public', 'private', 'confidential']) 54 | .describe( 55 | 'The visibility of the event. Defaults to default if not specified.' 56 | ) 57 | .optional(), 58 | }); 59 | 60 | export const deleteEventParameters = z.object({ 61 | calendar_id: z.string().describe('The ID of calendar'), 62 | event_id: z.string().describe('The ID of event'), 63 | }); 64 | 65 | export const getCalendarParameters = z.object({ 66 | calendar_id: z.string().describe('The ID of Google Calendar'), 67 | }); 68 | 69 | export const getEventParameters = z.object({ 70 | calendar_id: z.string().describe('The ID of calendar'), 71 | event_id: z.string().describe('The ID of event'), 72 | }); 73 | 74 | export const listCalendarsParameters = z.object({}); 75 | 76 | export const listEventsParameters = z.object({ 77 | calendar_id: z.string().describe('The ID of calendar'), 78 | order_by: z 79 | .enum(['startTime', 'updated']) 80 | .describe('The order of the events returned in the result.') 81 | .optional(), 82 | q: z.string().describe('The search query.').optional(), 83 | show_deleted: z 84 | .boolean() 85 | .describe( 86 | 'Whether to include deleted events (with status equals "cancelled") in the result.' 87 | ) 88 | .optional(), 89 | show_hidden_invitations: z 90 | .boolean() 91 | .describe('Whether to include hidden invitations in the result.') 92 | .optional(), 93 | show_single_events: z 94 | .boolean() 95 | .describe( 96 | 'Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves.' 97 | ) 98 | .optional(), 99 | time_max: z 100 | .string() 101 | .describe("Upper bound (exclusive) for an event's time to filter by.") 102 | .optional(), 103 | time_min: z 104 | .string() 105 | .describe("Lower bound (exclusive) for an event's time to filter by.") 106 | .optional(), 107 | updated_min: z 108 | .string() 109 | .describe("Lower bound for an event's last modification time to filter by.") 110 | .optional(), 111 | event_types: z 112 | .array(z.enum(['default', 'focusTime', 'outOfOffice', 'workingLocation'])) 113 | .describe('Filter events by event type.') 114 | .optional(), 115 | }); 116 | 117 | export const updateEventParameters = z.object({ 118 | calendar_id: z.string().describe('The ID of calendar'), 119 | event_id: z.string().describe('The ID of event'), 120 | summary: z.string().describe('The title of the event.').optional(), 121 | event_start_date: z 122 | .string() 123 | .describe( 124 | 'The start date of the event in the format `yyyy-mm-dd`. For all-day events, enter the Event day in the format `yyyy-mm-dd`. For events with time, format according to RFC3339: `yyyy-mm-ddThh:mm:ss+01:00`.' 125 | ) 126 | .optional(), 127 | event_end_date: z 128 | .string() 129 | .describe( 130 | 'The start date of the event in the format `yyyy-mm-dd`. For all-day events, enter the Event day in the format `yyyy-mm-dd`. For events with time, format according to RFC3339: `yyyy-mm-ddThh:mm:ss+01:00`.' 131 | ) 132 | .optional(), 133 | location: z.string().describe('The location of the event.').optional(), 134 | description: z.string().describe('The description of the event.').optional(), 135 | attendees: z 136 | .array(z.string()) 137 | .describe('The email addresses of the attendees.') 138 | .optional(), 139 | repeat_frequency: z 140 | .enum(['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY']) 141 | .describe('The frequency of the event repetition.') 142 | .optional(), 143 | repeat_times: z 144 | .number() 145 | .describe('The number of times the event repeats.') 146 | .optional(), 147 | repeat_interval: z 148 | .number() 149 | .describe( 150 | 'The interval between event repetitions. To repeat every day, enter 1. To repeat every other day, enter 2.' 151 | ) 152 | .optional(), 153 | send_updates: z 154 | .enum(['all', 'externalOnly', 'none']) 155 | .describe('Whether to send updates.') 156 | .optional(), 157 | create_meet_room: z 158 | .boolean() 159 | .describe('Whether to create a Google Meet room for this event.') 160 | .optional(), 161 | visibility: z 162 | .enum(['default', 'public', 'private', 'confidential']) 163 | .describe('The visibility of the event.') 164 | .optional(), 165 | }); 166 | ``` -------------------------------------------------------------------------------- /typescript/src/shared/parameters/klaviyo.ts: -------------------------------------------------------------------------------- ```typescript 1 | import {z} from 'zod'; 2 | 3 | export const checkConnectionParameters = z.object({}); 4 | 5 | export const startConnectionParameters = z.object({}); 6 | 7 | export const transferAgentParameters = z.object({ 8 | user_prompt: z.string().describe('The user prompt'), 9 | }); 10 | 11 | export const addProfilesToListParameters = z.object({ 12 | list_id: z.string().describe('The list ID'), 13 | profile_ids: z.array(z.string()).describe('A list of profile IDs'), 14 | }); 15 | 16 | export const assignTemplateToCampaignMessageParameters = z.object({ 17 | campaign_message_id: z.string().describe('The ID of the campaign message'), 18 | template_id: z.string().describe('The ID of the template'), 19 | }); 20 | 21 | export const createCampaignParameters = z.object({ 22 | name: z.string().describe('The name of the campaign'), 23 | audiences: z.object({ 24 | included: z.array(z.string()).describe('The IDs of included lists'), 25 | excluded: z.array(z.string()).describe('The IDs of excluded lists'), 26 | }), 27 | campaign_messages: z.array( 28 | z 29 | .object({ 30 | type: z.enum(['campaign-message']), 31 | attributes: z 32 | .object({ 33 | definition: z 34 | .object({ 35 | channel: z 36 | .enum(['email', 'sms', 'mobile_push']) 37 | .describe('The channel of the campaign message.'), 38 | label: z 39 | .string() 40 | .optional() 41 | .describe('The label of the campaign message.'), 42 | content: z 43 | .object({ 44 | subject: z 45 | .string() 46 | .optional() 47 | .describe('The subject of the campaign message.'), 48 | previewText: z 49 | .string() 50 | .optional() 51 | .describe('The preview text of the campaign message.'), 52 | fromEmail: z 53 | .string() 54 | .optional() 55 | .describe('The from email of the campaign message.'), 56 | fromLabel: z 57 | .string() 58 | .optional() 59 | .describe('The from label of the campaign message.'), 60 | replyToEmail: z 61 | .string() 62 | .optional() 63 | .describe('The reply to email of the campaign message.'), 64 | ccEmail: z 65 | .string() 66 | .optional() 67 | .describe('The cc email of the campaign message.'), 68 | bccEmail: z 69 | .string() 70 | .optional() 71 | .describe('The bcc email of the campaign message.'), 72 | }) 73 | .optional(), 74 | renderOptions: z 75 | .object({ 76 | shortenLinks: z 77 | .boolean() 78 | .optional() 79 | .describe('Whether to shorten links.'), 80 | addOrgPrefix: z 81 | .boolean() 82 | .optional() 83 | .describe('Whether to add org prefix.'), 84 | addInfoLinks: z 85 | .boolean() 86 | .optional() 87 | .describe('Whether to add info links.'), 88 | addOptOutLanguage: z 89 | .boolean() 90 | .optional() 91 | .describe('Whether to add opt out language.'), 92 | }) 93 | .optional(), 94 | kvPairs: z 95 | .object({}) 96 | .optional() 97 | .describe('The kv pairs of the campaign message.'), 98 | options: z 99 | .object({ 100 | type: z 101 | .enum(['open_app', 'deep_link']) 102 | .describe('The type of the options.'), 103 | iosDeepLink: z 104 | .string() 105 | .optional() 106 | .describe('The ios deep link of the campaign message.'), 107 | androidDeepLink: z 108 | .string() 109 | .optional() 110 | .describe( 111 | 'The android deep link of the campaign message.' 112 | ), 113 | display: z 114 | .boolean() 115 | .optional() 116 | .describe( 117 | 'Whether to display the campaign message. Required if type is "open_app".' 118 | ), 119 | }) 120 | .optional() 121 | .describe('The options of the campaign message.'), 122 | }) 123 | .describe('The definition of the campaign message.'), 124 | }) 125 | .describe('THe attributes of the campaign message.'), 126 | }) 127 | .describe('The data of the campaign message.') 128 | ), 129 | send_strategy: z 130 | .object({ 131 | method: z 132 | .enum(['static', 'throttled', 'immediate', 'smart_send_time']) 133 | .describe('The method of the send strategy.'), 134 | datetime: z 135 | .string() 136 | .optional() 137 | .describe( 138 | 'The ISO 8601 date and time of the send time. Requred if method is "static".' 139 | ), 140 | options: z 141 | .object({ 142 | isLocalTime: z.boolean().describe('Whether to use local time'), 143 | sendPastRecipientsImmediately: z 144 | .boolean() 145 | .optional() 146 | .describe('Whether to send past recipients immediately.'), 147 | }) 148 | .optional() 149 | .describe('The options of the send strategy.'), 150 | throttlePercentage: z 151 | .number() 152 | .optional() 153 | .describe( 154 | 'The throttle percentage of the send strategy. Required if method is "throttled"' 155 | ), 156 | date: z 157 | .string() 158 | .optional() 159 | .describe( 160 | 'The ISO 8601 date of the send time. Required if method is "smart_send_time"' 161 | ), 162 | }) 163 | .optional() 164 | .describe('The send strategy of the campaign.'), 165 | send_options: z 166 | .object({ 167 | useSmartSending: z 168 | .boolean() 169 | .optional() 170 | .describe('Whether to use smart sending.'), 171 | }) 172 | .optional() 173 | .describe('The send options of the campaign.'), 174 | tracking_options: z 175 | .object({ 176 | addTrackingParams: z 177 | .boolean() 178 | .optional() 179 | .describe('Whether to add tracking params.'), 180 | customTrackingParams: z 181 | .array( 182 | z.object({ 183 | type: z 184 | .enum(['static', 'dynamic']) 185 | .describe('The type of the custom tracking param.'), 186 | value: z 187 | .string() 188 | .describe('The value of the custom tracking param.'), 189 | name: z.string().describe('The name of the custom tracking param.'), 190 | }) 191 | ) 192 | .optional() 193 | .describe('The custom tracking params of the campaign.'), 194 | isTrackingClicks: z 195 | .boolean() 196 | .optional() 197 | .describe('Whether to track clicks.'), 198 | isTrackingOpens: z 199 | .boolean() 200 | .optional() 201 | .describe('Whether to track opens.'), 202 | }) 203 | .optional() 204 | .describe('The tracking options of the campaign.'), 205 | }); 206 | 207 | export const createListParameters = z.object({ 208 | name: z.string().describe('The name of the list.'), 209 | }); 210 | 211 | export const createProfileParameters = z.object({ 212 | email: z.string().optional().describe('The email of the user.'), 213 | phone_number: z.string().optional().describe('The phone number of the user.'), 214 | external_id: z.string().optional().describe('The external ID of the user.'), 215 | first_name: z.string().optional().describe('The first name of the user.'), 216 | last_name: z.string().optional().describe('The last name of the user.'), 217 | organization: z.string().optional().describe('The organization of the user.'), 218 | locale: z.string().optional().describe('The locale of the user.'), 219 | title: z.string().optional().describe('The title of the user.'), 220 | image: z.string().optional().describe('The image of the user.'), 221 | location: z.string().optional().describe('The location of the user.'), 222 | properties: z.object({}).optional().describe('The properties of the user.'), 223 | }); 224 | 225 | export const createTemplateParameters = z.object({ 226 | name: z.string().describe('The name of the template.'), 227 | html: z.string().optional().describe('The HTML content of the template.'), 228 | text: z.string().optional().describe('The text content of the template.'), 229 | }); 230 | 231 | export const getCampaignMessagesParameters = z.object({ 232 | campaign_id: z.string().describe('The ID of the campaign.'), 233 | }); 234 | 235 | export const getCampaignSendJobParameters = z.object({ 236 | campaign_id: z.string().describe('The ID of the campaign.'), 237 | }); 238 | 239 | export const getCampaignsParameters = z.object({ 240 | filter: z 241 | .string() 242 | .describe( 243 | "The filter of the campaigns. A channel filter is required to list campaigns. Please provide either:\n`equals(messages.channel,'email')` to list email campaigns, `equals(messages.channel,'sms')` to list SMS campaigns, `equals(messages.channel,'mobile_push')` to list mobile push campaigns." 244 | ), 245 | }); 246 | 247 | export const getListsParameters = z.object({}); 248 | 249 | export const getProfilesForListParameters = z.object({ 250 | list_id: z.string().describe('The list ID.'), 251 | }); 252 | 253 | export const getProfilesParameters = z.object({}); 254 | 255 | export const getTemplatesParameters = z.object({}); 256 | 257 | export const sendCampaignParameters = z.object({ 258 | campaign_id: z.string().describe('The ID of the campaign.'), 259 | }); 260 | ```