matimo 0.1.0-alpha.2 → 0.1.0-alpha.4

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.
Files changed (149) hide show
  1. package/README.md +128 -548
  2. package/package.json +24 -28
  3. package/packages/cli/bin/matimo.cjs +26 -0
  4. package/packages/cli/dist/cli.d.ts +6 -0
  5. package/packages/cli/dist/cli.d.ts.map +1 -0
  6. package/packages/cli/dist/cli.js +95 -0
  7. package/packages/cli/dist/cli.js.map +1 -0
  8. package/packages/cli/dist/commands/install.d.ts +6 -0
  9. package/packages/cli/dist/commands/install.d.ts.map +1 -0
  10. package/packages/cli/dist/commands/install.js +48 -0
  11. package/packages/cli/dist/commands/install.js.map +1 -0
  12. package/packages/cli/dist/commands/list.d.ts +9 -0
  13. package/packages/cli/dist/commands/list.d.ts.map +1 -0
  14. package/packages/cli/dist/commands/list.js +70 -0
  15. package/packages/cli/dist/commands/list.js.map +1 -0
  16. package/packages/cli/dist/commands/search.d.ts +2 -0
  17. package/packages/cli/dist/commands/search.d.ts.map +1 -0
  18. package/packages/cli/dist/commands/search.js +148 -0
  19. package/packages/cli/dist/commands/search.js.map +1 -0
  20. package/packages/core/dist/src/auth/oauth2-config.d.ts.map +1 -0
  21. package/packages/core/dist/src/auth/oauth2-config.js.map +1 -0
  22. package/packages/core/dist/src/auth/oauth2-handler.d.ts.map +1 -0
  23. package/packages/core/dist/src/auth/oauth2-handler.js.map +1 -0
  24. package/packages/core/dist/src/auth/oauth2-provider-loader.d.ts.map +1 -0
  25. package/packages/core/dist/src/auth/oauth2-provider-loader.js.map +1 -0
  26. package/{dist → packages/core/dist/src}/core/schema.d.ts +12 -2
  27. package/packages/core/dist/src/core/schema.d.ts.map +1 -0
  28. package/{dist → packages/core/dist/src}/core/schema.js +20 -6
  29. package/packages/core/dist/src/core/schema.js.map +1 -0
  30. package/{dist → packages/core/dist/src}/core/tool-loader.d.ts +16 -0
  31. package/packages/core/dist/src/core/tool-loader.d.ts.map +1 -0
  32. package/packages/core/dist/src/core/tool-loader.js +205 -0
  33. package/packages/core/dist/src/core/tool-loader.js.map +1 -0
  34. package/packages/core/dist/src/core/tool-registry.d.ts.map +1 -0
  35. package/{dist → packages/core/dist/src}/core/tool-registry.js +5 -1
  36. package/packages/core/dist/src/core/tool-registry.js.map +1 -0
  37. package/{dist → packages/core/dist/src}/core/types.d.ts +15 -1
  38. package/packages/core/dist/src/core/types.d.ts.map +1 -0
  39. package/{dist → packages/core/dist/src}/core/types.js.map +1 -1
  40. package/packages/core/dist/src/decorators/index.d.ts.map +1 -0
  41. package/packages/core/dist/src/decorators/index.js.map +1 -0
  42. package/packages/core/dist/src/decorators/tool-decorator.d.ts.map +1 -0
  43. package/{dist → packages/core/dist/src}/decorators/tool-decorator.js +7 -4
  44. package/packages/core/dist/src/decorators/tool-decorator.js.map +1 -0
  45. package/packages/core/dist/src/encodings/parameter-encoding.d.ts.map +1 -0
  46. package/{dist → packages/core/dist/src}/encodings/parameter-encoding.js +9 -2
  47. package/packages/core/dist/src/encodings/parameter-encoding.js.map +1 -0
  48. package/packages/core/dist/src/errors/matimo-error.d.ts.map +1 -0
  49. package/packages/core/dist/src/errors/matimo-error.js.map +1 -0
  50. package/packages/core/dist/src/executors/command-executor.d.ts.map +1 -0
  51. package/{dist → packages/core/dist/src}/executors/command-executor.js +5 -1
  52. package/packages/core/dist/src/executors/command-executor.js.map +1 -0
  53. package/packages/core/dist/src/executors/function-executor.d.ts +23 -0
  54. package/packages/core/dist/src/executors/function-executor.d.ts.map +1 -0
  55. package/packages/core/dist/src/executors/function-executor.js +164 -0
  56. package/packages/core/dist/src/executors/function-executor.js.map +1 -0
  57. package/packages/core/dist/src/executors/http-executor.d.ts.map +1 -0
  58. package/{dist → packages/core/dist/src}/executors/http-executor.js +5 -1
  59. package/packages/core/dist/src/executors/http-executor.js.map +1 -0
  60. package/{dist → packages/core/dist/src}/index.d.ts +5 -1
  61. package/packages/core/dist/src/index.d.ts.map +1 -0
  62. package/{dist → packages/core/dist/src}/index.js +3 -0
  63. package/packages/core/dist/src/index.js.map +1 -0
  64. package/packages/core/dist/src/integrations/langchain.d.ts +46 -0
  65. package/packages/core/dist/src/integrations/langchain.d.ts.map +1 -0
  66. package/packages/core/dist/src/integrations/langchain.js +197 -0
  67. package/packages/core/dist/src/integrations/langchain.js.map +1 -0
  68. package/{dist → packages/core/dist/src}/matimo-instance.d.ts +30 -4
  69. package/packages/core/dist/src/matimo-instance.d.ts.map +1 -0
  70. package/{dist → packages/core/dist/src}/matimo-instance.js +63 -10
  71. package/packages/core/dist/src/matimo-instance.js.map +1 -0
  72. package/packages/core/dist/tools/calculator/calculator.d.ts +26 -0
  73. package/packages/core/dist/tools/calculator/calculator.d.ts.map +1 -0
  74. package/packages/core/dist/tools/calculator/calculator.js +104 -0
  75. package/packages/core/dist/tools/calculator/calculator.js.map +1 -0
  76. package/packages/core/dist/tsconfig.tsbuildinfo +1 -0
  77. package/dist/auth/oauth2-config.d.ts.map +0 -1
  78. package/dist/auth/oauth2-config.js.map +0 -1
  79. package/dist/auth/oauth2-handler.d.ts.map +0 -1
  80. package/dist/auth/oauth2-handler.js.map +0 -1
  81. package/dist/auth/oauth2-provider-loader.d.ts.map +0 -1
  82. package/dist/auth/oauth2-provider-loader.js.map +0 -1
  83. package/dist/core/schema.d.ts.map +0 -1
  84. package/dist/core/schema.js.map +0 -1
  85. package/dist/core/tool-loader.d.ts.map +0 -1
  86. package/dist/core/tool-loader.js +0 -98
  87. package/dist/core/tool-loader.js.map +0 -1
  88. package/dist/core/tool-registry.d.ts.map +0 -1
  89. package/dist/core/tool-registry.js.map +0 -1
  90. package/dist/core/types.d.ts.map +0 -1
  91. package/dist/decorators/index.d.ts.map +0 -1
  92. package/dist/decorators/index.js.map +0 -1
  93. package/dist/decorators/tool-decorator.d.ts.map +0 -1
  94. package/dist/decorators/tool-decorator.js.map +0 -1
  95. package/dist/encodings/parameter-encoding.d.ts.map +0 -1
  96. package/dist/encodings/parameter-encoding.js.map +0 -1
  97. package/dist/errors/matimo-error.d.ts.map +0 -1
  98. package/dist/errors/matimo-error.js.map +0 -1
  99. package/dist/executors/command-executor.d.ts.map +0 -1
  100. package/dist/executors/command-executor.js.map +0 -1
  101. package/dist/executors/http-executor.d.ts.map +0 -1
  102. package/dist/executors/http-executor.js.map +0 -1
  103. package/dist/index.d.ts.map +0 -1
  104. package/dist/index.js.map +0 -1
  105. package/dist/matimo-instance.d.ts.map +0 -1
  106. package/dist/matimo-instance.js.map +0 -1
  107. package/docs/Gemfile +0 -5
  108. package/docs/RELEASES.md +0 -90
  109. package/docs/ROADMAP.md +0 -138
  110. package/docs/_config.yml +0 -27
  111. package/docs/api-reference/ERRORS.md +0 -445
  112. package/docs/api-reference/SDK.md +0 -582
  113. package/docs/api-reference/TYPES.md +0 -415
  114. package/docs/architecture/OAUTH.md +0 -1366
  115. package/docs/architecture/OVERVIEW.md +0 -564
  116. package/docs/assets/logo.png +0 -0
  117. package/docs/community/COMMIT_GUIDELINES.md +0 -552
  118. package/docs/framework-integrations/LANGCHAIN.md +0 -286
  119. package/docs/getting-started/QUICK_START.md +0 -212
  120. package/docs/getting-started/YOUR_FIRST_TOOL.md +0 -217
  121. package/docs/getting-started/installation.md +0 -124
  122. package/docs/index.md +0 -289
  123. package/docs/tool-development/DECORATOR_GUIDE.md +0 -633
  124. package/docs/tool-development/OAUTH_LINK.md +0 -5
  125. package/docs/tool-development/PROVIDER_CONFIGURATION.md +0 -458
  126. package/docs/tool-development/TESTING.md +0 -412
  127. package/docs/tool-development/TOOL_SPECIFICATION.md +0 -793
  128. package/docs/tool-development/YAML_TOOLS.md +0 -65
  129. package/docs/troubleshooting/FAQ.md +0 -391
  130. package/docs/user-guide/AUTHENTICATION.md +0 -255
  131. package/docs/user-guide/DEVELOPMENT_STANDARDS.md +0 -698
  132. package/docs/user-guide/SDK_PATTERNS.md +0 -316
  133. package/docs/user-guide/TOOL_DISCOVERY.md +0 -209
  134. /package/{dist → packages/core/dist/src}/auth/oauth2-config.d.ts +0 -0
  135. /package/{dist → packages/core/dist/src}/auth/oauth2-config.js +0 -0
  136. /package/{dist → packages/core/dist/src}/auth/oauth2-handler.d.ts +0 -0
  137. /package/{dist → packages/core/dist/src}/auth/oauth2-handler.js +0 -0
  138. /package/{dist → packages/core/dist/src}/auth/oauth2-provider-loader.d.ts +0 -0
  139. /package/{dist → packages/core/dist/src}/auth/oauth2-provider-loader.js +0 -0
  140. /package/{dist → packages/core/dist/src}/core/tool-registry.d.ts +0 -0
  141. /package/{dist → packages/core/dist/src}/core/types.js +0 -0
  142. /package/{dist → packages/core/dist/src}/decorators/index.d.ts +0 -0
  143. /package/{dist → packages/core/dist/src}/decorators/index.js +0 -0
  144. /package/{dist → packages/core/dist/src}/decorators/tool-decorator.d.ts +0 -0
  145. /package/{dist → packages/core/dist/src}/encodings/parameter-encoding.d.ts +0 -0
  146. /package/{dist → packages/core/dist/src}/errors/matimo-error.d.ts +0 -0
  147. /package/{dist → packages/core/dist/src}/errors/matimo-error.js +0 -0
  148. /package/{dist → packages/core/dist/src}/executors/command-executor.d.ts +0 -0
  149. /package/{dist → packages/core/dist/src}/executors/http-executor.d.ts +0 -0
