matimo 0.1.0-alpha.1 → 0.1.0-alpha.3
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.
- package/README.md +83 -28
- package/dist/core/schema.d.ts +1 -1
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +8 -3
- package/dist/core/schema.js.map +1 -1
- package/dist/core/tool-loader.d.ts.map +1 -1
- package/dist/core/tool-loader.js +15 -4
- package/dist/core/tool-loader.js.map +1 -1
- package/dist/core/tool-registry.d.ts.map +1 -1
- package/dist/core/tool-registry.js +5 -1
- package/dist/core/tool-registry.js.map +1 -1
- package/dist/decorators/tool-decorator.d.ts.map +1 -1
- package/dist/decorators/tool-decorator.js +7 -4
- package/dist/decorators/tool-decorator.js.map +1 -1
- package/dist/encodings/parameter-encoding.d.ts.map +1 -1
- package/dist/encodings/parameter-encoding.js +9 -2
- package/dist/encodings/parameter-encoding.js.map +1 -1
- package/dist/executors/command-executor.d.ts.map +1 -1
- package/dist/executors/command-executor.js +5 -1
- package/dist/executors/command-executor.js.map +1 -1
- package/dist/executors/http-executor.d.ts.map +1 -1
- package/dist/executors/http-executor.js +5 -1
- package/dist/executors/http-executor.js.map +1 -1
- package/package.json +4 -4
- package/tools/calculator/calculator.ts +78 -0
- package/tools/calculator/definition.yaml +71 -0
- package/tools/echo-tool/definition.yaml +35 -0
- package/tools/examples/calculator.yaml +54 -0
- package/tools/examples/echo-tool.yaml +35 -0
- package/tools/examples/http-client.yaml +66 -0
- package/tools/github/definition.yaml +41 -0
- package/tools/gmail/README.md +1189 -0
- package/tools/gmail/create-draft/definition.yaml +99 -0
- package/tools/gmail/definition.yaml +49 -0
- package/tools/gmail/delete-message/definition.yaml +42 -0
- package/tools/gmail/get-message/definition.yaml +89 -0
- package/tools/gmail/list-messages/definition.yaml +84 -0
- package/tools/gmail/send-email/definition.yaml +95 -0
- package/tools/http-client/definition.yaml +73 -0
- package/tools/slack/README.md +200 -0
- package/tools/slack/assets/icon.svg +9 -0
- package/tools/slack/assets/logo-dark.svg +14 -0
- package/tools/slack/assets/logo-light.svg +14 -0
- package/tools/slack/assets/logo.svg +14 -0
- package/tools/slack/definition.yaml +54 -0
- package/tools/slack/get-user/definition.yaml +31 -0
- package/tools/slack/list-channels/definition.yaml +46 -0
- package/tools/slack/send-message/definition.yaml +30 -0
- package/tools/slack/slack_add_reaction/definition.yaml +45 -0
- package/tools/slack/slack_create_channel/definition.yaml +41 -0
- package/tools/slack/slack_get_channel_history/definition.yaml +58 -0
- package/tools/slack/slack_get_reactions/definition.yaml +36 -0
- package/tools/slack/slack_get_thread_replies/definition.yaml +45 -0
- package/tools/slack/slack_get_user_info/definition.yaml +32 -0
- package/tools/slack/slack_join_channel/definition.yaml +35 -0
- package/tools/slack/slack_reply_to_message/definition.yaml +49 -0
- package/tools/slack/slack_search_messages/definition.yaml +46 -0
- package/tools/slack/slack_send_channel_message/definition.yaml +34 -0
- package/tools/slack/slack_send_dm/definition.yaml +37 -0
- package/tools/slack/slack_set_channel_topic/definition.yaml +40 -0
- package/tools/slack/slack_upload_file/definition.yaml +152 -0
- package/docs/Gemfile +0 -5
- package/docs/RELEASES.md +0 -69
- package/docs/ROADMAP.md +0 -138
- package/docs/_config.yml +0 -27
- package/docs/api-reference/ERRORS.md +0 -445
- package/docs/api-reference/SDK.md +0 -582
- package/docs/api-reference/TYPES.md +0 -415
- package/docs/architecture/OAUTH.md +0 -1366
- package/docs/architecture/OVERVIEW.md +0 -564
- package/docs/assets/logo.png +0 -0
- package/docs/community/COMMIT_GUIDELINES.md +0 -552
- package/docs/framework-integrations/LANGCHAIN.md +0 -286
- package/docs/getting-started/QUICK_START.md +0 -211
- package/docs/getting-started/YOUR_FIRST_TOOL.md +0 -217
- package/docs/getting-started/installation.md +0 -124
- package/docs/index.md +0 -288
- package/docs/tool-development/DECORATOR_GUIDE.md +0 -633
- package/docs/tool-development/OAUTH_LINK.md +0 -5
- package/docs/tool-development/PROVIDER_CONFIGURATION.md +0 -458
- package/docs/tool-development/TESTING.md +0 -412
- package/docs/tool-development/TOOL_SPECIFICATION.md +0 -793
- package/docs/tool-development/YAML_TOOLS.md +0 -65
- package/docs/troubleshooting/FAQ.md +0 -391
- package/docs/user-guide/AUTHENTICATION.md +0 -255
- package/docs/user-guide/DEVELOPMENT_STANDARDS.md +0 -698
- package/docs/user-guide/SDK_PATTERNS.md +0 -316
- package/docs/user-guide/TOOL_DISCOVERY.md +0 -209
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# YAML Tool Specification
|
|
2
|
-
|
|
3
|
-
Complete guide to writing Matimo tools in YAML format.
|
|
4
|
-
|
|
5
|
-
## Quick Reference
|
|
6
|
-
|
|
7
|
-
See the [detailed specification](./TOOL_SPECIFICATION.md) for complete documentation.
|
|
8
|
-
|
|
9
|
-
**Quick tool template:**
|
|
10
|
-
|
|
11
|
-
```yaml
|
|
12
|
-
name: my-tool
|
|
13
|
-
description: Brief description
|
|
14
|
-
version: '1.0.0'
|
|
15
|
-
|
|
16
|
-
parameters:
|
|
17
|
-
param_name:
|
|
18
|
-
type: string
|
|
19
|
-
description: What this parameter does
|
|
20
|
-
required: true
|
|
21
|
-
|
|
22
|
-
execution:
|
|
23
|
-
type: command
|
|
24
|
-
command: node script.js
|
|
25
|
-
args: ['--param', '{param_name}']
|
|
26
|
-
|
|
27
|
-
output_schema:
|
|
28
|
-
type: object
|
|
29
|
-
properties:
|
|
30
|
-
result:
|
|
31
|
-
type: string
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Key Sections
|
|
35
|
-
|
|
36
|
-
| Section | Purpose |
|
|
37
|
-
|---------|---------|
|
|
38
|
-
| `name` | Unique tool identifier (kebab-case) |
|
|
39
|
-
| `description` | One-line description |
|
|
40
|
-
| `version` | Semantic version (e.g., 1.0.0) |
|
|
41
|
-
| `parameters` | Tool input parameters |
|
|
42
|
-
| `execution` | How the tool runs (command or HTTP) |
|
|
43
|
-
| `output_schema` | What the tool returns |
|
|
44
|
-
| `authentication` | OAuth2/API key config (optional) |
|
|
45
|
-
| `error_handling` | Retry policy (optional) |
|
|
46
|
-
|
|
47
|
-
## Full Specification
|
|
48
|
-
|
|
49
|
-
The complete YAML schema documentation is in [TOOL_SPECIFICATION.md](./TOOL_SPECIFICATION.md).
|
|
50
|
-
|
|
51
|
-
Topics covered:
|
|
52
|
-
- Metadata (name, description, version)
|
|
53
|
-
- Parameter types and constraints
|
|
54
|
-
- Execution modes (command, HTTP)
|
|
55
|
-
- Authentication configuration
|
|
56
|
-
- Output schema validation
|
|
57
|
-
- Error handling and retry policies
|
|
58
|
-
- Examples for each type
|
|
59
|
-
|
|
60
|
-
## Next Steps
|
|
61
|
-
|
|
62
|
-
- **Full Specification**: [TOOL_SPECIFICATION.md](./TOOL_SPECIFICATION.md)
|
|
63
|
-
- **Test Your Tool**: [Testing Guide](./TESTING.md)
|
|
64
|
-
- **Decorator Pattern**: [Decorator Guide](./DECORATOR_GUIDE.md)
|
|
65
|
-
|
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
# Troubleshooting & FAQ
|
|
2
|
-
|
|
3
|
-
Common issues and solutions for Matimo v0.1.0-alpha.1
|
|
4
|
-
|
|
5
|
-
## Installation & Setup
|
|
6
|
-
|
|
7
|
-
### Q: Node.js version error
|
|
8
|
-
|
|
9
|
-
**Error**: `Node version must be 18.0.0 or higher`
|
|
10
|
-
|
|
11
|
-
**Solution**:
|
|
12
|
-
```bash
|
|
13
|
-
node --version
|
|
14
|
-
# If < v18, install from https://nodejs.org
|
|
15
|
-
# Use nvm (Node Version Manager) for easy switching:
|
|
16
|
-
nvm install 18
|
|
17
|
-
nvm use 18
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Q: pnpm not found
|
|
21
|
-
|
|
22
|
-
**Error**: `pnpm: command not found`
|
|
23
|
-
|
|
24
|
-
**Solution**:
|
|
25
|
-
```bash
|
|
26
|
-
npm install -g pnpm@8.15.0
|
|
27
|
-
pnpm --version
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Q: Build fails with TypeScript errors
|
|
31
|
-
|
|
32
|
-
**Error**: `Found X errors in src/**`
|
|
33
|
-
|
|
34
|
-
**Solution**:
|
|
35
|
-
```bash
|
|
36
|
-
# Clear and rebuild
|
|
37
|
-
pnpm clean
|
|
38
|
-
pnpm install
|
|
39
|
-
pnpm build
|
|
40
|
-
|
|
41
|
-
# If still failing, check TypeScript version
|
|
42
|
-
pnpm list typescript
|
|
43
|
-
# Should be 5.9.3 or higher
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Tool Execution
|
|
49
|
-
|
|
50
|
-
### Q: Tool not found error
|
|
51
|
-
|
|
52
|
-
**Error**: `Tool not found: calculator`
|
|
53
|
-
|
|
54
|
-
**Solutions**:
|
|
55
|
-
1. Verify tool exists:
|
|
56
|
-
```bash
|
|
57
|
-
pnpm validate-tools
|
|
58
|
-
# Lists all loaded tools
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
2. Check tools directory:
|
|
62
|
-
```bash
|
|
63
|
-
# Ensure tools/calculator/definition.yaml exists
|
|
64
|
-
ls -la tools/calculator/definition.yaml
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
3. Verify tool definition:
|
|
68
|
-
```bash
|
|
69
|
-
pnpm validate-tools
|
|
70
|
-
# Shows validation errors if YAML is invalid
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Q: Invalid parameters error
|
|
74
|
-
|
|
75
|
-
**Error**: `Tool validation failed: Missing required parameter: operation`
|
|
76
|
-
|
|
77
|
-
**Solutions**:
|
|
78
|
-
1. Check tool parameters:
|
|
79
|
-
```typescript
|
|
80
|
-
const tool = matimoInstance.getTool('calculator');
|
|
81
|
-
console.log(tool.parameters); // See required fields
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
2. Verify your input matches schema:
|
|
85
|
-
```typescript
|
|
86
|
-
// ❌ Wrong
|
|
87
|
-
await m.execute('calculator', { value: 5 });
|
|
88
|
-
|
|
89
|
-
// ✅ Correct
|
|
90
|
-
await m.execute('calculator', {
|
|
91
|
-
operation: 'add',
|
|
92
|
-
a: 5,
|
|
93
|
-
b: 3
|
|
94
|
-
});
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
3. Check tool spec:
|
|
98
|
-
```bash
|
|
99
|
-
cat tools/calculator/definition.yaml | grep -A 20 "parameters:"
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Q: HTTP tool returns 401 Unauthorized
|
|
103
|
-
|
|
104
|
-
**Error**: `HTTP 401: Unauthorized`
|
|
105
|
-
|
|
106
|
-
**Common causes**:
|
|
107
|
-
1. Missing OAuth token:
|
|
108
|
-
```bash
|
|
109
|
-
# Set required tokens
|
|
110
|
-
export GMAIL_ACCESS_TOKEN=your_token
|
|
111
|
-
export GITHUB_TOKEN=your_token
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
2. Expired token:
|
|
115
|
-
```typescript
|
|
116
|
-
// Token needs refresh
|
|
117
|
-
const newToken = await oauth2Handler.refreshTokenIfNeeded(
|
|
118
|
-
userId,
|
|
119
|
-
currentToken
|
|
120
|
-
);
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
3. Wrong token format:
|
|
124
|
-
```typescript
|
|
125
|
-
// Verify token is Bearer token, not full "Bearer token"
|
|
126
|
-
const token = process.env.GMAIL_ACCESS_TOKEN;
|
|
127
|
-
// Should be: "ya29.abc123..." not "Bearer ya29.abc123..."
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Q: Command executor fails
|
|
131
|
-
|
|
132
|
-
**Error**: `Command not found: node` or shell command fails
|
|
133
|
-
|
|
134
|
-
**Solutions**:
|
|
135
|
-
1. Verify command exists:
|
|
136
|
-
```bash
|
|
137
|
-
which node
|
|
138
|
-
which python
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
2. Check working directory:
|
|
142
|
-
```yaml
|
|
143
|
-
execution:
|
|
144
|
-
type: command
|
|
145
|
-
command: ./script.sh
|
|
146
|
-
cwd: /path/to/directory # Ensure this exists
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
3. Test command manually:
|
|
150
|
-
```bash
|
|
151
|
-
# Test the exact command
|
|
152
|
-
node calculator.js --op add 5 3
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## OAuth2 & Authentication
|
|
158
|
-
|
|
159
|
-
### Q: OAuth token missing error
|
|
160
|
-
|
|
161
|
-
**Error**: `Missing OAuth token for provider: google`
|
|
162
|
-
|
|
163
|
-
**Solutions**:
|
|
164
|
-
1. Set environment variables:
|
|
165
|
-
```bash
|
|
166
|
-
export GMAIL_ACCESS_TOKEN=ya29.your_token_here
|
|
167
|
-
export GITHUB_TOKEN=ghp_your_token_here
|
|
168
|
-
export SLACK_TOKEN=xoxb-your_token_here
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
2. Verify token is set:
|
|
172
|
-
```typescript
|
|
173
|
-
console.log(process.env.GMAIL_ACCESS_TOKEN);
|
|
174
|
-
// Should print your token, not undefined
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
3. Check tool authentication config:
|
|
178
|
-
```yaml
|
|
179
|
-
authentication:
|
|
180
|
-
type: oauth2
|
|
181
|
-
provider: google # Must match provider definition
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Q: OAuth provider configuration not found
|
|
185
|
-
|
|
186
|
-
**Error**: `Provider definition not found: github`
|
|
187
|
-
|
|
188
|
-
**Solutions**:
|
|
189
|
-
1. Verify provider YAML exists:
|
|
190
|
-
```bash
|
|
191
|
-
ls tools/github/definition.yaml
|
|
192
|
-
# Should exist and contain: type: provider
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
2. Check provider name:
|
|
196
|
-
```bash
|
|
197
|
-
pnpm validate-tools
|
|
198
|
-
# Lists all loaded providers
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
3. Verify provider YAML format:
|
|
202
|
-
```bash
|
|
203
|
-
cat tools/github/definition.yaml | head -5
|
|
204
|
-
# Should show: type: provider
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Q: Bearer token format issue
|
|
208
|
-
|
|
209
|
-
**Error**: `Invalid authorization header`
|
|
210
|
-
|
|
211
|
-
**Solutions**:
|
|
212
|
-
1. Use correct token format:
|
|
213
|
-
```bash
|
|
214
|
-
# ✅ Correct: Just the token
|
|
215
|
-
export GMAIL_ACCESS_TOKEN=ya29.abc123
|
|
216
|
-
|
|
217
|
-
# ❌ Wrong: Don't include "Bearer"
|
|
218
|
-
export GMAIL_ACCESS_TOKEN="Bearer ya29.abc123"
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
2. Verify token is actually a token:
|
|
222
|
-
```bash
|
|
223
|
-
echo $GMAIL_ACCESS_TOKEN | wc -c
|
|
224
|
-
# Should be > 20 characters
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
## Validation Errors
|
|
230
|
-
|
|
231
|
-
### Q: Schema validation failed
|
|
232
|
-
|
|
233
|
-
**Error**: `Tool schema validation failed: • execution: Required`
|
|
234
|
-
|
|
235
|
-
**Solutions**:
|
|
236
|
-
1. Check required fields in tool YAML:
|
|
237
|
-
```yaml
|
|
238
|
-
# ✅ All required fields
|
|
239
|
-
name: my-tool
|
|
240
|
-
version: 1.0.0
|
|
241
|
-
description: Tool description
|
|
242
|
-
parameters: {}
|
|
243
|
-
execution:
|
|
244
|
-
type: http
|
|
245
|
-
method: GET
|
|
246
|
-
url: https://api.example.com
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
2. Run validation:
|
|
250
|
-
```bash
|
|
251
|
-
pnpm validate-tools
|
|
252
|
-
# Shows exact field errors
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Q: Invalid execution type
|
|
256
|
-
|
|
257
|
-
**Error**: `Invalid execution type: webhook`
|
|
258
|
-
|
|
259
|
-
**Solutions**:
|
|
260
|
-
Supported execution types are:
|
|
261
|
-
- ✅ `command` - Shell commands
|
|
262
|
-
- ✅ `http` - HTTP requests
|
|
263
|
-
|
|
264
|
-
Unsupported (coming in future releases):
|
|
265
|
-
- 🔜 `webhook` - v0.3.0
|
|
266
|
-
- 🔜 `grpc` - Future
|
|
267
|
-
- 🔜 `database` - Future
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
## Testing & Development
|
|
272
|
-
|
|
273
|
-
### Q: Tests fail locally
|
|
274
|
-
|
|
275
|
-
**Error**: Tests pass in CI but fail locally
|
|
276
|
-
|
|
277
|
-
**Solutions**:
|
|
278
|
-
1. Clear cache and reinstall:
|
|
279
|
-
```bash
|
|
280
|
-
pnpm clean
|
|
281
|
-
rm -rf node_modules pnpm-lock.yaml
|
|
282
|
-
pnpm install
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
2. Run specific test:
|
|
286
|
-
```bash
|
|
287
|
-
pnpm test -- --testNamePattern="oauth2"
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
3. Debug test:
|
|
291
|
-
```bash
|
|
292
|
-
node --inspect-brk ./node_modules/.bin/jest --runInBand
|
|
293
|
-
# Then open chrome://inspect
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### Q: Linting errors
|
|
297
|
-
|
|
298
|
-
**Error**: `ESLint errors found`
|
|
299
|
-
|
|
300
|
-
**Solution**:
|
|
301
|
-
```bash
|
|
302
|
-
# Fix automatically
|
|
303
|
-
pnpm lint:fix
|
|
304
|
-
|
|
305
|
-
# Then format
|
|
306
|
-
pnpm format
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## Performance Issues
|
|
312
|
-
|
|
313
|
-
### Q: Tool execution is slow
|
|
314
|
-
|
|
315
|
-
**Possible causes**:
|
|
316
|
-
1. Network latency (HTTP tools)
|
|
317
|
-
2. OAuth token refresh overhead
|
|
318
|
-
3. Tool parameter validation
|
|
319
|
-
|
|
320
|
-
**Solutions**:
|
|
321
|
-
```typescript
|
|
322
|
-
// Time tool execution
|
|
323
|
-
console.time('tool-execution');
|
|
324
|
-
const result = await m.execute('gmail-send-email', params);
|
|
325
|
-
console.timeEnd('tool-execution');
|
|
326
|
-
|
|
327
|
-
// Optimize: Cache tools
|
|
328
|
-
const tool = m.getTool('gmail-send-email');
|
|
329
|
-
const result = await executor.execute(tool, params);
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Q: High memory usage
|
|
333
|
-
|
|
334
|
-
**Solutions**:
|
|
335
|
-
```typescript
|
|
336
|
-
// Don't load all tools if not needed
|
|
337
|
-
const tools = m.listTools();
|
|
338
|
-
const filtered = tools.filter(t => t.tags.includes('gmail'));
|
|
339
|
-
|
|
340
|
-
// Or use specific tool
|
|
341
|
-
const tool = m.getTool('gmail-send-email');
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
---
|
|
345
|
-
|
|
346
|
-
## v0.1.0-alpha.1 Specific
|
|
347
|
-
|
|
348
|
-
### Features NOT in this version
|
|
349
|
-
|
|
350
|
-
These are planned for future releases:
|
|
351
|
-
|
|
352
|
-
- 🔜 **CLI** - `matimo` command (v0.2.0)
|
|
353
|
-
- 🔜 **MCP Server** - Claude integration (v0.2.0)
|
|
354
|
-
- 🔜 **REST API** - HTTP API (v0.3.0)
|
|
355
|
-
- 🔜 **Python SDK** - Python support (v0.3.0)
|
|
356
|
-
- 🔜 **Docker** - Containerization (v0.3.0)
|
|
357
|
-
- 🔜 **Rate Limiting** - Token bucket (v0.2.0)
|
|
358
|
-
- 🔜 **Health Monitoring** - Schema drift detection (v0.2.0)
|
|
359
|
-
|
|
360
|
-
See [FUTURE_RELEASES.md](../FUTURE_RELEASES.md) for details.
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
## Getting Help
|
|
365
|
-
|
|
366
|
-
Still stuck? Try:
|
|
367
|
-
|
|
368
|
-
1. **GitHub Issues**: [Search issues](https://github.com/tallclub/matimo/issues)
|
|
369
|
-
2. **GitHub Discussions**: [Ask questions](https://github.com/tallclub/matimo/discussions)
|
|
370
|
-
3. **Documentation**: [Full docs](../)
|
|
371
|
-
4. **Examples**: [See examples](../../examples/)
|
|
372
|
-
|
|
373
|
-
---
|
|
374
|
-
|
|
375
|
-
## Report a Bug
|
|
376
|
-
|
|
377
|
-
Found a bug? Help us fix it:
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
# 1. Check if issue exists
|
|
381
|
-
# Go to https://github.com/tallclub/matimo/issues
|
|
382
|
-
|
|
383
|
-
# 2. If not, create new issue with:
|
|
384
|
-
# - Matimo version: (run: npm list matimo)
|
|
385
|
-
# - Node.js version: (run: node --version)
|
|
386
|
-
# - Steps to reproduce
|
|
387
|
-
# - Expected vs actual behavior
|
|
388
|
-
# - Error message/stack trace
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
Thank you for helping improve Matimo! 🙏
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
# Authentication Guide
|
|
2
|
-
|
|
3
|
-
Setup OAuth2 for tools that require user authentication.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Some tools require authentication (e.g., Gmail, GitHub, Slack). Matimo handles OAuth2 token injection automatically.
|
|
8
|
-
|
|
9
|
-
**How it works:**
|
|
10
|
-
1. Obtain OAuth2 token from provider (Google, GitHub, Slack)
|
|
11
|
-
2. Set token in environment variable
|
|
12
|
-
3. Matimo automatically injects token into tool execution
|
|
13
|
-
4. Execute tool normally
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Quick Setup (Gmail Example)
|
|
18
|
-
|
|
19
|
-
### 1. Get OAuth2 Token
|
|
20
|
-
|
|
21
|
-
From Google Cloud Console:
|
|
22
|
-
```bash
|
|
23
|
-
# Set your Gmail access token
|
|
24
|
-
export GMAIL_ACCESS_TOKEN="ya29.a0AfH6SMBx..."
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
For other providers, see [Full OAuth2 Guide](../architecture/OAUTH.md).
|
|
28
|
-
|
|
29
|
-
### 2. Execute OAuth2 Tool
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { matimo } from 'matimo';
|
|
33
|
-
|
|
34
|
-
const m = await matimo.init('./tools');
|
|
35
|
-
|
|
36
|
-
// Token automatically injected from GMAIL_ACCESS_TOKEN env var
|
|
37
|
-
const result = await m.execute('gmail-send-email', {
|
|
38
|
-
to: 'user@example.com',
|
|
39
|
-
subject: 'Hello from Matimo',
|
|
40
|
-
body: 'This email was sent via Matimo!'
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
console.log('✅ Email sent:', result.messageId);
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
No additional code needed — Matimo handles token injection.
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Supported Providers
|
|
51
|
-
|
|
52
|
-
| Provider | Token Env Var | Scope |
|
|
53
|
-
|----------|---------------|-------|
|
|
54
|
-
| **Google (Gmail)** | `GMAIL_ACCESS_TOKEN` | `https://www.googleapis.com/auth/gmail.send` |
|
|
55
|
-
| **GitHub** | `GITHUB_ACCESS_TOKEN` | `repo, gist` |
|
|
56
|
-
| **Slack** | `SLACK_ACCESS_TOKEN` | `chat:write, users:read` |
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Environment Variable Pattern
|
|
61
|
-
|
|
62
|
-
Matimo uses a naming convention for OAuth2 tokens:
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
{PROVIDER}_{CREDENTIAL_TYPE}_TOKEN
|
|
66
|
-
|
|
67
|
-
Examples:
|
|
68
|
-
GMAIL_ACCESS_TOKEN
|
|
69
|
-
GITHUB_ACCESS_TOKEN
|
|
70
|
-
SLACK_ACCESS_TOKEN
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Check tool documentation for exact variable name:
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
const tool = m.getTool('gmail-send-email');
|
|
77
|
-
console.log(tool.authentication);
|
|
78
|
-
// { type: 'oauth2', provider: 'google', ... }
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Getting OAuth2 Tokens
|
|
84
|
-
|
|
85
|
-
### Google (Gmail)
|
|
86
|
-
|
|
87
|
-
1. Visit [Google Cloud Console](https://console.cloud.google.com)
|
|
88
|
-
2. Create OAuth2 credentials (type: Web application)
|
|
89
|
-
3. Get access token:
|
|
90
|
-
```bash
|
|
91
|
-
curl -X POST https://oauth2.googleapis.com/token \
|
|
92
|
-
-d "client_id=YOUR_CLIENT_ID&client_secret=YOUR_SECRET&grant_type=refresh_token&refresh_token=YOUR_REFRESH_TOKEN"
|
|
93
|
-
```
|
|
94
|
-
4. Set environment variable:
|
|
95
|
-
```bash
|
|
96
|
-
export GMAIL_ACCESS_TOKEN="ya29.a0AfH6SMBx..."
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### GitHub
|
|
100
|
-
|
|
101
|
-
1. Visit [GitHub Settings → Developer Settings → Personal Tokens](https://github.com/settings/tokens)
|
|
102
|
-
2. Create Personal Access Token with `repo` and `gist` scopes
|
|
103
|
-
3. Set environment variable:
|
|
104
|
-
```bash
|
|
105
|
-
export GITHUB_ACCESS_TOKEN="ghp_xxxxx..."
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Slack
|
|
109
|
-
|
|
110
|
-
1. Visit [Slack App Configuration](https://api.slack.com/apps)
|
|
111
|
-
2. Create new app or select existing
|
|
112
|
-
3. Install app to workspace
|
|
113
|
-
4. Copy Bot Token or OAuth token
|
|
114
|
-
5. Set environment variable:
|
|
115
|
-
```bash
|
|
116
|
-
export SLACK_ACCESS_TOKEN="xoxb-..."
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Verify Authentication
|
|
122
|
-
|
|
123
|
-
### Check Token
|
|
124
|
-
|
|
125
|
-
```typescript
|
|
126
|
-
// Verify token is set
|
|
127
|
-
const token = process.env.GMAIL_ACCESS_TOKEN;
|
|
128
|
-
if (!token) {
|
|
129
|
-
console.error('❌ GMAIL_ACCESS_TOKEN not set');
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
console.log('✅ Token found');
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Test Execution
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
try {
|
|
139
|
-
const result = await m.execute('gmail-send-email', {
|
|
140
|
-
to: 'test@example.com',
|
|
141
|
-
subject: 'Test',
|
|
142
|
-
body: 'Test email'
|
|
143
|
-
});
|
|
144
|
-
console.log('✅ Authentication successful');
|
|
145
|
-
} catch (error) {
|
|
146
|
-
if (error.code === 'EXECUTION_FAILED' && error.details?.statusCode === 401) {
|
|
147
|
-
console.error('❌ Token invalid or expired');
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## Troubleshooting
|
|
155
|
-
|
|
156
|
-
### Token Not Found
|
|
157
|
-
|
|
158
|
-
**Error:**
|
|
159
|
-
```
|
|
160
|
-
Tool execution failed: Missing GMAIL_ACCESS_TOKEN environment variable
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
**Solution:**
|
|
164
|
-
```bash
|
|
165
|
-
# Verify token is set
|
|
166
|
-
echo $GMAIL_ACCESS_TOKEN
|
|
167
|
-
|
|
168
|
-
# If empty, set it
|
|
169
|
-
export GMAIL_ACCESS_TOKEN="your_token_here"
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Token Expired
|
|
173
|
-
|
|
174
|
-
**Error:**
|
|
175
|
-
```
|
|
176
|
-
401 Unauthorized: Invalid Credentials
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
**Solution:**
|
|
180
|
-
1. Refresh your OAuth2 token from provider
|
|
181
|
-
2. Update environment variable
|
|
182
|
-
3. Retry execution
|
|
183
|
-
|
|
184
|
-
### Invalid Scopes
|
|
185
|
-
|
|
186
|
-
**Error:**
|
|
187
|
-
```
|
|
188
|
-
Access denied: Insufficient scopes
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
**Solution:**
|
|
192
|
-
1. Check required scopes in tool documentation
|
|
193
|
-
2. Generate new token with required scopes
|
|
194
|
-
3. Update environment variable
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## Security Best Practices
|
|
199
|
-
|
|
200
|
-
⚠️ **Never commit tokens to git**
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
# ❌ DON'T do this
|
|
204
|
-
export GITHUB_TOKEN="ghp_xxxxx" # DO NOT COMMIT
|
|
205
|
-
|
|
206
|
-
# ✅ DO this instead
|
|
207
|
-
# Set in your .env file (add .env to .gitignore)
|
|
208
|
-
# Or use your shell's secure storage
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
Store tokens securely:
|
|
212
|
-
- Environment variables (recommended)
|
|
213
|
-
- `.env` file (add to `.gitignore`)
|
|
214
|
-
- System keychain (macOS Keychain, Windows Credential Manager)
|
|
215
|
-
- CI/CD secrets (GitHub Actions, etc.)
|
|
216
|
-
|
|
217
|
-
---
|
|
218
|
-
|
|
219
|
-
## Advanced: Multiple Providers
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
const m = await matimo.init('./tools');
|
|
223
|
-
|
|
224
|
-
// Execute Gmail tool
|
|
225
|
-
const email = await m.execute('gmail-send-email', {
|
|
226
|
-
to: 'user@example.com',
|
|
227
|
-
subject: 'From Matimo',
|
|
228
|
-
body: 'Test'
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
// Execute GitHub tool
|
|
232
|
-
const issue = await m.execute('github-create-issue', {
|
|
233
|
-
owner: 'tallclub',
|
|
234
|
-
repo: 'matimo',
|
|
235
|
-
title: 'Feature request',
|
|
236
|
-
body: 'Please add more tools'
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// Execute Slack tool
|
|
240
|
-
const msg = await m.execute('slack-send-message', {
|
|
241
|
-
channel: '#general',
|
|
242
|
-
text: 'Hello from Matimo!'
|
|
243
|
-
});
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
Each tool automatically uses the correct token based on its provider.
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## Next Steps
|
|
251
|
-
|
|
252
|
-
- **Full OAuth2 Details**: [OAuth2 Implementation Guide](../architecture/OAUTH.md)
|
|
253
|
-
- **Tool Discovery**: [Find Tools](./TOOL_DISCOVERY.md)
|
|
254
|
-
- **Error Handling**: [Error Codes Reference](../api-reference/ERRORS.md)
|
|
255
|
-
|