@matimo/gmail 0.1.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,49 @@
1
+ # Google OAuth2 Provider Definition
2
+ #
3
+ # This file defines the OAuth2 configuration for Google.
4
+ # All Gmail tools reference this provider definition.
5
+ #
6
+ # Users can override these endpoints via:
7
+ # 1. Runtime config (highest priority)
8
+ # 2. Environment variables: OAUTH_GOOGLE_AUTH_URL, OAUTH_GOOGLE_TOKEN_URL, etc.
9
+ # 3. This YAML definition (lowest priority)
10
+ #
11
+ # Pattern: Define once, use everywhere
12
+
13
+ name: google-provider
14
+ type: provider
15
+ version: '1.0.0'
16
+
17
+ description: |
18
+ Google OAuth2 Provider Configuration
19
+
20
+ All Gmail tools and Google-dependent tools use these endpoints.
21
+
22
+ Setup:
23
+ 1. Create Google Cloud project
24
+ 2. Enable Gmail API
25
+ 3. Create OAuth2 credentials (web application)
26
+ 4. Set GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET environment variables
27
+ 5. Set GOOGLE_REDIRECT_URI to your callback URL
28
+
29
+ provider:
30
+ name: google
31
+ displayName: Google
32
+
33
+ # OAuth2 Endpoints
34
+ # Standard Google OAuth2 endpoints - change only if using custom proxy
35
+ endpoints:
36
+ authorizationUrl: https://accounts.google.com/o/oauth2/v2/auth
37
+ tokenUrl: https://oauth2.googleapis.com/token
38
+ revokeUrl: https://oauth2.googleapis.com/revoke
39
+
40
+ # Standard scopes for Gmail access
41
+ # Tools can override with their own scopes
42
+ defaultScopes:
43
+ - https://www.googleapis.com/auth/gmail.readonly
44
+ - https://www.googleapis.com/auth/gmail.send
45
+ - https://www.googleapis.com/auth/gmail.compose
46
+
47
+ # Additional metadata
48
+ documentation: https://developers.google.com/gmail/api
49
+ learnMore: https://developers.google.com/oauthplayground
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@matimo/gmail",
3
+ "version": "0.1.0-alpha.10",
4
+ "description": "Gmail tools for Matimo",
5
+ "type": "module",
6
+ "files": [
7
+ "tools",
8
+ "README.md",
9
+ "definition.yaml"
10
+ ],
11
+ "peerDependencies": {
12
+ "matimo": "0.1.0-alpha.10"
13
+ },
14
+ "devDependencies": {
15
+ "axios": "^1.13.4",
16
+ "@matimo/core": "0.1.0-alpha.10"
17
+ }
18
+ }
@@ -0,0 +1,99 @@
1
+ name: gmail-create-draft
2
+ description: Create a draft email in Gmail without sending it
3
+ version: '1.0.0'
4
+
5
+ parameters:
6
+ to:
7
+ type: string
8
+ description: Email address of the recipient(s), comma-separated for multiple recipients
9
+ required: true
10
+ example: 'user@example.com'
11
+
12
+ subject:
13
+ type: string
14
+ description: Subject line of the draft email
15
+ required: true
16
+ example: 'Draft Email'
17
+
18
+ body:
19
+ type: string
20
+ description: Email body content (plain text or HTML)
21
+ required: true
22
+ example: 'This is a draft email'
23
+
24
+ cc:
25
+ type: string
26
+ description: CC email addresses, comma-separated
27
+ required: false
28
+ example: 'cc@example.com'
29
+
30
+ bcc:
31
+ type: string
32
+ description: BCC email addresses, comma-separated
33
+ required: false
34
+ example: 'bcc@example.com'
35
+
36
+ isHtml:
37
+ type: boolean
38
+ description: Whether the body content is HTML (default is plain text)
39
+ required: false
40
+ default: false
41
+
42
+ raw:
43
+ type: string
44
+ description: 'Base64url-encoded MIME message (RFC 2822 format). If provided, overrides to/subject/body/cc/bcc parameters.'
45
+ required: false
46
+ example: 'VG8...'
47
+
48
+ execution:
49
+ type: http
50
+ method: POST
51
+ url: 'https://www.googleapis.com/gmail/v1/users/me/drafts'
52
+ headers:
53
+ Content-Type: 'application/json'
54
+ Authorization: 'Bearer {GMAIL_ACCESS_TOKEN}'
55
+
56
+ # Parameter encoding: automatically convert to/subject/body to MIME format
57
+ parameter_encoding:
58
+ - source: [to, subject, body, cc, bcc, isHtml]
59
+ target: raw
60
+ encoding: mime_rfc2822_base64url
61
+
62
+ body:
63
+ message:
64
+ raw: '{raw}'
65
+
66
+ authentication:
67
+ type: oauth2
68
+ provider: google
69
+ scopes:
70
+ - 'https://www.googleapis.com/auth/gmail.compose'
71
+
72
+ output_schema:
73
+ type: object
74
+ properties:
75
+ id:
76
+ type: string
77
+ description: Draft ID
78
+ message:
79
+ type: object
80
+ description: The created message object
81
+ properties:
82
+ id:
83
+ type: string
84
+ threadId:
85
+ type: string
86
+ labelIds:
87
+ type: array
88
+ items:
89
+ type: string
90
+
91
+ error_handling:
92
+ retry: 3
93
+ backoff_type: exponential
94
+ initial_delay_ms: 1000
95
+ retryable_status_codes:
96
+ - 429
97
+ - 500
98
+ - 502
99
+ - 503
@@ -0,0 +1,38 @@
1
+ name: gmail-delete-message
2
+ description: Permanently delete a message from Gmail (cannot be undone)
3
+ version: '1.0.0'
4
+
5
+ parameters:
6
+ messageId:
7
+ type: string
8
+ description: ID of the message to delete
9
+ required: true
10
+ example: '187a65b7f3f2f11e'
11
+
12
+ execution:
13
+ type: http
14
+ method: DELETE
15
+ url: 'https://www.googleapis.com/gmail/v1/users/me/messages/{messageId}'
16
+ headers:
17
+ Authorization: 'Bearer {GMAIL_ACCESS_TOKEN}'
18
+ note: 'Immediately and permanently deletes the message. This operation cannot be undone. Use trash instead if you want to allow recovery.'
19
+
20
+ authentication:
21
+ type: oauth2
22
+ provider: google
23
+ scopes:
24
+ - 'https://www.googleapis.com/auth/gmail.modify'
25
+
26
+ output_schema:
27
+ type: object
28
+ description: Empty response on successful deletion (204 No Content). The executor may return an empty body for 204 responses.
29
+
30
+ error_handling:
31
+ retry: 3
32
+ backoff_type: exponential
33
+ initial_delay_ms: 1000
34
+ retryable_status_codes:
35
+ - 429
36
+ - 500
37
+ - 502
38
+ - 503
@@ -0,0 +1,90 @@
1
+ name: gmail-get-message
2
+ description: Get full details of a specific Gmail message including headers and body
3
+ version: '1.0.0'
4
+
5
+ parameters:
6
+ messageId:
7
+ type: string
8
+ description: ID of the message to retrieve
9
+ required: true
10
+ example: '187a65b7f3f2f11e'
11
+
12
+ format:
13
+ type: string
14
+ enum:
15
+ - minimal
16
+ - full
17
+ - raw
18
+ description: Format of the message to return
19
+ required: false
20
+ default: full
21
+ example: full
22
+
23
+ metadataHeaders:
24
+ type: string
25
+ description: Comma-separated headers to include in metadata (when format=minimal)
26
+ required: false
27
+ example: 'From,Subject,Date'
28
+
29
+ execution:
30
+ type: http
31
+ method: GET
32
+ url: 'https://www.googleapis.com/gmail/v1/users/me/messages/{messageId}'
33
+ query_params:
34
+ format: '{format}'
35
+ metadataHeaders: '{metadataHeaders}'
36
+ headers:
37
+ Authorization: 'Bearer {GMAIL_ACCESS_TOKEN}'
38
+ Accept: 'application/json'
39
+
40
+ authentication:
41
+ type: oauth2
42
+ provider: google
43
+ scopes:
44
+ - 'https://www.googleapis.com/auth/gmail.readonly'
45
+
46
+ output_schema:
47
+ type: object
48
+ properties:
49
+ id:
50
+ type: string
51
+ description: Message ID
52
+ threadId:
53
+ type: string
54
+ description: Thread ID
55
+ labelIds:
56
+ type: array
57
+ items:
58
+ type: string
59
+ description: Array of label IDs applied to this message
60
+ snippet:
61
+ type: string
62
+ description: Short snippet of the message text
63
+ sizeEstimate:
64
+ type: number
65
+ description: Estimated size of the message in bytes
66
+ headers:
67
+ type: object
68
+ description: Message headers (From, To, Subject, Date, etc.)
69
+ body:
70
+ type: object
71
+ description: Message body with data and mimeType
72
+ properties:
73
+ mimeType:
74
+ type: string
75
+ data:
76
+ type: string
77
+ description: Message body data (base64 encoded if raw format)
78
+ error:
79
+ type: string
80
+ description: Error message if request failed
81
+
82
+ error_handling:
83
+ retry: 3
84
+ backoff_type: exponential
85
+ initial_delay_ms: 1000
86
+ retryable_status_codes:
87
+ - 429
88
+ - 500
89
+ - 502
90
+ - 503
@@ -0,0 +1,84 @@
1
+ name: gmail-list-messages
2
+ description: List messages from Gmail mailbox with filtering and pagination
3
+ version: '1.0.0'
4
+
5
+ parameters:
6
+ query:
7
+ type: string
8
+ description: Gmail search query (e.g., 'from:user@example.com', 'subject:hello', 'is:unread')
9
+ required: false
10
+ example: 'is:unread'
11
+
12
+ maxResults:
13
+ type: number
14
+ description: Maximum number of messages to return (1-500, defaults to 100)
15
+ required: false
16
+ default: 100
17
+ example: 20
18
+
19
+ pageToken:
20
+ type: string
21
+ description: Page token for pagination
22
+ required: false
23
+ example: 'NEXT_PAGE_TOKEN'
24
+
25
+ includeSpamTrash:
26
+ type: boolean
27
+ description: Include spam and trash in results (defaults to false)
28
+ required: false
29
+ default: false
30
+
31
+ labelIds:
32
+ type: string
33
+ description: Comma-separated label IDs to filter by
34
+ required: false
35
+ example: 'INBOX,IMPORTANT'
36
+
37
+ execution:
38
+ type: http
39
+ method: GET
40
+ url: 'https://www.googleapis.com/gmail/v1/users/me/messages'
41
+ query_params:
42
+ q: '{query}'
43
+ maxResults: '{maxResults}'
44
+ pageToken: '{pageToken}'
45
+ includeSpamTrash: '{includeSpamTrash}'
46
+ labelIds: '{labelIds}'
47
+ headers:
48
+ Authorization: 'Bearer {GMAIL_ACCESS_TOKEN}'
49
+
50
+ authentication:
51
+ type: oauth2
52
+ provider: google
53
+ scopes:
54
+ - 'https://www.googleapis.com/auth/gmail.readonly'
55
+
56
+ output_schema:
57
+ type: object
58
+ properties:
59
+ messages:
60
+ type: array
61
+ description: List of message objects (contains only id and threadId)
62
+ items:
63
+ type: object
64
+ properties:
65
+ id:
66
+ type: string
67
+ threadId:
68
+ type: string
69
+ nextPageToken:
70
+ type: string
71
+ description: Token for fetching next page of results
72
+ resultSizeEstimate:
73
+ type: number
74
+ description: Estimated total number of results
75
+
76
+ error_handling:
77
+ retry: 3
78
+ backoff_type: exponential
79
+ initial_delay_ms: 1000
80
+ retryable_status_codes:
81
+ - 429
82
+ - 500
83
+ - 502
84
+ - 503
@@ -0,0 +1,95 @@
1
+ name: gmail-send-email
2
+ description: Send an email using Gmail API with MIME format encoding
3
+ version: '1.0.0'
4
+
5
+ parameters:
6
+ to:
7
+ type: string
8
+ description: Email address of the recipient(s), comma-separated for multiple recipients
9
+ required: true
10
+ example: 'user@example.com'
11
+
12
+ subject:
13
+ type: string
14
+ description: Subject line of the email
15
+ required: true
16
+ example: 'Hello from Matimo'
17
+
18
+ body:
19
+ type: string
20
+ description: Email body content (plain text or HTML)
21
+ required: true
22
+ example: 'This is a test email from Matimo'
23
+
24
+ cc:
25
+ type: string
26
+ description: CC email addresses, comma-separated
27
+ required: false
28
+ example: 'cc@example.com'
29
+
30
+ bcc:
31
+ type: string
32
+ description: BCC email addresses, comma-separated
33
+ required: false
34
+ example: 'bcc@example.com'
35
+
36
+ isHtml:
37
+ type: boolean
38
+ description: Whether the body content is HTML (default is plain text)
39
+ required: false
40
+ default: false
41
+
42
+ raw:
43
+ type: string
44
+ description: 'Base64url-encoded MIME message (RFC 2822 format). If provided, overrides to/subject/body/cc/bcc parameters.'
45
+ required: false
46
+ example: 'VG8...'
47
+
48
+ execution:
49
+ type: http
50
+ method: POST
51
+ url: 'https://www.googleapis.com/gmail/v1/users/me/messages/send'
52
+ headers:
53
+ Content-Type: 'application/json'
54
+ Authorization: 'Bearer {GMAIL_ACCESS_TOKEN}'
55
+
56
+ # Parameter encoding: automatically convert to/subject/body to MIME format
57
+ parameter_encoding:
58
+ - source: [to, subject, body, cc, bcc, isHtml]
59
+ target: raw
60
+ encoding: mime_rfc2822_base64url
61
+
62
+ body:
63
+ raw: '{raw}'
64
+
65
+ authentication:
66
+ type: oauth2
67
+ provider: google
68
+ scopes:
69
+ - 'https://www.googleapis.com/auth/gmail.send'
70
+
71
+ output_schema:
72
+ type: object
73
+ properties:
74
+ id:
75
+ type: string
76
+ description: Message ID of the sent email
77
+ threadId:
78
+ type: string
79
+ description: Thread ID of the sent email
80
+ labelIds:
81
+ type: array
82
+ items:
83
+ type: string
84
+ description: Label IDs applied to the message
85
+
86
+ error_handling:
87
+ retry: 3
88
+ backoff_type: exponential
89
+ initial_delay_ms: 1000
90
+ max_delay_ms: 10000
91
+ retryable_status_codes:
92
+ - 429
93
+ - 500
94
+ - 502
95
+ - 503