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.
- package/README.md +128 -548
- package/package.json +24 -28
- package/packages/cli/bin/matimo.cjs +26 -0
- package/packages/cli/dist/cli.d.ts +6 -0
- package/packages/cli/dist/cli.d.ts.map +1 -0
- package/packages/cli/dist/cli.js +95 -0
- package/packages/cli/dist/cli.js.map +1 -0
- package/packages/cli/dist/commands/install.d.ts +6 -0
- package/packages/cli/dist/commands/install.d.ts.map +1 -0
- package/packages/cli/dist/commands/install.js +48 -0
- package/packages/cli/dist/commands/install.js.map +1 -0
- package/packages/cli/dist/commands/list.d.ts +9 -0
- package/packages/cli/dist/commands/list.d.ts.map +1 -0
- package/packages/cli/dist/commands/list.js +70 -0
- package/packages/cli/dist/commands/list.js.map +1 -0
- package/packages/cli/dist/commands/search.d.ts +2 -0
- package/packages/cli/dist/commands/search.d.ts.map +1 -0
- package/packages/cli/dist/commands/search.js +148 -0
- package/packages/cli/dist/commands/search.js.map +1 -0
- package/packages/core/dist/src/auth/oauth2-config.d.ts.map +1 -0
- package/packages/core/dist/src/auth/oauth2-config.js.map +1 -0
- package/packages/core/dist/src/auth/oauth2-handler.d.ts.map +1 -0
- package/packages/core/dist/src/auth/oauth2-handler.js.map +1 -0
- package/packages/core/dist/src/auth/oauth2-provider-loader.d.ts.map +1 -0
- package/packages/core/dist/src/auth/oauth2-provider-loader.js.map +1 -0
- package/{dist → packages/core/dist/src}/core/schema.d.ts +12 -2
- package/packages/core/dist/src/core/schema.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/core/schema.js +20 -6
- package/packages/core/dist/src/core/schema.js.map +1 -0
- package/{dist → packages/core/dist/src}/core/tool-loader.d.ts +16 -0
- package/packages/core/dist/src/core/tool-loader.d.ts.map +1 -0
- package/packages/core/dist/src/core/tool-loader.js +205 -0
- package/packages/core/dist/src/core/tool-loader.js.map +1 -0
- package/packages/core/dist/src/core/tool-registry.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/core/tool-registry.js +5 -1
- package/packages/core/dist/src/core/tool-registry.js.map +1 -0
- package/{dist → packages/core/dist/src}/core/types.d.ts +15 -1
- package/packages/core/dist/src/core/types.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/core/types.js.map +1 -1
- package/packages/core/dist/src/decorators/index.d.ts.map +1 -0
- package/packages/core/dist/src/decorators/index.js.map +1 -0
- package/packages/core/dist/src/decorators/tool-decorator.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/decorators/tool-decorator.js +7 -4
- package/packages/core/dist/src/decorators/tool-decorator.js.map +1 -0
- package/packages/core/dist/src/encodings/parameter-encoding.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/encodings/parameter-encoding.js +9 -2
- package/packages/core/dist/src/encodings/parameter-encoding.js.map +1 -0
- package/packages/core/dist/src/errors/matimo-error.d.ts.map +1 -0
- package/packages/core/dist/src/errors/matimo-error.js.map +1 -0
- package/packages/core/dist/src/executors/command-executor.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/executors/command-executor.js +5 -1
- package/packages/core/dist/src/executors/command-executor.js.map +1 -0
- package/packages/core/dist/src/executors/function-executor.d.ts +23 -0
- package/packages/core/dist/src/executors/function-executor.d.ts.map +1 -0
- package/packages/core/dist/src/executors/function-executor.js +164 -0
- package/packages/core/dist/src/executors/function-executor.js.map +1 -0
- package/packages/core/dist/src/executors/http-executor.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/executors/http-executor.js +5 -1
- package/packages/core/dist/src/executors/http-executor.js.map +1 -0
- package/{dist → packages/core/dist/src}/index.d.ts +5 -1
- package/packages/core/dist/src/index.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/index.js +3 -0
- package/packages/core/dist/src/index.js.map +1 -0
- package/packages/core/dist/src/integrations/langchain.d.ts +46 -0
- package/packages/core/dist/src/integrations/langchain.d.ts.map +1 -0
- package/packages/core/dist/src/integrations/langchain.js +197 -0
- package/packages/core/dist/src/integrations/langchain.js.map +1 -0
- package/{dist → packages/core/dist/src}/matimo-instance.d.ts +30 -4
- package/packages/core/dist/src/matimo-instance.d.ts.map +1 -0
- package/{dist → packages/core/dist/src}/matimo-instance.js +63 -10
- package/packages/core/dist/src/matimo-instance.js.map +1 -0
- package/packages/core/dist/tools/calculator/calculator.d.ts +26 -0
- package/packages/core/dist/tools/calculator/calculator.d.ts.map +1 -0
- package/packages/core/dist/tools/calculator/calculator.js +104 -0
- package/packages/core/dist/tools/calculator/calculator.js.map +1 -0
- package/packages/core/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/auth/oauth2-config.d.ts.map +0 -1
- package/dist/auth/oauth2-config.js.map +0 -1
- package/dist/auth/oauth2-handler.d.ts.map +0 -1
- package/dist/auth/oauth2-handler.js.map +0 -1
- package/dist/auth/oauth2-provider-loader.d.ts.map +0 -1
- package/dist/auth/oauth2-provider-loader.js.map +0 -1
- package/dist/core/schema.d.ts.map +0 -1
- package/dist/core/schema.js.map +0 -1
- package/dist/core/tool-loader.d.ts.map +0 -1
- package/dist/core/tool-loader.js +0 -98
- package/dist/core/tool-loader.js.map +0 -1
- package/dist/core/tool-registry.d.ts.map +0 -1
- package/dist/core/tool-registry.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/decorators/index.d.ts.map +0 -1
- package/dist/decorators/index.js.map +0 -1
- package/dist/decorators/tool-decorator.d.ts.map +0 -1
- package/dist/decorators/tool-decorator.js.map +0 -1
- package/dist/encodings/parameter-encoding.d.ts.map +0 -1
- package/dist/encodings/parameter-encoding.js.map +0 -1
- package/dist/errors/matimo-error.d.ts.map +0 -1
- package/dist/errors/matimo-error.js.map +0 -1
- package/dist/executors/command-executor.d.ts.map +0 -1
- package/dist/executors/command-executor.js.map +0 -1
- package/dist/executors/http-executor.d.ts.map +0 -1
- package/dist/executors/http-executor.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/matimo-instance.d.ts.map +0 -1
- package/dist/matimo-instance.js.map +0 -1
- package/docs/Gemfile +0 -5
- package/docs/RELEASES.md +0 -90
- 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 -212
- package/docs/getting-started/YOUR_FIRST_TOOL.md +0 -217
- package/docs/getting-started/installation.md +0 -124
- package/docs/index.md +0 -289
- 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
- /package/{dist → packages/core/dist/src}/auth/oauth2-config.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/auth/oauth2-config.js +0 -0
- /package/{dist → packages/core/dist/src}/auth/oauth2-handler.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/auth/oauth2-handler.js +0 -0
- /package/{dist → packages/core/dist/src}/auth/oauth2-provider-loader.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/auth/oauth2-provider-loader.js +0 -0
- /package/{dist → packages/core/dist/src}/core/tool-registry.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/core/types.js +0 -0
- /package/{dist → packages/core/dist/src}/decorators/index.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/decorators/index.js +0 -0
- /package/{dist → packages/core/dist/src}/decorators/tool-decorator.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/encodings/parameter-encoding.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/errors/matimo-error.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/errors/matimo-error.js +0 -0
- /package/{dist → packages/core/dist/src}/executors/command-executor.d.ts +0 -0
- /package/{dist → packages/core/dist/src}/executors/http-executor.d.ts +0 -0
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
# TypeScript Type Definitions Reference
|
|
2
|
-
|
|
3
|
-
Complete type definitions for the Matimo TypeScript SDK.
|
|
4
|
-
|
|
5
|
-
## Core Types
|
|
6
|
-
|
|
7
|
-
### ToolDefinition
|
|
8
|
-
|
|
9
|
-
Complete tool definition structure.
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
interface ToolDefinition {
|
|
13
|
-
name: string;
|
|
14
|
-
description: string;
|
|
15
|
-
version: string;
|
|
16
|
-
|
|
17
|
-
parameters?: Record<string, Parameter>;
|
|
18
|
-
execution: ExecutionConfig;
|
|
19
|
-
output_schema?: OutputSchema;
|
|
20
|
-
authentication?: AuthConfig;
|
|
21
|
-
error_handling?: ErrorHandling;
|
|
22
|
-
|
|
23
|
-
tags?: string[];
|
|
24
|
-
author?: string;
|
|
25
|
-
license?: string;
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Example:**
|
|
30
|
-
```typescript
|
|
31
|
-
const tool: ToolDefinition = {
|
|
32
|
-
name: 'calculator',
|
|
33
|
-
description: 'Perform basic math operations',
|
|
34
|
-
version: '1.0.0',
|
|
35
|
-
parameters: {
|
|
36
|
-
operation: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
enum: ['add', 'subtract', 'multiply', 'divide'],
|
|
39
|
-
required: true
|
|
40
|
-
},
|
|
41
|
-
a: { type: 'number', required: true },
|
|
42
|
-
b: { type: 'number', required: true }
|
|
43
|
-
},
|
|
44
|
-
execution: {
|
|
45
|
-
type: 'command',
|
|
46
|
-
command: 'node calculator.js',
|
|
47
|
-
args: ['--op', '{operation}', '{a}', '{b}']
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
### Parameter
|
|
55
|
-
|
|
56
|
-
Define a single tool parameter.
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
interface Parameter {
|
|
60
|
-
type: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
61
|
-
description?: string;
|
|
62
|
-
required?: boolean;
|
|
63
|
-
default?: unknown;
|
|
64
|
-
|
|
65
|
-
// String constraints
|
|
66
|
-
minLength?: number;
|
|
67
|
-
maxLength?: number;
|
|
68
|
-
pattern?: string;
|
|
69
|
-
|
|
70
|
-
// Number constraints
|
|
71
|
-
minimum?: number;
|
|
72
|
-
maximum?: number;
|
|
73
|
-
|
|
74
|
-
// Enum constraint
|
|
75
|
-
enum?: unknown[];
|
|
76
|
-
|
|
77
|
-
// Array/Object items
|
|
78
|
-
items?: Parameter;
|
|
79
|
-
properties?: Record<string, Parameter>;
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**Examples:**
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
// String parameter with enum
|
|
87
|
-
const operation: Parameter = {
|
|
88
|
-
type: 'string',
|
|
89
|
-
enum: ['add', 'subtract', 'multiply', 'divide'],
|
|
90
|
-
required: true
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// Number with range
|
|
94
|
-
const count: Parameter = {
|
|
95
|
-
type: 'number',
|
|
96
|
-
minimum: 1,
|
|
97
|
-
maximum: 100,
|
|
98
|
-
required: true
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// Optional string with pattern
|
|
102
|
-
const email: Parameter = {
|
|
103
|
-
type: 'string',
|
|
104
|
-
pattern: '^[^@]+@[^@]+\\.[^@]+$',
|
|
105
|
-
required: false
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// Array parameter
|
|
109
|
-
const tags: Parameter = {
|
|
110
|
-
type: 'array',
|
|
111
|
-
items: { type: 'string' },
|
|
112
|
-
required: false
|
|
113
|
-
};
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
### ExecutionConfig
|
|
119
|
-
|
|
120
|
-
Defines how a tool executes.
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
type ExecutionConfig = CommandExecution | HttpExecution;
|
|
124
|
-
|
|
125
|
-
interface CommandExecution {
|
|
126
|
-
type: 'command';
|
|
127
|
-
command: string;
|
|
128
|
-
args?: string[];
|
|
129
|
-
working_directory?: string;
|
|
130
|
-
timeout_ms?: number;
|
|
131
|
-
env?: Record<string, string>;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
interface HttpExecution {
|
|
135
|
-
type: 'http';
|
|
136
|
-
url: string;
|
|
137
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
138
|
-
headers?: Record<string, string>;
|
|
139
|
-
query_params?: Record<string, string>;
|
|
140
|
-
request_body?: unknown;
|
|
141
|
-
timeout_ms?: number;
|
|
142
|
-
parameter_encoding?: ParameterEncoding;
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
**Examples:**
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
// Command execution
|
|
150
|
-
const cmdExecution: CommandExecution = {
|
|
151
|
-
type: 'command',
|
|
152
|
-
command: 'python script.py',
|
|
153
|
-
args: ['--param', '{param}'],
|
|
154
|
-
timeout_ms: 30000
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// HTTP execution
|
|
158
|
-
const httpExecution: HttpExecution = {
|
|
159
|
-
type: 'http',
|
|
160
|
-
url: 'https://api.gmail.com/v1/users/me/messages/send',
|
|
161
|
-
method: 'POST',
|
|
162
|
-
headers: {
|
|
163
|
-
Authorization: 'Bearer {GMAIL_ACCESS_TOKEN}',
|
|
164
|
-
'Content-Type': 'application/json'
|
|
165
|
-
},
|
|
166
|
-
request_body: {
|
|
167
|
-
raw: '{emailData}'
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
### AuthConfig
|
|
175
|
-
|
|
176
|
-
Authentication configuration.
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
interface AuthConfig {
|
|
180
|
-
type: 'oauth2' | 'api_key' | 'basic' | 'bearer';
|
|
181
|
-
provider?: string;
|
|
182
|
-
required_scopes?: string[];
|
|
183
|
-
location?: 'header' | 'query' | 'body';
|
|
184
|
-
parameter_name?: string;
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**Examples:**
|
|
189
|
-
|
|
190
|
-
```typescript
|
|
191
|
-
// OAuth2
|
|
192
|
-
const oauth2: AuthConfig = {
|
|
193
|
-
type: 'oauth2',
|
|
194
|
-
provider: 'google',
|
|
195
|
-
required_scopes: [
|
|
196
|
-
'https://www.googleapis.com/auth/gmail.send'
|
|
197
|
-
]
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
// API Key
|
|
201
|
-
const apiKey: AuthConfig = {
|
|
202
|
-
type: 'api_key',
|
|
203
|
-
location: 'header',
|
|
204
|
-
parameter_name: 'X-API-Key'
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
// Bearer token
|
|
208
|
-
const bearer: AuthConfig = {
|
|
209
|
-
type: 'bearer',
|
|
210
|
-
location: 'header',
|
|
211
|
-
parameter_name: 'Authorization'
|
|
212
|
-
};
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
---
|
|
216
|
-
|
|
217
|
-
### OutputSchema
|
|
218
|
-
|
|
219
|
-
Defines tool output structure.
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
interface OutputSchema {
|
|
223
|
-
type: 'object' | 'string' | 'number' | 'array' | 'boolean';
|
|
224
|
-
description?: string;
|
|
225
|
-
properties?: Record<string, OutputSchema>;
|
|
226
|
-
items?: OutputSchema;
|
|
227
|
-
required?: string[];
|
|
228
|
-
}
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
**Example:**
|
|
232
|
-
|
|
233
|
-
```typescript
|
|
234
|
-
const schema: OutputSchema = {
|
|
235
|
-
type: 'object',
|
|
236
|
-
properties: {
|
|
237
|
-
result: { type: 'number' },
|
|
238
|
-
calculation: { type: 'string' },
|
|
239
|
-
timestamp: { type: 'string' }
|
|
240
|
-
},
|
|
241
|
-
required: ['result']
|
|
242
|
-
};
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
---
|
|
246
|
-
|
|
247
|
-
### ErrorHandling
|
|
248
|
-
|
|
249
|
-
Error recovery configuration.
|
|
250
|
-
|
|
251
|
-
```typescript
|
|
252
|
-
interface ErrorHandling {
|
|
253
|
-
retry?: number;
|
|
254
|
-
backoff_type?: 'linear' | 'exponential';
|
|
255
|
-
initial_delay_ms?: number;
|
|
256
|
-
max_delay_ms?: number;
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
**Example:**
|
|
261
|
-
|
|
262
|
-
```typescript
|
|
263
|
-
const errorHandling: ErrorHandling = {
|
|
264
|
-
retry: 3,
|
|
265
|
-
backoff_type: 'exponential',
|
|
266
|
-
initial_delay_ms: 1000,
|
|
267
|
-
max_delay_ms: 30000
|
|
268
|
-
};
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
---
|
|
272
|
-
|
|
273
|
-
## Runtime Types
|
|
274
|
-
|
|
275
|
-
### MatimoInstance
|
|
276
|
-
|
|
277
|
-
Main SDK class for tool execution.
|
|
278
|
-
|
|
279
|
-
```typescript
|
|
280
|
-
class MatimoInstance {
|
|
281
|
-
// List all tools
|
|
282
|
-
listTools(): ToolDefinition[];
|
|
283
|
-
|
|
284
|
-
// Get specific tool
|
|
285
|
-
getTool(name: string): ToolDefinition | null;
|
|
286
|
-
|
|
287
|
-
// Find tools by tag
|
|
288
|
-
getToolsByTag(tag: string): ToolDefinition[];
|
|
289
|
-
|
|
290
|
-
// Search tools
|
|
291
|
-
searchTools(query: string): ToolDefinition[];
|
|
292
|
-
|
|
293
|
-
// Execute tool
|
|
294
|
-
execute(
|
|
295
|
-
toolName: string,
|
|
296
|
-
params: Record<string, unknown>
|
|
297
|
-
): Promise<unknown>;
|
|
298
|
-
}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
|
-
### MatimoError
|
|
304
|
-
|
|
305
|
-
Error returned by SDK.
|
|
306
|
-
|
|
307
|
-
```typescript
|
|
308
|
-
interface MatimoError extends Error {
|
|
309
|
-
code: string;
|
|
310
|
-
message: string;
|
|
311
|
-
details?: Record<string, unknown>;
|
|
312
|
-
statusCode?: number;
|
|
313
|
-
}
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
**Example:**
|
|
317
|
-
|
|
318
|
-
```typescript
|
|
319
|
-
try {
|
|
320
|
-
await m.execute('unknown-tool', {});
|
|
321
|
-
} catch (error) {
|
|
322
|
-
const matimoError = error as MatimoError;
|
|
323
|
-
console.log(matimoError.code); // 'TOOL_NOT_FOUND'
|
|
324
|
-
console.log(matimoError.message); // 'Tool not found'
|
|
325
|
-
console.log(matimoError.details); // { toolName: 'unknown-tool' }
|
|
326
|
-
}
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## Validation Types
|
|
332
|
-
|
|
333
|
-
### ValidationError
|
|
334
|
-
|
|
335
|
-
Schema validation error.
|
|
336
|
-
|
|
337
|
-
```typescript
|
|
338
|
-
interface ValidationError {
|
|
339
|
-
field: string;
|
|
340
|
-
message: string;
|
|
341
|
-
expected?: string;
|
|
342
|
-
actual?: string;
|
|
343
|
-
}
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
## Complete Type Examples
|
|
349
|
-
|
|
350
|
-
### Using TypeScript Types in Code
|
|
351
|
-
|
|
352
|
-
```typescript
|
|
353
|
-
import {
|
|
354
|
-
ToolDefinition,
|
|
355
|
-
Parameter,
|
|
356
|
-
ExecutionConfig,
|
|
357
|
-
AuthConfig,
|
|
358
|
-
OutputSchema,
|
|
359
|
-
ErrorHandling,
|
|
360
|
-
MatimoInstance,
|
|
361
|
-
MatimoError
|
|
362
|
-
} from 'matimo';
|
|
363
|
-
|
|
364
|
-
// Load and type tool
|
|
365
|
-
const tool: ToolDefinition = matimo.getTool('calculator')!;
|
|
366
|
-
|
|
367
|
-
// Type parameters
|
|
368
|
-
const params: Record<string, unknown> = {
|
|
369
|
-
operation: 'add',
|
|
370
|
-
a: 5,
|
|
371
|
-
b: 3
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
// Execute with types
|
|
375
|
-
try {
|
|
376
|
-
const result = await matimo.execute('calculator', params);
|
|
377
|
-
console.log(result);
|
|
378
|
-
} catch (error) {
|
|
379
|
-
const matimoError = error as MatimoError;
|
|
380
|
-
if (matimoError.code === 'INVALID_PARAMETERS') {
|
|
381
|
-
console.error('Bad params:', matimoError.details);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
### TypeScript Strict Mode
|
|
389
|
-
|
|
390
|
-
All Matimo types are **strict**. Never use `any`:
|
|
391
|
-
|
|
392
|
-
```typescript
|
|
393
|
-
// ❌ DON'T
|
|
394
|
-
const params: any = { ... };
|
|
395
|
-
|
|
396
|
-
// ✅ DO
|
|
397
|
-
const params: Record<string, unknown> = { ... };
|
|
398
|
-
|
|
399
|
-
// ✅ BETTER (fully typed)
|
|
400
|
-
interface CalculatorParams {
|
|
401
|
-
operation: 'add' | 'subtract' | 'multiply' | 'divide';
|
|
402
|
-
a: number;
|
|
403
|
-
b: number;
|
|
404
|
-
}
|
|
405
|
-
const params: CalculatorParams = { ... };
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
---
|
|
409
|
-
|
|
410
|
-
## Next Steps
|
|
411
|
-
|
|
412
|
-
- **Error Codes**: [Error Reference](./ERRORS.md)
|
|
413
|
-
- **API Methods**: [SDK API Reference](./SDK.md)
|
|
414
|
-
- **Tool Definition**: [YAML Tool Specification](../tool-development/YAML_TOOLS.md)
|
|
415
|
-
|