@@ -1,793 +0,0 @@
1
- # Tool Specification — YAML Schema
2
-
3
- Complete guide to writing Matimo tools in YAML.
4
-
5
- ## Overview
6
-
7
- Every Matimo tool is defined in a YAML file with a standardized schema. Tools define:
8
-
9
- - **Metadata** — Name, version, description
10
- - **Parameters** — What inputs the tool accepts
11
- - **Execution** — How the tool runs (command, HTTP, script)
12
- - **Output** — What the tool returns
13
- - **Authentication** — How to authenticate (if needed)
14
- - **Error Handling** — Retry and recovery logic
15
-
16
- ---
17
-
18
- ## Basic Structure
19
-
20
- ```yaml
21
- name: tool-name
22
- description: Brief description of what the tool does
23
- version: "1.0.0"
24
-
25
- parameters:
26
- # Define input parameters here
27
-
28
- execution:
29
- # Define how to execute the tool
30
-
31
- output_schema:
32
- # Define the output format
33
-
34
- authentication: # Optional
35
- # Define authentication if needed
36
-
37
- error_handling: # Optional
38
- # Define retry and error recovery logic
39
- ```
40
-
41
- ---
42
-
43
- ## Metadata
44
-
45
- ### name
46
-
47
- Unique tool identifier. Use lowercase, kebab-case.
48
-
49
- ```yaml
50
- name: github-create-issue
51
- name: slack-send-message
52
- name: calculator
53
- ```
54
-
55
- **Rules:**
56
- - Lowercase only
57
- - Kebab-case (hyphens, no spaces)
58
- - Globally unique
59
- - 3-50 characters
60
-
61
- ### description
62
-
63
- What the tool does. One sentence.
64
-
65
- ```yaml
66
- description: Create a new GitHub issue in a repository
67
- description: Send a message to a Slack channel
68
- description: Perform basic math calculations
69
- ```
70
-
71
- ### version
72
-
73
- Semantic versioning: `MAJOR.MINOR.PATCH`
74
-
75
- ```yaml
76
- version: "1.0.0"
77
- version: "2.1.3"
78
- ```
79
-
80
- ---
81
-
82
- ## Parameters
83
-
84
- Define what inputs the tool accepts.
85
-
86
- ### Basic Structure
87
-
88
- ```yaml
89
- parameters:
90
- param_name:
91
- type: string|number|boolean|object|array
92
- description: What this parameter does
93
- required: true|false
94
- ```
95
-
96
- ### Parameter Properties
97
-
98
- #### type (required)
99
-
100
- Parameter data type.
101
-
102
- ```yaml
103
- type: string # Text input
104
- type: number # Integer or float
105
- type: boolean # True/false
106
- type: object # JSON object
107
- type: array # Array of items
108
- ```
109
-
110
- #### description (required)
111
-
112
- What this parameter does.
113
-
114
- ```yaml
115
- description: GitHub repository in owner/repo format
116
- description: Number of items to fetch
117
- description: Enable verbose logging
118
- ```
119
-
120
- #### required (required)
121
-
122
- Whether parameter is mandatory.
123
-
124
- ```yaml
125
- required: true # Must be provided
126
- required: false # Optional
127
- ```
128
-
129
- #### default (optional)
130
-
131
- Default value if not provided.
132
-
133
- ```yaml
134
- default: 10
135
- default: "main"
136
- default: false
137
- ```
138
-
139
- #### enum (optional)
140
-
141
- List of allowed values.
142
-
143
- ```yaml
144
- enum:
145
- - add
146
- - subtract
147
- - multiply
148
- - divide
149
- ```
150
-
151
- #### validation (optional)
152
-
153
- Constraints on parameter values.
154
-
155
- ```yaml
156
- # For strings:
157
- validation:
158
- minLength: 1
159
- maxLength: 100
160
- pattern: "^[a-z]+$" # Regex pattern
161
-
162
- # For numbers:
163
- validation:
164
- min: 0
165
- max: 100
166
-
167
- # For arrays:
168
- validation:
169
- minItems: 1
170
- maxItems: 10
171
- ```
172
-
173
- ### Examples
174
-
175
- #### String Parameter
176
-
177
- ```yaml
178
- parameters:
179
- message:
180
- type: string
181
- description: Message to send
182
- required: true
183
- validation:
184
- minLength: 1
185
- maxLength: 1000
186
- ```
187
-
188
- #### Number Parameter with Constraints
189
-
190
- ```yaml
191
- parameters:
192
- count:
193
- type: number
194
- description: Number of items to fetch
195
- required: false
196
- default: 10
197
- validation:
198
- min: 1
199
- max: 100
200
- ```
201
-
202
- #### Choice Parameter
203
-
204
- ```yaml
205
- parameters:
206
- operation:
207
- type: string
208
- description: Math operation to perform
209
- required: true
210
- enum:
211
- - add
212
- - subtract
213
- - multiply
214
- - divide
215
- ```
216
-
217
- #### Object Parameter
218
-
219
- ```yaml
220
- parameters:
221
- config:
222
- type: object
223
- description: Configuration object
224
- required: true
225
- properties:
226
- timeout:
227
- type: number
228
- retries:
229
- type: number
230
- ```
231
-
232
- ---
233
-
234
- ## Execution
235
-
236
- Define how the tool runs.
237
-
238
- ### Type: Command
239
-
240
- Execute shell commands.
241
-
242
- ```yaml
243
- execution:
244
- type: command
245
- command: node
246
- args:
247
- - script.js
248
- - "{param1}"
249
- - "{param2}"
250
- timeout_ms: 5000
251
- env:
252
- CUSTOM_VAR: value
253
- ```
254
-
255
- **Fields:**
256
- - `command` (string, required) — Command to execute
257
- - `args` (array, optional) — Command arguments with parameter substitution
258
- - `timeout_ms` (number, optional, default: 30000) — Timeout in milliseconds
259
- - `env` (object, optional) — Environment variables
260
-
261
- **Parameter Substitution:**
262
-
263
- Use `{param_name}` to reference parameters.
264
-
265
- ```yaml
266
- args:
267
- - "--operation={operation}"
268
- - "{a}"
269
- - "{b}"
270
- ```
271
-
272
- When executed with `{ operation: 'add', a: 5, b: 3 }`, becomes:
273
- ```
274
- --operation=add 5 3
275
- ```
276
-
277
- ### Type: HTTP
278
-
279
- Make HTTP requests.
280
-
281
- ```yaml
282
- execution:
283
- type: http
284
- method: POST
285
- url: "https://api.example.com/endpoint"
286
- headers:
287
- Content-Type: application/json
288
- Authorization: "Bearer {api_key}"
289
- auth:
290
- type: bearer
291
- secret_env_var: MATIMO_API_KEY
292
- timeout_ms: 10000
293
- ```
294
-
295
- **Fields:**
296
- - `method` (string, required) — HTTP method: GET, POST, PUT, DELETE, PATCH
297
- - `url` (string, required) — API endpoint URL with parameter substitution
298
- - `headers` (object, optional) — HTTP headers
299
- - `auth` (object, optional) — Authentication config (see Authentication section)
300
- - `timeout_ms` (number, optional, default: 30000) — Timeout in milliseconds
301
-
302
- **URL Templating:**
303
-
304
- ```yaml
305
- url: "https://api.github.com/repos/{owner}/{repo}/issues"
306
- ```
307
-
308
- When executed with `{ owner: 'tallclub', repo: 'matimo' }`:
309
- ```
310
- https://api.github.com/repos/tallclub/matimo/issues
311
- ```
312
-
313
- ### Type: Script
314
-
315
- Execute inline JavaScript/TypeScript.
316
-
317
- ```yaml
318
- execution:
319
- type: script
320
- language: javascript|typescript
321
- code: |
322
- return params.a + params.b;
323
- timeout_ms: 5000
324
- ```
325
-
326
- ---
327
-
328
- ## Output Schema
329
-
330
- Define what the tool returns.
331
-
332
- ```yaml
333
- output_schema:
334
- type: object
335
- properties:
336
- id:
337
- type: number
338
- name:
339
- type: string
340
- created_at:
341
- type: string
342
- required:
343
- - id
344
- - name
345
- ```
346
-
347
- ### Supported Types
348
-
349
- ```yaml
350
- type: object # JSON object
351
- type: array # Array of items
352
- type: string # Text
353
- type: number # Integer or float
354
- type: boolean # True/false
355
- ```
356
-
357
- ### Object Schema
358
-
359
- ```yaml
360
- type: object
361
- properties:
362
- field_name:
363
- type: string
364
- description: Field description
365
- field_count:
366
- type: number
367
- required:
368
- - field_name
369
- ```
370
-
371
- ### Array Schema
372
-
373
- ```yaml
374
- type: array
375
- items:
376
- type: object
377
- properties:
378
- id:
379
- type: number
380
- name:
381
- type: string
382
- ```
383
-
384
- ### Examples
385
-
386
- #### Simple Object
387
-
388
- ```yaml
389
- output_schema:
390
- type: object
391
- properties:
392
- result:
393
- type: number
394
- timestamp:
395
- type: string
396
- required:
397
- - result
398
- ```
399
-
400
- #### Array of Objects
401
-
402
- ```yaml
403
- output_schema:
404
- type: array
405
- items:
406
- type: object
407
- properties:
408
- id:
409
- type: number
410
- title:
411
- type: string
412
- author:
413
- type: string
414
- ```
415
-
416
- #### Nested Objects
417
-
418
- ```yaml
419
- output_schema:
420
- type: object
421
- properties:
422
- user:
423
- type: object
424
- properties:
425
- id:
426
- type: number
427
- name:
428
- type: string
429
- email:
430
- type: string
431
- status:
432
- type: string
433
- required:
434
- - user
435
- - status
436
- ```
437
-
438
- ---
439
-
440
- ## Authentication
441
-
442
- Define how to authenticate (optional).
443
-
444
- ```yaml
445
- authentication:
446
- type: api_key|bearer|oauth2|basic
447
- location: header|query|body
448
- name: header_name
449
- secret_env_var: MATIMO_SECRET_NAME
450
- ```
451
-
452
- ### Type: API Key
453
-
454
- ```yaml
455
- authentication:
456
- type: api_key
457
- location: header
458
- name: X-API-Key
459
- secret_env_var: MATIMO_API_KEY
460
- ```
461
-
462
- Environment variable: `MATIMO_API_KEY=your-api-key`
463
-
464
- ### Type: Bearer Token
465
-
466
- ```yaml
467
- authentication:
468
- type: bearer
469
- secret_env_var: MATIMO_API_TOKEN
470
- ```
471
-
472
- Environment variable: `MATIMO_API_TOKEN=your-token`
473
-
474
- Automatically adds header: `Authorization: Bearer your-token`
475
-
476
- ### Type: Basic Auth
477
-
478
- ```yaml
479
- authentication:
480
- type: basic
481
- secret_env_var: MATIMO_CREDENTIALS
482
- ```
483
-
484
- Environment variable: `MATIMO_CREDENTIALS=username:password`
485
-
486
- Automatically creates Basic auth header.
487
-
488
- ### Type: OAuth2
489
-
490
- ```yaml
491
- authentication:
492
- type: oauth2
493
- secret_env_var: MATIMO_OAUTH_TOKEN
494
- ```
495
-
496
- (Full OAuth2 implementation in Phase 2)
497
-
498
- ---
499
-
500
- ## Error Handling
501
-
502
- Define retry and recovery logic (optional).
503
-
504
- ```yaml
505
- error_handling:
506
- retry: 3
507
- backoff_type: exponential|linear|constant
508
- initial_delay_ms: 1000
509
- max_delay_ms: 30000
510
- ```
511
-
512
- **Fields:**
513
- - `retry` (number, default: 0) — Number of retry attempts
514
- - `backoff_type` (string) — Backoff strategy
515
- - `initial_delay_ms` (number) — Initial delay between retries
516
- - `max_delay_ms` (number) — Maximum delay between retries
517
-
518
- ### Backoff Strategies
519
-
520
- #### exponential
521
-
522
- Wait time = initial_delay × (2 ^ attempt_number)
523
-
524
- ```yaml
525
- error_handling:
526
- retry: 3
527
- backoff_type: exponential
528
- initial_delay_ms: 1000
529
- max_delay_ms: 30000
530
- ```
531
-
532
- Delays: 1s, 2s, 4s, 8s (capped at 30s)
533
-
534
- #### linear
535
-
536
- Wait time = initial_delay × (attempt_number + 1)
537
-
538
- ```yaml
539
- backoff_type: linear
540
- initial_delay_ms: 1000
541
- ```
542
-
543
- Delays: 1s, 2s, 3s, 4s
544
-
545
- #### constant
546
-
547
- Wait time = initial_delay
548
-
549
- ```yaml
550
- backoff_type: constant
551
- initial_delay_ms: 2000
552
- ```
553
-
554
- Delays: 2s, 2s, 2s, 2s
555
-
556
- ---
557
-
558
- ## Complete Examples
559
-
560
- ### Calculator Tool
561
-
562
- ```yaml
563
- name: calculator
564
- description: Perform basic math calculations
565
- version: "1.0.0"
566
-
567
- parameters:
568
- operation:
569
- type: string
570
- description: Math operation to perform
571
- required: true
572
- enum:
573
- - add
574
- - subtract
575
- - multiply
576
- - divide
577
- a:
578
- type: number
579
- description: First number
580
- required: true
581
- b:
582
- type: number
583
- description: Second number
584
- required: true
585
-
586
- execution:
587
- type: command
588
- command: node
589
- args:
590
- - -e
591
- - "console.log(JSON.stringify({ result: eval(`${process.argv[1]} ${process.argv[2]} ${process.argv[3]}`) }))"
592
- - "{operation === 'add' ? '+' : operation === 'subtract' ? '-' : operation === 'multiply' ? '*' : '/'}"
593
- - "{a}"
594
- - "{b}"
595
-
596
- output_schema:
597
- type: object
598
- properties:
599
- result:
600
- type: number
601
- required:
602
- - result
603
- ```
604
-
605
- ### GitHub Create Issue
606
-
607
- ```yaml
608
- name: github-create-issue
609
- description: Create a new issue in a GitHub repository
610
- version: "1.0.0"
611
-
612
- parameters:
613
- owner:
614
- type: string
615
- description: Repository owner
616
- required: true
617
- repo:
618
- type: string
619
- description: Repository name
620
- required: true
621
- title:
622
- type: string
623
- description: Issue title
624
- required: true
625
- validation:
626
- minLength: 1
627
- maxLength: 200
628
- body:
629
- type: string
630
- description: Issue body/description
631
- required: false
632
- labels:
633
- type: array
634
- description: Labels to assign
635
- required: false
636
-
637
- execution:
638
- type: http
639
- method: POST
640
- url: "https://api.github.com/repos/{owner}/{repo}/issues"
641
- headers:
642
- Accept: application/vnd.github.v3+json
643
- auth:
644
- type: bearer
645
- secret_env_var: MATIMO_GITHUB_TOKEN
646
-
647
- output_schema:
648
- type: object
649
- properties:
650
- id:
651
- type: number
652
- number:
653
- type: number
654
- title:
655
- type: string
656
- url:
657
- type: string
658
- required:
659
- - id
660
- - number
661
- - title
662
- - url
663
-
664
- error_handling:
665
- retry: 3
666
- backoff_type: exponential
667
- initial_delay_ms: 1000
668
- ```
669
-
670
- ### Slack Send Message
671
-
672
- ```yaml
673
- name: slack-send-message
674
- description: Send a message to a Slack channel
675
- version: "1.0.0"
676
-
677
- parameters:
678
- channel:
679
- type: string
680
- description: Channel ID or name
681
- required: true
682
- message:
683
- type: string
684
- description: Message text
685
- required: true
686
- validation:
687
- minLength: 1
688
- maxLength: 4000
689
- thread_ts:
690
- type: string
691
- description: Thread timestamp (for replies)
692
- required: false
693
-
694
- execution:
695
- type: http
696
- method: POST
697
- url: "https://slack.com/api/chat.postMessage"
698
- headers:
699
- Content-Type: application/json
700
- auth:
701
- type: bearer
702
- secret_env_var: MATIMO_SLACK_TOKEN
703
-
704
- output_schema:
705
- type: object
706
- properties:
707
- ok:
708
- type: boolean
709
- ts:
710
- type: string
711
- channel:
712
- type: string
713
- required:
714
- - ok
715
- - ts
716
- - channel
717
-
718
- error_handling:
719
- retry: 2
720
- backoff_type: exponential
721
- initial_delay_ms: 500
722
- ```
723
-
724
- ---
725
-
726
- ## Best Practices
727
-
728
- 1. **Naming** — Use lowercase, kebab-case, globally unique
729
- 2. **Description** — Clear, one sentence explaining purpose
730
- 3. **Parameters** — Validate with min/max, enum, patterns
731
- 4. **Output Schema** — Document all response fields
732
- 5. **Authentication** — Use environment variables, never hardcode
733
- 6. **Error Handling** — Include retry logic for flaky APIs
734
- 7. **Timeout** — Set appropriate timeouts (avoid infinite hangs)
735
- 8. **Testing** — Include examples of real-world usage
736
-
737
- ---
738
-
739
- ## File Organization
740
-
741
- Store tools in provider directories. Each tool can be a single file or a subdirectory with its own `definition.yaml`:
742
-
743
- ```
744
- tools/
745
- ├── provider-name/
746
- │ ├── definition.yaml # Single tool per provider
747
- │ └── ...
748
- ├── multi-tool-provider/
749
- │ ├── tool-1/
750
- │ │ └── definition.yaml # Multi-tool provider
751
- │ └── tool-2/
752
- │ └── definition.yaml
753
- └── examples/
754
- └── example-tool.yaml
755
- ```
756
-
757
- Example:
758
-
759
- ```
760
- tools/
761
- ├── github/
762
- │ └── definition.yaml
763
- ├── slack/
764
- │ └── definition.yaml
765
- ├── gmail/
766
- │ ├── send-email/
767
- │ │ └── definition.yaml
768
- │ ├── create-draft/
769
- │ │ └── definition.yaml
770
- │ ├── list-messages/
771
- │ │ └── definition.yaml
772
- │ └── definition.yaml # Optional: shared config
773
- ├── calculator/
774
- │ └── definition.yaml
775
- └── examples/
776
- ├── http-client.yaml
777
- └── echo-tool.yaml
778
- ```
779
-
780
- **Naming conventions:**
781
-
782
- - Provider directories: lowercase, kebab-case (`github`, `slack`, `gmail`)
783
- - Tool subdirectories: lowercase, kebab-case (`send-email`, `create-draft`)
784
- - Files: Always `definition.yaml` for tool definitions
785
-
786
- ---
787
-
788
- ## See Also
789
-
790
- - [Quick Start](../getting-started/QUICK_START.md) — Get started in 5 minutes
791
- - [API Reference](../api-reference/SDK.md) — Complete SDK documentation
792
- - [Decorator Guide](./DECORATOR_GUIDE.md) — Use decorators
793
- - [CONTRIBUTING.md](../CONTRIBUTING.md) — Development guide