@aglit-ai/sdk 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1665 @@
1
+ # =============================================================================
2
+ # SOURCE FILE - Edit this file directly
3
+ # =============================================================================
4
+ # This OpenAPI spec defines the Tool Builder API schema.
5
+ # It is used to generate TypeScript types in packages/types/src/generated/
6
+ #
7
+ # To regenerate types after editing:
8
+ # node scripts/sync/sync-tool-interface.js
9
+ #
10
+ # Generated files:
11
+ # - packages/types/src/generated/tool-builder-input.ts
12
+ # - packages/desktop-app/src/generated/tool-interface-reference.ts
13
+ # - packages/desktop-app/api/src/generated/tool-interface-reference.ts
14
+ # =============================================================================
15
+
16
+ openapi: 3.1.0
17
+ info:
18
+ title: Aglit Tool Builder API
19
+ version: 1.0.0
20
+ description: |
21
+ API for creating, managing, and executing custom tools in the Aglit desktop app.
22
+
23
+ ## Overview
24
+
25
+ Tools are reusable automation units that agents can invoke. Each tool lives in
26
+ `~/.aglit-ai/tools/<tool-id>/` and contains implementation files plus metadata.
27
+
28
+ ### Tool Types
29
+
30
+ | Type | Entry Point | Use Case |
31
+ |------|-------------|----------|
32
+ | `script` | `main.sh` | Shell/CLI automation, orchestration |
33
+ | `actions` | `main.actions` | Browser and desktop app workflows |
34
+
35
+ ### Versioning
36
+
37
+ Tool directories are git repositories. Every save commits a new version, enabling
38
+ rollback via the Versions tab. The backend uses the recorded `commitId` during execution.
39
+
40
+ ### Security
41
+
42
+ - **Browser tools**: Use `browserProfileId` to control cookies, storage, and sandbox settings
43
+ - **Shell tools**: Execute through the native terminal backend in the managed VM
44
+
45
+ ### Live Streams
46
+
47
+ Browser, terminal, and desktop tools automatically start live streams visible in the UI.
48
+ Responses include `streamId` and `streamUrl` for integration.
49
+
50
+ contact:
51
+ name: Aglit Support
52
+ url: https://aglit.ai
53
+ license:
54
+ name: Proprietary
55
+ url: https://aglit.ai/terms
56
+
57
+ servers:
58
+ - url: http://127.0.0.1:{port}
59
+ description: |
60
+ Local desktop app server (SSOT). Runtime uses SERVER_PORT or PORT; update this default if the
61
+ expected local port changes so generated clients and docs stay in sync. Production default is
62
+ 49117; local dev commonly runs on 49118.
63
+ variables:
64
+ port:
65
+ default: '49117'
66
+ description: Express server port (set via SERVER_PORT or PORT env var)
67
+
68
+ tags:
69
+ - name: Tools
70
+ description: |
71
+ CRUD operations for custom tool management.
72
+
73
+ Tools are stored in `~/.aglit-ai/tools/<tool-id>/` with implementation files
74
+ and metadata. Use `/system/write-tool-file` to upload scripts after creating
75
+ the tool record.
76
+ - name: Execution
77
+ description: |
78
+ Execute tools via JSON-RPC endpoint.
79
+
80
+ The same endpoint powers the Tool Test modal and agent invocations.
81
+ Provide `sessionId` in context to group logs.
82
+ - name: Files
83
+ description: |
84
+ Read and write tool implementation files.
85
+
86
+ Files are sandboxed to the tool directory. The backend rejects writes
87
+ that escape the sandbox.
88
+
89
+ paths:
90
+ /user/tools:
91
+ get:
92
+ operationId: listTools
93
+ summary: List all tools
94
+ description: |
95
+ Returns first-party and custom tools available to the current user.
96
+ Use this to discover tool IDs for execution or management.
97
+ tags: [Tools]
98
+ responses:
99
+ '200':
100
+ description: List of tools
101
+ content:
102
+ application/json:
103
+ schema:
104
+ type: object
105
+ properties:
106
+ tools:
107
+ type: array
108
+ items:
109
+ $ref: '#/components/schemas/ToolSummary'
110
+ total:
111
+ type: integer
112
+ description: Total number of tools
113
+ example:
114
+ tools:
115
+ - id: "custom-tool-abc123"
116
+ name: "S3 Log Archiver"
117
+ description: "Archives logs to S3 bucket"
118
+ categories: ["Shell", "AWS"]
119
+ type: "script"
120
+ - id: "p1_browser_session"
121
+ name: "Browser Session"
122
+ description: "Manage browser sessions and navigation"
123
+ categories: ["Browser", "Automation"]
124
+ type: "actions"
125
+ total: 2
126
+
127
+ post:
128
+ operationId: createTool
129
+ summary: Create a custom tool
130
+ description: |
131
+ Creates a new custom tool record. After creation, use `/system/write-tool-file`
132
+ to upload implementation files to `~/.aglit-ai/tools/<tool-id>/`.
133
+
134
+ The tool directory is initialized as a git repository for version tracking.
135
+ tags: [Tools]
136
+ requestBody:
137
+ required: true
138
+ content:
139
+ application/json:
140
+ schema:
141
+ $ref: '#/components/schemas/CreateToolRequest'
142
+ examples:
143
+ shellTool:
144
+ summary: Shell script tool
145
+ value:
146
+ tool:
147
+ name: "Log Archiver"
148
+ description: "Archives and compresses logs to S3"
149
+ categories: ["Shell", "AWS"]
150
+ type: "script"
151
+ providerId: "custom"
152
+ inputSchema:
153
+ type: object
154
+ properties:
155
+ bucket:
156
+ type: string
157
+ description: S3 bucket name
158
+ days:
159
+ type: integer
160
+ minimum: 1
161
+ description: Retention window in days
162
+ required: ["bucket"]
163
+ outputSchema:
164
+ type: object
165
+ properties:
166
+ filesArchived:
167
+ type: integer
168
+ description: Number of files archived
169
+ totalBytes:
170
+ type: integer
171
+ description: Total bytes uploaded
172
+ archiveUrl:
173
+ type: string
174
+ description: S3 URL of the archive
175
+ required: ["filesArchived", "totalBytes"]
176
+ body:
177
+ kind: "code"
178
+ filePath: "main.sh"
179
+ language: "bash"
180
+ documentation: "Uploads logs older than N days to S3"
181
+ testCases: []
182
+ browserTool:
183
+ summary: Browser automation tool
184
+ value:
185
+ tool:
186
+ name: "Screenshot Page"
187
+ description: "Captures full-page screenshot of a URL"
188
+ categories: ["Browser", "Automation"]
189
+ type: "actions"
190
+ providerId: "custom"
191
+ inputSchema:
192
+ type: object
193
+ properties:
194
+ url:
195
+ type: string
196
+ description: URL to screenshot
197
+ fullPage:
198
+ type: boolean
199
+ default: true
200
+ description: Capture full scrollable page
201
+ required: ["url"]
202
+ outputSchema:
203
+ type: object
204
+ properties:
205
+ windowId:
206
+ type: string
207
+ description: Browser session ID
208
+ screenshotPath:
209
+ type: string
210
+ description: Path to screenshot file
211
+ title:
212
+ type: string
213
+ description: Page title
214
+ required: ["windowId", "screenshotPath"]
215
+ testCases: []
216
+ responses:
217
+ '200':
218
+ description: Tool created successfully
219
+ content:
220
+ application/json:
221
+ schema:
222
+ $ref: '#/components/schemas/ToolRecord'
223
+ '400':
224
+ description: Invalid tool configuration
225
+ content:
226
+ application/json:
227
+ schema:
228
+ $ref: '#/components/schemas/ErrorResponse'
229
+
230
+ /user/tools/{toolId}:
231
+ parameters:
232
+ - name: toolId
233
+ in: path
234
+ required: true
235
+ schema:
236
+ type: string
237
+ description: Tool identifier
238
+ example: "{{toolId}}"
239
+
240
+ put:
241
+ operationId: updateTool
242
+ summary: Update tool metadata and schemas
243
+ description: |
244
+ Updates an existing tool's metadata, schemas, or security settings.
245
+ Creates a new git commit for version tracking.
246
+
247
+ Pair with `/system/write-tool-file` when implementation changes.
248
+ tags: [Tools]
249
+ requestBody:
250
+ required: true
251
+ content:
252
+ application/json:
253
+ schema:
254
+ $ref: '#/components/schemas/UpdateToolRequest'
255
+ example:
256
+ tool:
257
+ id: "{{toolId}}"
258
+ name: "Log Archiver v2"
259
+ description: "Archives, compresses, and encrypts logs to S3"
260
+ categories: ["Shell", "AWS", "Security"]
261
+ type: "script"
262
+ providerId: "custom"
263
+ inputSchema:
264
+ type: object
265
+ properties:
266
+ bucket:
267
+ type: string
268
+ description: S3 bucket name
269
+ days:
270
+ type: integer
271
+ minimum: 1
272
+ description: Retention window
273
+ encrypt:
274
+ type: boolean
275
+ default: false
276
+ description: Enable AES-256 encryption
277
+ required: ["bucket"]
278
+ outputSchema:
279
+ type: object
280
+ properties:
281
+ filesArchived:
282
+ type: integer
283
+ totalBytes:
284
+ type: integer
285
+ archiveUrl:
286
+ type: string
287
+ encrypted:
288
+ type: boolean
289
+ required: ["filesArchived"]
290
+ body:
291
+ kind: "code"
292
+ filePath: "main.sh"
293
+ language: "bash"
294
+ documentation: "Updated with encryption support"
295
+ testCases: []
296
+ responses:
297
+ '200':
298
+ description: Tool updated successfully
299
+ content:
300
+ application/json:
301
+ schema:
302
+ $ref: '#/components/schemas/ToolRecord'
303
+ '404':
304
+ description: Tool not found
305
+
306
+ delete:
307
+ operationId: deleteTool
308
+ summary: Delete tool or version
309
+ description: |
310
+ Deletes a tool entirely or removes a specific version.
311
+
312
+ - Without `version` query param: Deletes entire tool directory and git history
313
+ - With `version=N`: Removes only that historical revision
314
+ tags: [Tools]
315
+ parameters:
316
+ - name: version
317
+ in: query
318
+ schema:
319
+ type: integer
320
+ description: Specific version to delete (omit to delete entire tool)
321
+ responses:
322
+ '200':
323
+ description: Tool or version deleted
324
+ '404':
325
+ description: Tool or version not found
326
+
327
+ /agents/{agentId}/tools/execute:
328
+ parameters:
329
+ - name: agentId
330
+ in: path
331
+ required: true
332
+ schema:
333
+ type: string
334
+ description: Agent executing the tool
335
+ example: "root-agent"
336
+
337
+ post:
338
+ operationId: executeTool
339
+ summary: Execute a tool via JSON-RPC
340
+ description: |
341
+ Executes any available tool (first-party or custom) via JSON-RPC 2.0.
342
+
343
+ This is the same endpoint used by the Tool Test modal and agent invocations.
344
+ The response `result` field contains the tool's output matching its `outputSchema`.
345
+
346
+ ### Context
347
+
348
+ Provide `sessionId` in the `context` object to group logs and associate
349
+ the execution with a conversation session.
350
+
351
+ ### Environment Variables
352
+
353
+ Custom tools receive these environment variables in `main.sh`:
354
+
355
+ | Variable | Description |
356
+ |----------|-------------|
357
+ | `AGLIT_AGENT_ID` | Agent executing the tool |
358
+ | `AGLIT_SESSION_ID` | Session ID for log grouping |
359
+ | `AGLIT_SERVER_PORT` | Express server port |
360
+ | `AGLIT_API_URL` | Full API base URL |
361
+ | `AGLIT_TOOL_ID` | Current tool's ID |
362
+ | `AGLIT_TOOL_DIR` | Path to tool directory |
363
+ tags: [Execution]
364
+ requestBody:
365
+ required: true
366
+ content:
367
+ application/json:
368
+ schema:
369
+ $ref: '#/components/schemas/ToolExecutionRequest'
370
+ examples:
371
+ shellTool:
372
+ summary: Execute shell tool
373
+ value:
374
+ jsonrpc: "2.0"
375
+ id: "exec-001"
376
+ params:
377
+ name: "p1_system"
378
+ arguments:
379
+ action: "speak"
380
+ text: "Hello from the API docs"
381
+ x_aglit_ai_tool_reason: "Docs demo: speak text"
382
+ context:
383
+ sessionId: "session-xyz"
384
+ agentId: "root-agent"
385
+ _meta:
386
+ sessionId: "session-xyz"
387
+ conversationSessionId: "session-xyz"
388
+ stream: false
389
+ toolInvocationTemplate:
390
+ summary: Execute any tool (template)
391
+ value:
392
+ jsonrpc: "2.0"
393
+ id: "exec-template"
394
+ params:
395
+ name: "{{toolName}}"
396
+ arguments:
397
+ x_aglit_ai_tool_reason: "Docs example execution"
398
+ context:
399
+ sessionId: "docs-session"
400
+ agentId: "root-agent"
401
+ _meta:
402
+ sessionId: "docs-session"
403
+ terminalApprovalWithImage:
404
+ summary: Request approval for an opaque terminal deployment with visual context
405
+ value:
406
+ jsonrpc: "2.0"
407
+ id: "deploy-mobile"
408
+ params:
409
+ name: "p1_terminal"
410
+ arguments:
411
+ action: "type"
412
+ text: "pnpm --filter @aglit-ai/mobile-app run deploy:testflight"
413
+ submit_command: true
414
+ x_aglit_ai_tool_reason: "Deploy the new mobile app to TestFlight"
415
+ x_aglit_ai_approval_request: "Can I deploy the new mobile app?"
416
+ x_aglit_ai_tool_approval_image: "/session-assets/root-agent/docs-session/proofs/mobile-current.png"
417
+ context:
418
+ sessionId: "docs-session"
419
+ agentId: "root-agent"
420
+ createChat:
421
+ summary: Create a chat session via tool execution
422
+ value:
423
+ jsonrpc: "2.0"
424
+ id: "exec-create-chat"
425
+ params:
426
+ name: "p1_system_create_chat"
427
+ arguments:
428
+ initial_text: "Spin up a chat that triages my PagerDuty incidents."
429
+ agent_id: "root-agent"
430
+ context: "You are the hidden incident orchestration guide."
431
+ x_aglit_ai_tool_reason: "Docs example: create chat"
432
+ context:
433
+ sessionId: "docs-session"
434
+ agentId: "root-agent"
435
+ _meta:
436
+ sessionId: "docs-session"
437
+ followUpChat:
438
+ summary: Send a follow-up message via tool execution
439
+ value:
440
+ jsonrpc: "2.0"
441
+ id: "exec-follow-up"
442
+ params:
443
+ name: "p1_system_send_follow_up_chat"
444
+ arguments:
445
+ follow_up_text: "Summarize any open incidents."
446
+ agent_id: "root-agent"
447
+ session_id: "{{sessionId}}"
448
+ history_limit: 20
449
+ x_aglit_ai_tool_reason: "Docs example: follow-up chat"
450
+ context:
451
+ sessionId: "docs-session"
452
+ agentId: "root-agent"
453
+ _meta:
454
+ sessionId: "docs-session"
455
+ browserTool:
456
+ summary: Execute browser tool
457
+ value:
458
+ jsonrpc: "2.0"
459
+ id: "exec-002"
460
+ params:
461
+ name: "p1_browser_session"
462
+ arguments:
463
+ operation: "navigate"
464
+ url: "https://example.com"
465
+ x_aglit_ai_tool_reason: "Load example page"
466
+ context:
467
+ sessionId: "session-xyz"
468
+ agentId: "root-agent"
469
+ _meta:
470
+ sessionId: "session-xyz"
471
+ stream: false
472
+ responses:
473
+ '200':
474
+ description: Tool executed successfully
475
+ content:
476
+ application/json:
477
+ schema:
478
+ $ref: '#/components/schemas/ToolExecutionResponse'
479
+ examples:
480
+ shellToolResult:
481
+ summary: Shell tool result
482
+ value:
483
+ jsonrpc: "2.0"
484
+ id: "exec-001"
485
+ result:
486
+ filesArchived: 42
487
+ totalBytes: 1048576
488
+ archiveUrl: "s3://my-logs-bucket/archive-2024-01-15.tar.gz"
489
+ browserToolResult:
490
+ summary: Browser tool result
491
+ value:
492
+ jsonrpc: "2.0"
493
+ id: "exec-002"
494
+ result:
495
+ windowId: "browser-session-abc"
496
+ url: "https://example.com"
497
+ title: "Example Domain"
498
+ capturePath: "/path/to/captures/session-xyz"
499
+ screenshotPath: "/path/to/captures/session-xyz/screenshot.png"
500
+ traceZipPath: "/path/to/captures/session-xyz/trace-001.zip"
501
+ toolError:
502
+ summary: Tool execution error
503
+ value:
504
+ jsonrpc: "2.0"
505
+ id: "exec-001"
506
+ error:
507
+ code: -32000
508
+ message: "Tool execution failed: S3 bucket not found"
509
+
510
+ /system/write-tool-file:
511
+ post:
512
+ operationId: writeToolFile
513
+ summary: Write implementation file
514
+ description: |
515
+ Writes a file to the tool's directory (`~/.aglit-ai/tools/<tool-id>/`).
516
+
517
+ Files are sandboxed - the backend rejects paths that escape the tool directory.
518
+ Set `makeExecutable: true` for scripts that need execute permission.
519
+ tags: [Files]
520
+ requestBody:
521
+ required: true
522
+ content:
523
+ application/json:
524
+ schema:
525
+ $ref: '#/components/schemas/WriteFileRequest'
526
+ example:
527
+ toolId: "{{toolId}}"
528
+ filePath: "main.sh"
529
+ content: |
530
+ #!/bin/bash
531
+ set -euo pipefail
532
+
533
+ BUCKET="$1"
534
+ DAYS="${2:-7}"
535
+
536
+ # Archive logs older than N days
537
+ find /var/log -mtime +$DAYS -type f | while read f; do
538
+ aws s3 cp "$f" "s3://$BUCKET/$(basename $f)"
539
+ done
540
+
541
+ echo '{"filesArchived": 42, "totalBytes": 1048576}'
542
+ makeExecutable: true
543
+ responses:
544
+ '200':
545
+ description: File written successfully
546
+ '400':
547
+ description: Invalid path or content
548
+ '403':
549
+ description: Path escapes tool directory sandbox
550
+
551
+ /system/read-tool-file:
552
+ post:
553
+ operationId: readToolFile
554
+ summary: Read implementation file
555
+ description: |
556
+ Reads a file from the tool's directory.
557
+
558
+ Use this to fetch existing implementation files for editing.
559
+ tags: [Files]
560
+ requestBody:
561
+ required: true
562
+ content:
563
+ application/json:
564
+ schema:
565
+ $ref: '#/components/schemas/ReadFileRequest'
566
+ example:
567
+ toolId: "custom-tool-abc123"
568
+ filePath: "main.sh"
569
+ responses:
570
+ '200':
571
+ description: File content
572
+ content:
573
+ application/json:
574
+ schema:
575
+ type: object
576
+ properties:
577
+ content:
578
+ type: string
579
+ description: File contents
580
+ path:
581
+ type: string
582
+ description: Absolute path to file
583
+ '404':
584
+ description: File not found
585
+
586
+ components:
587
+ schemas:
588
+ # ============================================================
589
+ # Tool Configuration Schemas
590
+ # ============================================================
591
+
592
+ ToolSummary:
593
+ type: object
594
+ description: Brief tool information for listing
595
+ properties:
596
+ id:
597
+ type: string
598
+ description: Unique tool identifier
599
+ name:
600
+ type: string
601
+ description: Display name
602
+ description:
603
+ type: string
604
+ description: Brief description of tool behavior
605
+ appId:
606
+ type: string
607
+ description: Optional app bundle ID this tool targets
608
+ website:
609
+ type: string
610
+ description: Optional website domain this tool targets
611
+ categories:
612
+ type: array
613
+ items:
614
+ type: string
615
+ description: Tool categories (Shell, Browser, API, etc.)
616
+ sampleUtterances:
617
+ type: array
618
+ items:
619
+ type: string
620
+ description: Example phrases used to improve tool recommendation relevance
621
+ type:
622
+ type: string
623
+ enum: [script, actions]
624
+ description: Implementation type
625
+ required: [id, name, type]
626
+
627
+ ToolRecord:
628
+ type: object
629
+ description: |
630
+ Complete tool configuration record.
631
+
632
+ This is the full tool metadata stored in the system, including
633
+ input/output schemas, security settings, and implementation details.
634
+ allOf:
635
+ - $ref: '#/components/schemas/ToolSummary'
636
+ - type: object
637
+ properties:
638
+ providerId:
639
+ type: string
640
+ description: Provider that owns this tool (custom, system, mcp-*)
641
+ inputSchema:
642
+ $ref: '#/components/schemas/ToolInputSchema'
643
+ outputSchema:
644
+ $ref: '#/components/schemas/ToolOutputSchema'
645
+ body:
646
+ $ref: '#/components/schemas/ToolBody'
647
+ security:
648
+ $ref: '#/components/schemas/ToolSecurity'
649
+ commitId:
650
+ type: string
651
+ description: Git commit SHA for version tracking
652
+ createdAt:
653
+ type: string
654
+ format: date-time
655
+ updatedAt:
656
+ type: string
657
+ format: date-time
658
+
659
+ CreateToolRequest:
660
+ type: object
661
+ description: Request body for creating a new tool
662
+ properties:
663
+ tool:
664
+ type: object
665
+ properties:
666
+ name:
667
+ type: string
668
+ description: Display name for the tool
669
+ description:
670
+ type: string
671
+ description: Detailed explanation of tool behavior
672
+ appId:
673
+ type: string
674
+ description: Optional app bundle ID this tool targets
675
+ website:
676
+ type: string
677
+ description: Optional website domain this tool targets
678
+ categories:
679
+ type: array
680
+ items:
681
+ type: string
682
+ minItems: 1
683
+ description: Tool categories (Shell, Browser, API, etc.)
684
+ sampleUtterances:
685
+ type: array
686
+ items:
687
+ type: string
688
+ description: Example phrases used to improve tool recommendation relevance
689
+ type:
690
+ type: string
691
+ enum: [script, actions]
692
+ description: |
693
+ Implementation style:
694
+ - `script`: Shell/Python/Node scripts executed via main.sh
695
+ - `actions`: Browser or desktop workflows via main.actions
696
+ providerId:
697
+ type: string
698
+ default: custom
699
+ description: Provider identifier (use "custom" for user-created tools)
700
+ inputSchema:
701
+ $ref: '#/components/schemas/ToolInputSchema'
702
+ outputSchema:
703
+ $ref: '#/components/schemas/ToolOutputSchema'
704
+ body:
705
+ $ref: '#/components/schemas/ToolBody'
706
+ security:
707
+ $ref: '#/components/schemas/ToolSecurity'
708
+ required: [name, description, categories, type, inputSchema, outputSchema]
709
+ testCases:
710
+ type: array
711
+ items:
712
+ $ref: '#/components/schemas/ToolTestCase'
713
+ description: Optional test cases for the tool
714
+ required: [tool]
715
+
716
+ UpdateToolRequest:
717
+ type: object
718
+ description: Request body for updating an existing tool
719
+ properties:
720
+ tool:
721
+ type: object
722
+ properties:
723
+ id:
724
+ type: string
725
+ description: Tool identifier (must match path parameter)
726
+ name:
727
+ type: string
728
+ description:
729
+ type: string
730
+ appId:
731
+ type: string
732
+ description: Optional app bundle ID this tool targets
733
+ website:
734
+ type: string
735
+ description: Optional website domain this tool targets
736
+ categories:
737
+ type: array
738
+ items:
739
+ type: string
740
+ sampleUtterances:
741
+ type: array
742
+ items:
743
+ type: string
744
+ type:
745
+ type: string
746
+ enum: [script, actions]
747
+ providerId:
748
+ type: string
749
+ inputSchema:
750
+ $ref: '#/components/schemas/ToolInputSchema'
751
+ outputSchema:
752
+ $ref: '#/components/schemas/ToolOutputSchema'
753
+ body:
754
+ $ref: '#/components/schemas/ToolBody'
755
+ security:
756
+ $ref: '#/components/schemas/ToolSecurity'
757
+ required: [id]
758
+ testCases:
759
+ type: array
760
+ items:
761
+ $ref: '#/components/schemas/ToolTestCase'
762
+ required: [tool]
763
+
764
+ # ============================================================
765
+ # Schema Definitions
766
+ # ============================================================
767
+
768
+ ToolInputSchema:
769
+ type: object
770
+ description: |
771
+ JSON Schema describing tool input parameters.
772
+
773
+ These appear as form fields in the Tool Test modal and are passed
774
+ as `arguments` during tool invocation.
775
+ properties:
776
+ type:
777
+ type: string
778
+ const: object
779
+ description: Input schema root must be object type
780
+ properties:
781
+ type: object
782
+ additionalProperties:
783
+ $ref: '#/components/schemas/ParameterSchema'
784
+ description: Map of parameter names to their schemas
785
+ required:
786
+ type: array
787
+ items:
788
+ type: string
789
+ description: List of required parameter names
790
+ additionalProperties:
791
+ type: boolean
792
+ default: false
793
+ required: [type, properties]
794
+ example:
795
+ type: object
796
+ properties:
797
+ bucket:
798
+ type: string
799
+ description: S3 bucket name
800
+ days:
801
+ type: integer
802
+ minimum: 1
803
+ description: Retention window in days
804
+ required: ["bucket"]
805
+
806
+ ToolOutputSchema:
807
+ type: object
808
+ description: |
809
+ JSON Schema describing the tool's return value.
810
+
811
+ Agents use this to parse results and chain outputs into subsequent
812
+ tool calls. The schema is validated at runtime.
813
+
814
+ ### Common Patterns
815
+
816
+ | Pattern | Use Case | Example |
817
+ |---------|----------|---------|
818
+ | Single value | Transformations | `{ result: string }` |
819
+ | List result | Search/discovery | `{ items: [], total: number }` |
820
+ | Resource reference | Sessions | `{ windowId, screenshotPath }` |
821
+ | Status report | Operations | `{ success, message, duration }` |
822
+ properties:
823
+ type:
824
+ type: string
825
+ const: object
826
+ description: Output schema root must be object type
827
+ description:
828
+ type: string
829
+ description: Human-readable description of the output
830
+ properties:
831
+ type: object
832
+ additionalProperties:
833
+ $ref: '#/components/schemas/ParameterSchema'
834
+ description: Map of output field names to their schemas
835
+ required:
836
+ type: array
837
+ items:
838
+ type: string
839
+ description: Fields always present in output
840
+ required: [type, properties]
841
+ example:
842
+ type: object
843
+ properties:
844
+ filesArchived:
845
+ type: integer
846
+ description: Number of files archived
847
+ totalBytes:
848
+ type: integer
849
+ description: Total bytes uploaded
850
+ archiveUrl:
851
+ type: string
852
+ description: S3 URL of the archive
853
+ required: ["filesArchived", "totalBytes"]
854
+
855
+ ParameterSchema:
856
+ type: object
857
+ description: JSON Schema definition for a single parameter or output field
858
+ properties:
859
+ type:
860
+ type: string
861
+ enum: [string, number, integer, boolean, array, object]
862
+ description: JSON type
863
+ description:
864
+ type: string
865
+ description: Human-readable description shown in UI and to agents
866
+ default:
867
+ description: Default value if not provided
868
+ enum:
869
+ type: array
870
+ description: Allowed values
871
+ minimum:
872
+ type: number
873
+ description: Minimum value (number/integer)
874
+ maximum:
875
+ type: number
876
+ description: Maximum value (number/integer)
877
+ minLength:
878
+ type: integer
879
+ description: Minimum length (string)
880
+ maxLength:
881
+ type: integer
882
+ description: Maximum length (string)
883
+ pattern:
884
+ type: string
885
+ description: Regex pattern (string)
886
+ items:
887
+ $ref: '#/components/schemas/ParameterSchema'
888
+ description: Schema for array items
889
+ properties:
890
+ type: object
891
+ additionalProperties:
892
+ $ref: '#/components/schemas/ParameterSchema'
893
+ description: Nested properties (object)
894
+ required:
895
+ type: array
896
+ items:
897
+ type: string
898
+ description: Required properties (object)
899
+ required: [type]
900
+
901
+ # ============================================================
902
+ # Tool Implementation
903
+ # ============================================================
904
+
905
+ ToolBody:
906
+ type: object
907
+ description: Tool implementation details
908
+ properties:
909
+ kind:
910
+ type: string
911
+ enum: [code]
912
+ description: Implementation kind (currently only "code" supported)
913
+ filePath:
914
+ type: string
915
+ description: Entry point file relative to tool directory
916
+ default: main.sh
917
+ examples:
918
+ - main.sh
919
+ - main.py
920
+ - index.js
921
+ language:
922
+ type: string
923
+ enum: [bash, python, node, sh, zsh]
924
+ description: Script language
925
+ default: bash
926
+ documentation:
927
+ type: string
928
+ description: Implementation notes shown in UI
929
+ required: [kind, filePath, language]
930
+
931
+ ToolSecurity:
932
+ type: object
933
+ description: |
934
+ Security configuration for tool execution.
935
+
936
+ Browser profiles control browser configuration. Terminal execution uses the managed VM.
937
+ additionalProperties: false
938
+ properties:
939
+ browserProfileId:
940
+ type: string
941
+ description: |
942
+ Browser profile controlling:
943
+ - Cookie and storage isolation
944
+ - Security sandbox settings
945
+ - Default browser preferences
946
+ ToolTestCase:
947
+ type: object
948
+ description: Test case for validating tool behavior
949
+ properties:
950
+ name:
951
+ type: string
952
+ description: Test case name
953
+ input:
954
+ type: object
955
+ description: Input arguments to pass
956
+ expectedOutput:
957
+ type: object
958
+ description: Expected output (partial match)
959
+ timeout:
960
+ type: integer
961
+ description: Timeout in milliseconds
962
+
963
+ # ============================================================
964
+ # Execution Schemas
965
+ # ============================================================
966
+
967
+ ToolExecutionRequest:
968
+ type: object
969
+ description: JSON-RPC 2.0 request for tool execution
970
+ properties:
971
+ jsonrpc:
972
+ type: string
973
+ const: "2.0"
974
+ id:
975
+ type: string
976
+ description: Request identifier for correlation
977
+ method:
978
+ type: string
979
+ const: tools/call
980
+ params:
981
+ type: object
982
+ properties:
983
+ name:
984
+ type: string
985
+ description: Tool ID to execute
986
+ arguments:
987
+ type: object
988
+ description: |
989
+ Tool arguments matching the tool's `inputSchema`.
990
+
991
+ Include `x_aglit_ai_tool_reason` to annotate why the tool is being called. This field is required for auditability and must clearly state what specific action is being performed. Never use generic phrases like "Using a tool" - always describe the actual purpose.
992
+ properties:
993
+ x_aglit_ai_tool_reason:
994
+ type: string
995
+ description: A concise, specific description of what this tool call will accomplish. Describe the actual action and purpose, not just "Using a tool". Examples - "Searching for Journal pages in Notion", "Navigating to news.yahoo.com to find today's headlines", "Reading the user's calendar events for today".
996
+ x_aglit_ai_tool_approval_image:
997
+ type: string
998
+ description: Optional contextual image that should reference a recent, nonblank, existing /session-assets/<agentId>/<sessionId>/... image from the exact executing agent/session. Strongly recommended when it helps the user understand the action, especially in phone notifications, but omission never blocks creation of the approval. When valid, it is shown above the normal approval preview and attached to mobile approval notifications.
999
+ required: [x_aglit_ai_tool_reason]
1000
+ additionalProperties: true
1001
+ required: [name, arguments]
1002
+ context:
1003
+ type: object
1004
+ description: Execution context
1005
+ properties:
1006
+ sessionId:
1007
+ type: string
1008
+ description: Session ID for log grouping
1009
+ agentId:
1010
+ type: string
1011
+ description: Agent executing the tool
1012
+ _meta:
1013
+ type: object
1014
+ description: Internal metadata
1015
+ properties:
1016
+ sessionId:
1017
+ type: string
1018
+ conversationSessionId:
1019
+ type: string
1020
+ stream:
1021
+ type: boolean
1022
+ description: Enable streaming responses
1023
+ required: [jsonrpc, id, method, params]
1024
+
1025
+ ToolExecutionResponse:
1026
+ type: object
1027
+ description: |
1028
+ JSON-RPC 2.0 response from tool execution.
1029
+
1030
+ The `result` field contains the tool's output matching its `outputSchema`.
1031
+ For errors, the `error` field contains details.
1032
+ properties:
1033
+ jsonrpc:
1034
+ type: string
1035
+ const: "2.0"
1036
+ id:
1037
+ type: string
1038
+ description: Request identifier (echoed from request)
1039
+ result:
1040
+ type: object
1041
+ description: |
1042
+ Tool output matching the tool's `outputSchema`.
1043
+
1044
+ For browser tools, commonly includes:
1045
+ - `windowId`: Session identifier
1046
+ - `url`, `title`: Page information
1047
+ - `screenshotPath`, `capturePath`: Artifact paths
1048
+ - `traceZipPath`: Playwright trace
1049
+
1050
+ For shell tools, contains the JSON output from stdout.
1051
+ error:
1052
+ $ref: '#/components/schemas/JsonRpcError'
1053
+
1054
+ JsonRpcError:
1055
+ type: object
1056
+ description: JSON-RPC 2.0 error object
1057
+ properties:
1058
+ code:
1059
+ type: integer
1060
+ description: Error code (-32000 for tool errors)
1061
+ message:
1062
+ type: string
1063
+ description: Human-readable error message
1064
+ data:
1065
+ type: object
1066
+ description: Additional error details
1067
+
1068
+ # ============================================================
1069
+ # File Operations
1070
+ # ============================================================
1071
+
1072
+ WriteFileRequest:
1073
+ type: object
1074
+ properties:
1075
+ toolId:
1076
+ type: string
1077
+ description: Tool identifier
1078
+ filePath:
1079
+ type: string
1080
+ description: |
1081
+ File path relative to tool directory.
1082
+ Cannot escape the tool directory sandbox.
1083
+ content:
1084
+ type: string
1085
+ description: File content to write
1086
+ makeExecutable:
1087
+ type: boolean
1088
+ default: false
1089
+ description: Set executable permission (for scripts)
1090
+ required: [toolId, filePath, content]
1091
+
1092
+ ReadFileRequest:
1093
+ type: object
1094
+ properties:
1095
+ toolId:
1096
+ type: string
1097
+ description: Tool identifier
1098
+ filePath:
1099
+ type: string
1100
+ description: File path relative to tool directory
1101
+ required: [toolId, filePath]
1102
+
1103
+ ErrorResponse:
1104
+ type: object
1105
+ properties:
1106
+ error:
1107
+ type: string
1108
+ description: Error message
1109
+ code:
1110
+ type: string
1111
+ description: Error code
1112
+ details:
1113
+ type: object
1114
+ description: Additional error details
1115
+
1116
+ # ============================================================
1117
+ # Tool-Type Specific Output Schemas (for reference)
1118
+ # ============================================================
1119
+
1120
+ x-output-schema-patterns:
1121
+ description: |
1122
+ Common output schema patterns for different tool types.
1123
+ Reference these when defining `outputSchema` for custom tools.
1124
+
1125
+ shellToolOutput:
1126
+ description: |
1127
+ Shell tools should output JSON to stdout. Common patterns:
1128
+ examples:
1129
+ - name: File Processing
1130
+ schema:
1131
+ type: object
1132
+ properties:
1133
+ processedFiles:
1134
+ type: integer
1135
+ description: Number of files processed
1136
+ outputPath:
1137
+ type: string
1138
+ description: Path to generated output
1139
+ errors:
1140
+ type: array
1141
+ items:
1142
+ type: string
1143
+ description: Files that failed
1144
+ required: [processedFiles]
1145
+
1146
+ - name: API Call
1147
+ schema:
1148
+ type: object
1149
+ properties:
1150
+ statusCode:
1151
+ type: integer
1152
+ body:
1153
+ type: object
1154
+ headers:
1155
+ type: object
1156
+ required: [statusCode, body]
1157
+
1158
+ - name: Data Transformation
1159
+ schema:
1160
+ type: object
1161
+ properties:
1162
+ inputRows:
1163
+ type: integer
1164
+ outputRows:
1165
+ type: integer
1166
+ transformations:
1167
+ type: array
1168
+ items:
1169
+ type: string
1170
+ required: [inputRows, outputRows]
1171
+
1172
+ browserToolOutput:
1173
+ description: |
1174
+ Browser tools return session references and capture artifacts.
1175
+ examples:
1176
+ - name: Navigation
1177
+ schema:
1178
+ type: object
1179
+ properties:
1180
+ windowId:
1181
+ type: string
1182
+ description: Browser session ID for subsequent operations
1183
+ url:
1184
+ type: string
1185
+ description: Current page URL
1186
+ title:
1187
+ type: string
1188
+ description: Page title
1189
+ capturePath:
1190
+ type: string
1191
+ description: Directory with capture files
1192
+ screenshotPath:
1193
+ type: string
1194
+ description: Path to screenshot
1195
+ traceZipPath:
1196
+ type: string
1197
+ description: Playwright trace ZIP (network, DOM, actions)
1198
+ consoleLogsPath:
1199
+ type: string
1200
+ description: Browser console JSON
1201
+ required: [windowId, url]
1202
+
1203
+ - name: JavaScript Execution
1204
+ schema:
1205
+ type: object
1206
+ properties:
1207
+ result:
1208
+ description: Return value from script
1209
+ consoleOutput:
1210
+ type: array
1211
+ items:
1212
+ type: string
1213
+ error:
1214
+ type: string
1215
+ required: [result]
1216
+
1217
+ - name: Tab Listing
1218
+ schema:
1219
+ type: object
1220
+ properties:
1221
+ tabs:
1222
+ type: array
1223
+ items:
1224
+ type: object
1225
+ properties:
1226
+ index:
1227
+ type: integer
1228
+ title:
1229
+ type: string
1230
+ url:
1231
+ type: string
1232
+ active:
1233
+ type: boolean
1234
+ activeTabIndex:
1235
+ type: integer
1236
+ required: [tabs]
1237
+
1238
+ desktopAppToolOutput:
1239
+ description: |
1240
+ Desktop app tools return window references and accessibility data.
1241
+ examples:
1242
+ - name: View Application
1243
+ schema:
1244
+ type: object
1245
+ properties:
1246
+ appName:
1247
+ type: string
1248
+ appId:
1249
+ type: string
1250
+ description: Bundle ID (e.g., com.apple.reminders)
1251
+ windows:
1252
+ type: array
1253
+ items:
1254
+ type: object
1255
+ properties:
1256
+ windowId:
1257
+ type: string
1258
+ title:
1259
+ type: string
1260
+ bounds:
1261
+ type: object
1262
+ properties:
1263
+ x:
1264
+ type: number
1265
+ y:
1266
+ type: number
1267
+ width:
1268
+ type: number
1269
+ height:
1270
+ type: number
1271
+ screenshotPath:
1272
+ type: string
1273
+ accessibilityTree:
1274
+ type: object
1275
+ scriptingInfo:
1276
+ type: object
1277
+ required: [appName, appId, windows]
1278
+
1279
+ - name: Click/Type Action
1280
+ schema:
1281
+ type: object
1282
+ properties:
1283
+ success:
1284
+ type: boolean
1285
+ x:
1286
+ type: number
1287
+ y:
1288
+ type: number
1289
+ screenshotPath:
1290
+ type: string
1291
+ required: [success]
1292
+
1293
+ mcpToolOutput:
1294
+ description: |
1295
+ MCP tools return provider-specific data wrapped in content blocks.
1296
+ examples:
1297
+ - name: Generic Content Blocks
1298
+ schema:
1299
+ type: object
1300
+ properties:
1301
+ content:
1302
+ type: array
1303
+ items:
1304
+ type: object
1305
+ properties:
1306
+ type:
1307
+ type: string
1308
+ enum: [text, image, resource]
1309
+ text:
1310
+ type: string
1311
+ data:
1312
+ type: string
1313
+ description: Base64-encoded
1314
+ mimeType:
1315
+ type: string
1316
+ isError:
1317
+ type: boolean
1318
+ required: [content]
1319
+
1320
+ - name: Database Query (Notion, Airtable)
1321
+ schema:
1322
+ type: object
1323
+ properties:
1324
+ results:
1325
+ type: array
1326
+ items:
1327
+ type: object
1328
+ hasMore:
1329
+ type: boolean
1330
+ nextCursor:
1331
+ type: string
1332
+ required: [results]
1333
+
1334
+ fileToolOutput:
1335
+ description: |
1336
+ File tools return operation results and file metadata.
1337
+ examples:
1338
+ - name: File View
1339
+ schema:
1340
+ type: object
1341
+ properties:
1342
+ content:
1343
+ type: string
1344
+ description: File contents (may be truncated)
1345
+ isTruncated:
1346
+ type: boolean
1347
+ description: True if content was truncated
1348
+ totalLines:
1349
+ type: integer
1350
+ description: Total line count
1351
+ filePath:
1352
+ type: string
1353
+ description: Absolute path to file
1354
+ mimeType:
1355
+ type: string
1356
+ description: Detected MIME type
1357
+ required: [content, filePath]
1358
+
1359
+ - name: File Write/Update
1360
+ schema:
1361
+ type: object
1362
+ properties:
1363
+ success:
1364
+ type: boolean
1365
+ filePath:
1366
+ type: string
1367
+ bytesWritten:
1368
+ type: integer
1369
+ diff:
1370
+ type: string
1371
+ description: Unified diff for updates
1372
+ required: [success, filePath]
1373
+
1374
+ - name: Image Analysis
1375
+ schema:
1376
+ type: object
1377
+ properties:
1378
+ analysis:
1379
+ type: string
1380
+ description: AI-generated analysis
1381
+ boundingBoxes:
1382
+ type: array
1383
+ items:
1384
+ type: object
1385
+ properties:
1386
+ label:
1387
+ type: string
1388
+ coordinates:
1389
+ type: object
1390
+ filePath:
1391
+ type: string
1392
+ required: [analysis]
1393
+
1394
+ terminalToolOutput:
1395
+ description: |
1396
+ Terminal tools return session references and command output.
1397
+ examples:
1398
+ - name: Open Terminal
1399
+ schema:
1400
+ type: object
1401
+ properties:
1402
+ windowId:
1403
+ type: string
1404
+ description: Terminal session ID for subsequent operations
1405
+ streamId:
1406
+ type: string
1407
+ description: Live stream ID
1408
+ cwd:
1409
+ type: string
1410
+ description: Current working directory
1411
+ required: [windowId]
1412
+
1413
+ - name: Type Command
1414
+ schema:
1415
+ type: object
1416
+ properties:
1417
+ windowId:
1418
+ type: string
1419
+ output:
1420
+ type: string
1421
+ description: Terminal output after command
1422
+ exitCode:
1423
+ type: integer
1424
+ description: Command exit code (if available)
1425
+ required: [windowId]
1426
+
1427
+ - name: View Terminal
1428
+ schema:
1429
+ type: object
1430
+ properties:
1431
+ windowId:
1432
+ type: string
1433
+ content:
1434
+ type: string
1435
+ description: Current terminal buffer content
1436
+ rows:
1437
+ type: integer
1438
+ cols:
1439
+ type: integer
1440
+ required: [windowId, content]
1441
+
1442
+ appToolOutput:
1443
+ description: |
1444
+ App tools return application state and accessibility data.
1445
+ examples:
1446
+ - name: Calendar/Reminders Query
1447
+ schema:
1448
+ type: object
1449
+ properties:
1450
+ items:
1451
+ type: array
1452
+ items:
1453
+ type: object
1454
+ properties:
1455
+ id:
1456
+ type: string
1457
+ title:
1458
+ type: string
1459
+ date:
1460
+ type: string
1461
+ count:
1462
+ type: integer
1463
+ required: [items]
1464
+
1465
+ - name: Mail/Messages
1466
+ schema:
1467
+ type: object
1468
+ properties:
1469
+ messages:
1470
+ type: array
1471
+ items:
1472
+ type: object
1473
+ properties:
1474
+ id:
1475
+ type: string
1476
+ subject:
1477
+ type: string
1478
+ sender:
1479
+ type: string
1480
+ date:
1481
+ type: string
1482
+ total:
1483
+ type: integer
1484
+ required: [messages]
1485
+
1486
+ - name: Contacts
1487
+ schema:
1488
+ type: object
1489
+ properties:
1490
+ contacts:
1491
+ type: array
1492
+ items:
1493
+ type: object
1494
+ properties:
1495
+ name:
1496
+ type: string
1497
+ email:
1498
+ type: string
1499
+ phone:
1500
+ type: string
1501
+ required: [contacts]
1502
+
1503
+ systemToolOutput:
1504
+ description: |
1505
+ System tools return configuration and management data.
1506
+ examples:
1507
+ - name: List Resources
1508
+ schema:
1509
+ type: object
1510
+ properties:
1511
+ items:
1512
+ type: array
1513
+ items:
1514
+ type: object
1515
+ total:
1516
+ type: integer
1517
+ hasMore:
1518
+ type: boolean
1519
+ required: [items]
1520
+
1521
+ - name: Create/Update Resource
1522
+ schema:
1523
+ type: object
1524
+ properties:
1525
+ id:
1526
+ type: string
1527
+ description: Created/updated resource ID
1528
+ success:
1529
+ type: boolean
1530
+ message:
1531
+ type: string
1532
+ required: [id, success]
1533
+
1534
+ - name: Todo Management
1535
+ schema:
1536
+ type: object
1537
+ properties:
1538
+ todos:
1539
+ type: array
1540
+ items:
1541
+ type: object
1542
+ properties:
1543
+ id:
1544
+ type: string
1545
+ content:
1546
+ type: string
1547
+ status:
1548
+ type: string
1549
+ enum: [pending, in_progress, completed]
1550
+ pending:
1551
+ type: integer
1552
+ completed:
1553
+ type: integer
1554
+ required: [todos]
1555
+
1556
+ - name: Publish Public Chat
1557
+ description: Publish an agent's public chat to make it accessible via a public URL
1558
+ schema:
1559
+ type: object
1560
+ properties:
1561
+ agentId:
1562
+ type: string
1563
+ description: Agent ID
1564
+ publicChatUrl:
1565
+ type: string
1566
+ description: Public chat URL that can be shared
1567
+ tunnelUrl:
1568
+ type: string
1569
+ description: Tunnel URL for the public chat
1570
+ status:
1571
+ type: string
1572
+ enum: [published]
1573
+ required: [agentId, publicChatUrl, status]
1574
+
1575
+ - name: Unpublish Public Chat
1576
+ description: Unpublish an agent's public chat to disable external access
1577
+ schema:
1578
+ type: object
1579
+ properties:
1580
+ agentId:
1581
+ type: string
1582
+ description: Agent ID
1583
+ status:
1584
+ type: string
1585
+ enum: [unpublished]
1586
+ required: [agentId, status]
1587
+
1588
+ - name: Create API Key
1589
+ description: Create a new API key for an agent
1590
+ schema:
1591
+ type: object
1592
+ properties:
1593
+ agentId:
1594
+ type: string
1595
+ description: Agent ID
1596
+ keyId:
1597
+ type: string
1598
+ description: Unique key identifier
1599
+ name:
1600
+ type: string
1601
+ description: Descriptive name for the API key
1602
+ key:
1603
+ type: string
1604
+ description: The API key value (only shown once)
1605
+ createdAt:
1606
+ type: string
1607
+ format: date-time
1608
+ description: When the key was created
1609
+ required: [agentId, keyId, name, key, createdAt]
1610
+
1611
+ codeDebuggerToolOutput:
1612
+ description: |
1613
+ Code debugger tools return debugging state and execution data.
1614
+ examples:
1615
+ - name: Breakpoint Operation
1616
+ schema:
1617
+ type: object
1618
+ properties:
1619
+ breakpointId:
1620
+ type: string
1621
+ file:
1622
+ type: string
1623
+ line:
1624
+ type: integer
1625
+ verified:
1626
+ type: boolean
1627
+ required: [breakpointId]
1628
+
1629
+ - name: Call Stack
1630
+ schema:
1631
+ type: object
1632
+ properties:
1633
+ frames:
1634
+ type: array
1635
+ items:
1636
+ type: object
1637
+ properties:
1638
+ id:
1639
+ type: integer
1640
+ name:
1641
+ type: string
1642
+ file:
1643
+ type: string
1644
+ line:
1645
+ type: integer
1646
+ column:
1647
+ type: integer
1648
+ threadId:
1649
+ type: integer
1650
+ required: [frames]
1651
+
1652
+ - name: Evaluate Expression
1653
+ schema:
1654
+ type: object
1655
+ properties:
1656
+ result:
1657
+ type: string
1658
+ description: Evaluated value
1659
+ type:
1660
+ type: string
1661
+ description: Value type
1662
+ variablesReference:
1663
+ type: integer
1664
+ description: Reference for nested inspection
1665
+ required: [result]