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,316 +0,0 @@
1
- # SDK Usage Patterns
2
-
3
- Learn the two main ways to use Matimo SDK in v0.1.0-alpha.1.
4
-
5
- ## Pattern 1: Factory Pattern (Recommended for Simple Use Cases)
6
-
7
- The factory pattern is the simplest and most ergonomic way to use Matimo.
8
-
9
- ### Basic Setup
10
-
11
- ```typescript
12
- import { matimo } from 'matimo';
13
-
14
- // Initialize once
15
- const m = await matimo.init('./tools');
16
- ```
17
-
18
- ### Execute a Tool
19
-
20
- ```typescript
21
- const result = await m.execute('calculator', {
22
- operation: 'add',
23
- a: 5,
24
- b: 3
25
- });
26
-
27
- console.log(result); // { result: 8 }
28
- ```
29
-
30
- ### Discover Tools
31
-
32
- ```typescript
33
- // List all tools
34
- const allTools = m.listTools();
35
- console.log(`Loaded ${allTools.length} tools`);
36
-
37
- // Get specific tool
38
- const tool = m.getTool('calculator');
39
- console.log(`Tool: ${tool.name} - ${tool.description}`);
40
-
41
- // Filter by tags
42
- const mathTools = m.getToolsByTag('math');
43
- mathTools.forEach(t => console.log(`- ${t.name}`));
44
-
45
- // Search tools
46
- const results = m.searchTools('email');
47
- results.forEach(t => console.log(`Found: ${t.name}`));
48
- ```
49
-
50
- ### Handle Errors
51
-
52
- ```typescript
53
- try {
54
- const result = await m.execute('calculator', {
55
- operation: 'divide',
56
- a: 10,
57
- b: 0 // ⚠️ Will fail
58
- });
59
- } catch (error) {
60
- if (error.code === 'TOOL_NOT_FOUND') {
61
- console.error('Tool not available:', error.message);
62
- } else if (error.code === 'INVALID_PARAMETERS') {
63
- console.error('Bad parameters:', error.details);
64
- } else if (error.code === 'EXECUTION_FAILED') {
65
- console.error('Tool error:', error.details);
66
- }
67
- }
68
- ```
69
-
70
- ### Complete Example
71
-
72
- ```typescript
73
- import { matimo } from 'matimo';
74
-
75
- async function main() {
76
- try {
77
- // 1. Initialize
78
- const m = await matimo.init('./tools');
79
-
80
- // 2. List available tools
81
- const tools = m.listTools();
82
- console.log(`📦 Loaded ${tools.length} tools`);
83
-
84
- // 3. Execute tool
85
- const result = await m.execute('gmail-send-email', {
86
- to: 'recipient@example.com',
87
- subject: 'Hello',
88
- body: 'Message from Matimo'
89
- });
90
-
91
- console.log('✅ Email sent:', result);
92
- } catch (error) {
93
- console.error('❌ Error:', error.message);
94
- }
95
- }
96
-
97
- main();
98
- ```
99
-
100
- ---
101
-
102
- ## Pattern 2: Decorator Pattern (Recommended for Class-Based Code)
103
-
104
- The decorator pattern is ideal for class-based agents and applications.
105
-
106
- ### Basic Setup
107
-
108
- ```typescript
109
- import { tool, matimo } from 'matimo';
110
-
111
- // Initialize Matimo
112
- const matimoInstance = await matimo.init('./tools');
113
-
114
- // Create agent class
115
- class EmailAgent {
116
- constructor(private matimoInstance: any) {}
117
-
118
- @tool('gmail-send-email')
119
- async sendEmail(to: string, subject: string, body: string) {
120
- // Decorator handles execution
121
- // Method body is optional - decorator does the work
122
- }
123
-
124
- @tool('gmail-list-messages')
125
- async listEmails(maxResults?: number) {
126
- // Executed by decorator
127
- // Return type inferred from tool definition
128
- }
129
- }
130
-
131
- // Use it
132
- const agent = new EmailAgent(matimoInstance);
133
-
134
- // Call decorated methods
135
- await agent.sendEmail(
136
- 'john@example.com',
137
- 'Hello John',
138
- 'This is a test email'
139
- );
140
-
141
- const emails = await agent.listEmails(10);
142
- console.log(`Found ${emails.length} emails`);
143
- ```
144
-
145
- ### Advanced: Custom Agent with Multiple Tools
146
-
147
- ```typescript
148
- import { tool, matimo } from 'matimo';
149
-
150
- class AIAssistant {
151
- constructor(private matimo: any) {}
152
-
153
- @tool('calculator')
154
- async calculate(operation: string, a: number, b: number) {
155
- // Decorator auto-executes the calculator tool
156
- // Argument order matches tool parameters
157
- }
158
-
159
- @tool('gmail-send-email')
160
- async sendEmail(to: string, subject: string, body: string) {
161
- // Send emails as part of workflow
162
- }
163
-
164
- @tool('gmail-list-messages')
165
- async checkEmails(maxResults?: number) {
166
- // List emails
167
- }
168
-
169
- // Custom methods that use tools
170
- async runWorkflow(userEmail: string) {
171
- // Orchestrate tool calls
172
- const emails = await this.checkEmails(5);
173
- console.log(`Checking ${emails.length} latest emails`);
174
-
175
- if (emails.length > 0) {
176
- await this.sendEmail(
177
- userEmail,
178
- 'Daily Summary',
179
- `You have ${emails.length} unread emails`
180
- );
181
- }
182
- }
183
- }
184
-
185
- // Usage
186
- const matimo = await matimo.init('./tools');
187
- const assistant = new AIAssistant(matimo);
188
-
189
- await assistant.runWorkflow('user@example.com');
190
- ```
191
-
192
- ---
193
-
194
- ## Comparison: Factory vs Decorator
195
-
196
- | Feature | Factory | Decorator |
197
- |---------|---------|-----------|
198
- | **Simplicity** | Simple | Requires classes |
199
- | **Best For** | Scripts, backends | Agents, complex apps |
200
- | **Syntax** | `m.execute()` | `@tool()` |
201
- | **Type Safety** | Good | Excellent |
202
- | **Framework Fit** | Any | Class-based |
203
- | **Async/Await** | Required | Required |
204
- | **Error Handling** | Try/catch | Try/catch |
205
-
206
- ---
207
-
208
- ## Using Matimo with AI Frameworks
209
-
210
- For intelligent tool orchestration with LangChain, CrewAI, Claude SDK, or other AI frameworks where the LLM automatically decides which tool to use, see:
211
-
212
- - **[LangChain Integration Guide](../framework-integrations/LANGCHAIN.md)** — Complete patterns with LangChain
213
- - Official API pattern (recommended)
214
- - Decorator pattern with LangChain
215
- - Factory pattern with LangChain
216
- - Working examples with GPT-4
217
-
218
- ---
219
-
220
- ## Patterns in Different Contexts
221
-
222
- ### Backend API
223
-
224
- ```typescript
225
- // Express.js route handler
226
- import { matimo } from 'matimo';
227
-
228
- const m = await matimo.init('./tools');
229
-
230
- app.post('/api/send-email', async (req, res) => {
231
- try {
232
- const result = await m.execute('gmail-send-email', {
233
- to: req.body.to,
234
- subject: req.body.subject,
235
- body: req.body.body
236
- });
237
- res.json({ success: true, result });
238
- } catch (error) {
239
- res.status(400).json({ error: error.message });
240
- }
241
- });
242
- ```
243
-
244
- ### LangChain Agent
245
-
246
- ```typescript
247
- // See LANGCHAIN.md for full integration
248
- const m = await matimo.init('./tools');
249
-
250
- const langchainTools = m.listTools().map(tool => ({
251
- name: tool.name,
252
- description: tool.description,
253
- run: async (input) => {
254
- const result = await m.execute(tool.name, JSON.parse(input));
255
- return JSON.stringify(result);
256
- }
257
- }));
258
- ```
259
-
260
- ### CLI Tool
261
-
262
- ```typescript
263
- // Command-line interface
264
- import { matimo } from 'matimo';
265
-
266
- const m = await matimo.init('./tools');
267
-
268
- const toolName = process.argv[2];
269
- const params = JSON.parse(process.argv[3] || '{}');
270
-
271
- const result = await m.execute(toolName, params);
272
- console.log(JSON.stringify(result, null, 2));
273
- ```
274
-
275
- ---
276
-
277
- ## Error Handling Best Practices
278
-
279
- ```typescript
280
- import { MatimoError } from 'matimo';
281
-
282
- try {
283
- const result = await m.execute('calculator', params);
284
- } catch (error) {
285
- if (error instanceof MatimoError) {
286
- // Handle Matimo-specific errors
287
- switch (error.code) {
288
- case 'TOOL_NOT_FOUND':
289
- console.error(`Tool not available: ${error.message}`);
290
- break;
291
- case 'INVALID_PARAMETERS':
292
- console.error(`Bad parameters: ${JSON.stringify(error.details)}`);
293
- break;
294
- case 'EXECUTION_FAILED':
295
- console.error(`Execution failed: ${error.details}`);
296
- break;
297
- default:
298
- console.error(`Unknown error: ${error.message}`);
299
- }
300
- } else {
301
- // Handle other errors
302
- console.error('Unexpected error:', error);
303
- }
304
- }
305
- ```
306
-
307
- ---
308
-
309
- ## Next Steps
310
-
311
- - **[Tool Discovery Guide](./TOOL_DISCOVERY.md)** — More on finding tools
312
- - **[LangChain Integration](../framework-integrations/LANGCHAIN.md)** — Using with LangChain
313
- - **[Decorator Pattern Guide](../tool-development/DECORATOR_GUIDE.md)** — Deep dive on decorators
314
- - **[API Reference](../api-reference/SDK.md)** — Complete API docs
315
-
316
- See [examples/](../../examples/) for working code.
@@ -1,209 +0,0 @@
1
- # Tool Discovery & Filtering
2
-
3
- Find and filter tools by name, description, and tags.
4
-
5
- ## List All Tools
6
-
7
- ```typescript
8
- import { matimo } from 'matimo';
9
-
10
- const m = await matimo.init('./tools');
11
-
12
- // List all loaded tools
13
- const allTools = m.listTools();
14
- console.log(`Loaded ${allTools.length} tools`);
15
-
16
- allTools.forEach(tool => {
17
- console.log(`• ${tool.name} - ${tool.description}`);
18
- });
19
- ```
20
-
21
- **Output:**
22
- ```
23
- Loaded 8 tools
24
- • calculator - Perform basic math operations
25
- • gmail-send-email - Send an email via Gmail API
26
- • gmail-list-messages - List emails from Gmail
27
- • github-create-issue - Create a GitHub issue
28
- ... (more tools)
29
- ```
30
-
31
- ---
32
-
33
- ## Get Specific Tool
34
-
35
- ```typescript
36
- const tool = m.getTool('calculator');
37
-
38
- console.log(`Name: ${tool.name}`);
39
- console.log(`Description: ${tool.description}`);
40
- console.log(`Version: ${tool.version}`);
41
- ```
42
-
43
- ---
44
-
45
- ## Filter by Tags
46
-
47
- ```typescript
48
- // Get tools with specific tags
49
- const mathTools = m.getToolsByTag('math');
50
- console.log(`Math tools: ${mathTools.map(t => t.name).join(', ')}`);
51
-
52
- const emailTools = m.getToolsByTag('email');
53
- console.log(`Email tools: ${emailTools.map(t => t.name).join(', ')}`);
54
- ```
55
-
56
- ---
57
-
58
- ## Search Tools
59
-
60
- ```typescript
61
- // Search by name or description
62
- const results = m.searchTools('email');
63
-
64
- results.forEach(tool => {
65
- console.log(`Found: ${tool.name}`);
66
- console.log(` Description: ${tool.description}`);
67
- console.log(` Tags: ${tool.tags?.join(', ') || 'none'}`);
68
- });
69
- ```
70
-
71
- **Output:**
72
- ```
73
- Found: gmail-send-email
74
- Description: Send an email via Gmail API
75
- Tags: email, gmail, http
76
-
77
- Found: gmail-list-messages
78
- Description: List emails from Gmail
79
- Tags: email, gmail, http
80
- ```
81
-
82
- ---
83
-
84
- ## Filter Criteria
85
-
86
- ### By Type
87
-
88
- ```typescript
89
- // Filter by execution type
90
- const httpTools = m.listTools().filter(t => t.execution?.type === 'http');
91
- console.log(`HTTP tools: ${httpTools.length}`);
92
-
93
- const cmdTools = m.listTools().filter(t => t.execution?.type === 'command');
94
- console.log(`Command tools: ${cmdTools.length}`);
95
- ```
96
-
97
- ### By Authentication
98
-
99
- ```typescript
100
- // Tools requiring OAuth2
101
- const oauth2Tools = m.listTools().filter(t => t.authentication?.type === 'oauth2');
102
- console.log(`OAuth2 tools: ${oauth2Tools.map(t => t.name).join(', ')}`);
103
- ```
104
-
105
- ### By Provider
106
-
107
- ```typescript
108
- // Gmail tools
109
- const gmailTools = m.listTools().filter(t => t.name.startsWith('gmail-'));
110
- console.log(`Gmail tools: ${gmailTools.map(t => t.name).join(', ')}`);
111
-
112
- // GitHub tools
113
- const githubTools = m.listTools().filter(t => t.name.startsWith('github-'));
114
- console.log(`GitHub tools: ${githubTools.map(t => t.name).join(', ')}`);
115
- ```
116
-
117
- ---
118
-
119
- ## Tool Metadata
120
-
121
- Each tool has:
122
-
123
- ```typescript
124
- const tool = m.getTool('calculator');
125
-
126
- // Basic info
127
- tool.name // 'calculator'
128
- tool.description // 'Perform basic math operations'
129
- tool.version // '1.0.0'
130
-
131
- // Parameters
132
- tool.parameters // { operation: {...}, a: {...}, b: {...} }
133
- Object.keys(tool.parameters) // ['operation', 'a', 'b']
134
-
135
- // Execution config
136
- tool.execution.type // 'command' | 'http'
137
- tool.execution.command // shell command (if type === 'command')
138
- tool.execution.url // API endpoint (if type === 'http')
139
-
140
- // Authentication
141
- tool.authentication?.type // 'oauth2' | 'api_key' | etc.
142
- tool.authentication?.provider // 'google' | 'github' | 'slack'
143
-
144
- // Output
145
- tool.output_schema // { type: 'object', properties: {...} }
146
-
147
- // Metadata
148
- tool.tags // ['math', 'calculator']
149
- tool.author // 'Matimo'
150
- tool.license // 'MIT'
151
- ```
152
-
153
- ---
154
-
155
- ## Common Use Cases
156
-
157
- ### Find All Email Tools
158
-
159
- ```typescript
160
- const emailTools = m.listTools()
161
- .filter(t => t.tags?.includes('email'));
162
-
163
- emailTools.forEach(tool => {
164
- console.log(`- ${tool.name}: ${tool.description}`);
165
- });
166
- ```
167
-
168
- ### Find Tools Without Authentication
169
-
170
- ```typescript
171
- const publicTools = m.listTools()
172
- .filter(t => !t.authentication);
173
-
174
- console.log(`Public tools (no auth required):`);
175
- publicTools.forEach(t => console.log(` - ${t.name}`));
176
- ```
177
-
178
- ### Find Tools Requiring OAuth2
179
-
180
- ```typescript
181
- const oauth2Tools = m.listTools()
182
- .filter(t => t.authentication?.type === 'oauth2');
183
-
184
- console.log(`Tools requiring OAuth2:`);
185
- oauth2Tools.forEach(t => {
186
- console.log(` - ${t.name} (${t.authentication?.provider})`);
187
- });
188
- ```
189
-
190
- ### List All Providers
191
-
192
- ```typescript
193
- const providers = new Set(
194
- m.listTools()
195
- .filter(t => t.authentication?.provider)
196
- .map(t => t.authentication?.provider)
197
- );
198
-
199
- console.log(`Available providers: ${Array.from(providers).join(', ')}`);
200
- ```
201
-
202
- ---
203
-
204
- ## Next Steps
205
-
206
- - **Execute Tools**: [Your First Tool](../getting-started/YOUR_FIRST_TOOL.md)
207
- - **Learn Patterns**: [SDK Usage Patterns](./SDK_PATTERNS.md)
208
- - **Setup OAuth2**: [Authentication Guide](./AUTHENTICATION.md)
209
-
File without changes