-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsingle_injected_tool.txtar
More file actions
1522 lines (1516 loc) · 81.5 KB
/
Copy pathsingle_injected_tool.txtar
File metadata and controls
1522 lines (1516 loc) · 81.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Coder MCP tools automatically injected.
-- request --
{
"input": "list the template params for version aa4e30e4-a086-4df6-a364-1343f1458104",
"model": "gpt-5.2"
}
-- non-streaming --
{
"background": false,
"billing": {
"payer": "developer"
},
"completed_at": 1768644075,
"created_at": 1768644072,
"error": null,
"frequency_penalty": 0,
"id": "resp_012db006225b0ec700696b5de8a01481a28182ea6885448f93",
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"max_tool_calls": null,
"metadata": {},
"model": "gpt-5.2-2025-12-11",
"object": "response",
"output": [
{
"id": "rs_012db006225b0ec700696b5dea84e081a2b7777aeb4925d8f9",
"summary": [],
"type": "reasoning"
},
{
"arguments": "{\"template_version_id\":\"aa4e30e4-a086-4df6-a364-1343f1458104\"}",
"call_id": "call_5AroFIQIK3cm3suliZdux0TB",
"id": "fc_012db006225b0ec700696b5deb0a5081a28a495f192f19e75f",
"name": "bmcp_coder_coder_template_version_parameters",
"status": "completed",
"type": "function_call"
}
],
"parallel_tool_calls": false,
"presence_penalty": 0,
"previous_response_id": null,
"prompt_cache_key": null,
"prompt_cache_retention": null,
"reasoning": {
"effort": "high",
"summary": null
},
"safety_identifier": null,
"service_tier": "default",
"status": "completed",
"store": true,
"temperature": 1,
"text": {
"format": {
"type": "text"
},
"verbosity": "medium"
},
"tool_choice": "auto",
"tools": [
{
"description": "Create a task.",
"name": "bmcp_coder_coder_create_task",
"parameters": {
"properties": {
"input": {
"description": "Input/prompt for the task.",
"type": "string"
},
"template_version_id": {
"description": "ID of the template version to create the task from.",
"type": "string"
},
"template_version_preset_id": {
"description": "Optional ID of the template version preset to create the task from.",
"type": "string"
},
"user": {
"description": "Username or ID of the user for which to create a task. Omit or use the `me` keyword to create a task for the authenticated user.",
"type": "string"
}
},
"required": [
"input",
"template_version_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create a new template in Coder. First, you must create a template version.",
"name": "bmcp_coder_coder_create_template",
"parameters": {
"properties": {
"description": {
"type": "string"
},
"display_name": {
"type": "string"
},
"icon": {
"description": "A URL to an icon to use.",
"type": "string"
},
"name": {
"type": "string"
},
"version_id": {
"description": "The ID of the version to use.",
"type": "string"
}
},
"required": [
"name",
"display_name",
"description",
"version_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create a new template version. This is a precursor to creating a template, or you can update an existing template.\n\nTemplates are Terraform defining a development environment. The provisioned infrastructure must run\nan Agent that connects to the Coder Control Plane to provide a rich experience.\n\nHere are some strict rules for creating a template version:\n- YOU MUST NOT use \"variable\" or \"output\" blocks in the Terraform code.\n- YOU MUST ALWAYS check template version logs after creation to ensure the template was imported successfully.\n\nWhen a template version is created, a Terraform Plan occurs that ensures the infrastructure\n_could_ be provisioned, but actual provisioning occurs when a workspace is created.\n\n\u003cterraform-spec\u003e\nThe Coder Terraform Provider can be imported like:\n\n```hcl\nterraform {\n required_providers {\n coder = {\n source = \"coder/coder\"\n }\n }\n}\n```\n\nA destroy does not occur when a user stops a workspace, but rather the transition changes:\n\n```hcl\ndata \"coder_workspace\" \"me\" {}\n```\n\nThis data source provides the following fields:\n- id: The UUID of the workspace.\n- name: The name of the workspace.\n- transition: Either \"start\" or \"stop\".\n- start_count: A computed count based on the transition field. If \"start\", this will be 1.\n\nAccess workspace owner information with:\n\n```hcl\ndata \"coder_workspace_owner\" \"me\" {}\n```\n\nThis data source provides the following fields:\n- id: The UUID of the workspace owner.\n- name: The name of the workspace owner.\n- full_name: The full name of the workspace owner.\n- email: The email of the workspace owner.\n- session_token: A token that can be used to authenticate the workspace owner. It is regenerated every time the workspace is started.\n- oidc_access_token: A valid OpenID Connect access token of the workspace owner. This is only available if the workspace owner authenticated with OpenID Connect. If a valid token cannot be obtained, this value will be an empty string.\n\nParameters are defined in the template version. They are rendered in the UI on the workspace creation page:\n\n```hcl\nresource \"coder_parameter\" \"region\" {\n name = \"region\"\n type = \"string\"\n default = \"us-east-1\"\n}\n```\n\nThis resource accepts the following properties:\n- name: The name of the parameter.\n- default: The default value of the parameter.\n- type: The type of the parameter. Must be one of: \"string\", \"number\", \"bool\", or \"list(string)\".\n- display_name: The displayed name of the parameter as it will appear in the UI.\n- description: The description of the parameter as it will appear in the UI.\n- ephemeral: The value of an ephemeral parameter will not be preserved between consecutive workspace builds.\n- form_type: The type of this parameter. Must be one of: [radio, slider, input, dropdown, checkbox, switch, multi-select, tag-select, textarea, error].\n- icon: A URL to an icon to display in the UI.\n- mutable: Whether this value can be changed after workspace creation. This can be destructive for values like region, so use with caution!\n- option: Each option block defines a value for a user to select from. (see below for nested schema)\n Required:\n - name: The name of the option.\n - value: The value of the option.\n Optional:\n - description: The description of the option as it will appear in the UI.\n - icon: A URL to an icon to display in the UI.\n\nA Workspace Agent runs on provisioned infrastructure to provide access to the workspace:\n\n```hcl\nresource \"coder_agent\" \"dev\" {\n arch = \"amd64\"\n os = \"linux\"\n}\n```\n\nThis resource accepts the following properties:\n- arch: The architecture of the agent. Must be one of: \"amd64\", \"arm64\", or \"armv7\".\n- os: The operating system of the agent. Must be one of: \"linux\", \"windows\", or \"darwin\".\n- auth: The authentication method for the agent. Must be one of: \"token\", \"google-instance-identity\", \"aws-instance-identity\", or \"azure-instance-identity\". It is insecure to pass the agent token via exposed variables to Virtual Machines. Instance Identity enables provisioned VMs to authenticate by instance ID on start.\n- dir: The starting directory when a user creates a shell session. Defaults to \"$HOME\".\n- env: A map of environment variables to set for the agent.\n- startup_script: A script to run after the agent starts. This script MUST exit eventually to signal that startup has completed. Use \"\u0026\" or \"screen\" to run processes in the background.\n\nThis resource provides the following fields:\n- id: The UUID of the agent.\n- init_script: The script to run on provisioned infrastructure to fetch and start the agent.\n- token: Set the environment variable CODER_AGENT_TOKEN to this value to authenticate the agent.\n\nThe agent MUST be installed and started using the init_script. A utility like curl or wget to fetch the agent binary must exist in the provisioned infrastructure.\n\nExpose terminal or HTTP applications running in a workspace with:\n\n```hcl\nresource \"coder_app\" \"dev\" {\n agent_id = coder_agent.dev.id\n slug = \"my-app-name\"\n display_name = \"My App\"\n icon = \"https://my-app.com/icon.svg\"\n url = \"http://127.0.0.1:3000\"\n}\n```\n\nThis resource accepts the following properties:\n- agent_id: The ID of the agent to attach the app to.\n- slug: The slug of the app.\n- display_name: The displayed name of the app as it will appear in the UI.\n- icon: A URL to an icon to display in the UI.\n- url: An external url if external=true or a URL to be proxied to from inside the workspace. This should be of the form http://localhost:PORT[/SUBPATH]. Either command or url may be specified, but not both.\n- command: A command to run in a terminal opening this app. In the web, this will open in a new tab. In the CLI, this will SSH and execute the command. Either command or url may be specified, but not both.\n- external: Whether this app is an external app. If true, the url will be opened in a new tab.\n\u003c/terraform-spec\u003e\n\nThe Coder Server may not be authenticated with the infrastructure provider a user requests. In this scenario,\nthe user will need to provide credentials to the Coder Server before the workspace can be provisioned.\n\nHere are examples of provisioning the Coder Agent on specific infrastructure providers:\n\n\u003caws-ec2-instance\u003e\n// The agent is configured with \"aws-instance-identity\" auth.\nterraform {\n required_providers {\n cloudinit = {\n source = \"hashicorp/cloudinit\"\n }\n aws = {\n source = \"hashicorp/aws\"\n }\n }\n}\n\ndata \"cloudinit_config\" \"user_data\" {\n gzip = false\n base64_encode = false\n boundary = \"//\"\n part {\n filename = \"cloud-config.yaml\"\n content_type = \"text/cloud-config\"\n\n\t// Here is the content of the cloud-config.yaml.tftpl file:\n\t// #cloud-config\n\t// cloud_final_modules:\n\t// - [scripts-user, always]\n\t// hostname: ${hostname}\n\t// users:\n\t// - name: ${linux_user}\n\t// sudo: ALL=(ALL) NOPASSWD:ALL\n\t// shell: /bin/bash\n content = templatefile(\"${path.module}/cloud-init/cloud-config.yaml.tftpl\", {\n hostname = local.hostname\n linux_user = local.linux_user\n })\n }\n\n part {\n filename = \"userdata.sh\"\n content_type = \"text/x-shellscript\"\n\n\t// Here is the content of the userdata.sh.tftpl file:\n\t// #!/bin/bash\n\t// sudo -u '${linux_user}' sh -c '${init_script}'\n content = templatefile(\"${path.module}/cloud-init/userdata.sh.tftpl\", {\n linux_user = local.linux_user\n\n init_script = try(coder_agent.dev[0].init_script, \"\")\n })\n }\n}\n\nresource \"aws_instance\" \"dev\" {\n ami = data.aws_ami.ubuntu.id\n availability_zone = \"${data.coder_parameter.region.value}a\"\n instance_type = data.coder_parameter.instance_type.value\n\n user_data = data.cloudinit_config.user_data.rendered\n tags = {\n Name = \"coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}\"\n }\n lifecycle {\n ignore_changes = [ami]\n }\n}\n\u003c/aws-ec2-instance\u003e\n\n\u003cgcp-vm-instance\u003e\n// The agent is configured with \"google-instance-identity\" auth.\nterraform {\n required_providers {\n google = {\n source = \"hashicorp/google\"\n }\n }\n}\n\nresource \"google_compute_instance\" \"dev\" {\n zone = module.gcp_region.value\n count = data.coder_workspace.me.start_count\n name = \"coder-${lower(data.coder_workspace_owner.me.name)}-${lower(data.coder_workspace.me.name)}-root\"\n machine_type = \"e2-medium\"\n network_interface {\n network = \"default\"\n access_config {\n // Ephemeral public IP\n }\n }\n boot_disk {\n auto_delete = false\n source = google_compute_disk.root.name\n }\n // In order to use google-instance-identity, a service account *must* be provided.\n service_account {\n email = data.google_compute_default_service_account.default.email\n scopes = [\"cloud-platform\"]\n }\n # ONLY FOR WINDOWS:\n # metadata = {\n # windows-startup-script-ps1 = coder_agent.main.init_script\n # }\n # The startup script runs as root with no $HOME environment set up, so instead of directly\n # running the agent init script, create a user (with a homedir, default shell and sudo\n # permissions) and execute the init script as that user.\n #\n # The agent MUST be started in here.\n metadata_startup_script = \u003c\u003cEOMETA\n#!/usr/bin/env sh\nset -eux\n\n# If user does not exist, create it and set up passwordless sudo\nif ! id -u \"${local.linux_user}\" \u003e/dev/null 2\u003e\u00261; then\n useradd -m -s /bin/bash \"${local.linux_user}\"\n echo \"${local.linux_user} ALL=(ALL) NOPASSWD:ALL\" \u003e /etc/sudoers.d/coder-user\nfi\n\nexec sudo -u \"${local.linux_user}\" sh -c '${coder_agent.main.init_script}'\nEOMETA\n}\n\u003c/gcp-vm-instance\u003e\n\n\u003cazure-vm-instance\u003e\n// The agent is configured with \"azure-instance-identity\" auth.\nterraform {\n required_providers {\n azurerm = {\n source = \"hashicorp/azurerm\"\n }\n cloudinit = {\n source = \"hashicorp/cloudinit\"\n }\n }\n}\n\ndata \"cloudinit_config\" \"user_data\" {\n gzip = false\n base64_encode = true\n\n boundary = \"//\"\n\n part {\n filename = \"cloud-config.yaml\"\n content_type = \"text/cloud-config\"\n\n\t// Here is the content of the cloud-config.yaml.tftpl file:\n\t// #cloud-config\n\t// cloud_final_modules:\n\t// - [scripts-user, always]\n\t// bootcmd:\n\t// # work around https://github.com/hashicorp/terraform-provider-azurerm/issues/6117\n\t// - until [ -e /dev/disk/azure/scsi1/lun10 ]; do sleep 1; done\n\t// device_aliases:\n\t// homedir: /dev/disk/azure/scsi1/lun10\n\t// disk_setup:\n\t// homedir:\n\t// table_type: gpt\n\t// layout: true\n\t// fs_setup:\n\t// - label: coder_home\n\t// filesystem: ext4\n\t// device: homedir.1\n\t// mounts:\n\t// - [\"LABEL=coder_home\", \"/home/${username}\"]\n\t// hostname: ${hostname}\n\t// users:\n\t// - name: ${username}\n\t// sudo: [\"ALL=(ALL) NOPASSWD:ALL\"]\n\t// groups: sudo\n\t// shell: /bin/bash\n\t// packages:\n\t// - git\n\t// write_files:\n\t// - path: /opt/coder/init\n\t// permissions: \"0755\"\n\t// encoding: b64\n\t// content: ${init_script}\n\t// - path: /etc/systemd/system/coder-agent.service\n\t// permissions: \"0644\"\n\t// content: |\n\t// [Unit]\n\t// Description=Coder Agent\n\t// After=network-online.target\n\t// Wants=network-online.target\n\n\t// [Service]\n\t// User=${username}\n\t// ExecStart=/opt/coder/init\n\t// Restart=always\n\t// RestartSec=10\n\t// TimeoutStopSec=90\n\t// KillMode=process\n\n\t// OOMScoreAdjust=-900\n\t// SyslogIdentifier=coder-agent\n\n\t// [Install]\n\t// WantedBy=multi-user.target\n\t// runcmd:\n\t// - chown ${username}:${username} /home/${username}\n\t// - systemctl enable coder-agent\n\t// - systemctl start coder-agent\n content = templatefile(\"${path.module}/cloud-init/cloud-config.yaml.tftpl\", {\n username = \"coder\" # Ensure this user/group does not exist in your VM image\n init_script = base64encode(coder_agent.main.init_script)\n hostname = lower(data.coder_workspace.me.name)\n })\n }\n}\n\nresource \"azurerm_linux_virtual_machine\" \"main\" {\n count = data.coder_workspace.me.start_count\n name = \"vm\"\n resource_group_name = azurerm_resource_group.main.name\n location = azurerm_resource_group.main.location\n size = data.coder_parameter.instance_type.value\n // cloud-init overwrites this, so the value here doesn't matter\n admin_username = \"adminuser\"\n admin_ssh_key {\n public_key = tls_private_key.dummy.public_key_openssh\n username = \"adminuser\"\n }\n\n network_interface_ids = [\n azurerm_network_interface.main.id,\n ]\n computer_name = lower(data.coder_workspace.me.name)\n os_disk {\n caching = \"ReadWrite\"\n storage_account_type = \"Standard_LRS\"\n }\n source_image_reference {\n publisher = \"Canonical\"\n offer = \"0001-com-ubuntu-server-focal\"\n sku = \"20_04-lts-gen2\"\n version = \"latest\"\n }\n user_data = data.cloudinit_config.user_data.rendered\n}\n\u003c/azure-vm-instance\u003e\n\n\u003cdocker-container\u003e\nterraform {\n required_providers {\n coder = {\n source = \"kreuzwerker/docker\"\n }\n }\n}\n\n// The agent is configured with \"token\" auth.\n\nresource \"docker_container\" \"workspace\" {\n count = data.coder_workspace.me.start_count\n image = \"codercom/enterprise-base:ubuntu\"\n # Uses lower() to avoid Docker restriction on container names.\n name = \"coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}\"\n # Hostname makes the shell more user friendly: coder@my-workspace:~$\n hostname = data.coder_workspace.me.name\n # Use the docker gateway if the access URL is 127.0.0.1.\n entrypoint = [\"sh\", \"-c\", replace(coder_agent.main.init_script, \"/localhost|127\\\\.0\\\\.0\\\\.1/\", \"host.docker.internal\")]\n env = [\"CODER_AGENT_TOKEN=${coder_agent.main.token}\"]\n host {\n host = \"host.docker.internal\"\n ip = \"host-gateway\"\n }\n volumes {\n container_path = \"/home/coder\"\n volume_name = docker_volume.home_volume.name\n read_only = false\n }\n}\n\u003c/docker-container\u003e\n\n\u003ckubernetes-pod\u003e\n// The agent is configured with \"token\" auth.\n\nresource \"kubernetes_deployment\" \"main\" {\n count = data.coder_workspace.me.start_count\n depends_on = [\n kubernetes_persistent_volume_claim.home\n ]\n wait_for_rollout = false\n metadata {\n name = \"coder-${data.coder_workspace.me.id}\"\n }\n\n spec {\n replicas = 1\n strategy {\n type = \"Recreate\"\n }\n\n template {\n spec {\n security_context {\n run_as_user = 1000\n fs_group = 1000\n run_as_non_root = true\n }\n\n container {\n name = \"dev\"\n image = \"codercom/enterprise-base:ubuntu\"\n image_pull_policy = \"Always\"\n command = [\"sh\", \"-c\", coder_agent.main.init_script]\n security_context {\n run_as_user = \"1000\"\n }\n env {\n name = \"CODER_AGENT_TOKEN\"\n value = coder_agent.main.token\n }\n }\n }\n }\n }\n}\n\u003c/kubernetes-pod\u003e\n\nThe file_id provided is a reference to a tar file you have uploaded containing the Terraform.\n",
"name": "bmcp_coder_coder_create_template_version",
"parameters": {
"properties": {
"file_id": {
"type": "string"
},
"template_id": {
"type": "string"
}
},
"required": [
"file_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create a new workspace in Coder.\n\nIf a user is asking to \"test a template\", they are typically referring\nto creating a workspace from a template to ensure the infrastructure\nis provisioned correctly and the agent can connect to the control plane.\n\nBefore creating a workspace, always confirm the template choice with the user by:\n\n\t1. Listing the available templates that match their request.\n\t2. Recommending the most relevant option.\n\t2. Asking the user to confirm which template to use.\n\nIt is important to not create a workspace without confirming the template\nchoice with the user.\n\nAfter creating a workspace, watch the build logs and wait for the workspace to\nbe ready before trying to use or connect to the workspace.\n",
"name": "bmcp_coder_coder_create_workspace",
"parameters": {
"properties": {
"name": {
"description": "Name of the workspace to create.",
"type": "string"
},
"rich_parameters": {
"description": "Key/value pairs of rich parameters to pass to the template version to create the workspace.",
"type": "object"
},
"template_version_id": {
"description": "ID of the template version to create the workspace from.",
"type": "string"
},
"user": {
"description": "Username or ID of the user for which to create a workspace. Omit or use the `me` keyword to create a workspace for the authenticated user.",
"type": "string"
}
},
"required": [
"user",
"template_version_id",
"name",
"rich_parameters"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create a new workspace build for an existing workspace. Use this to start, stop, or delete.\n\nAfter creating a workspace build, watch the build logs and wait for the\nworkspace build to complete before trying to start another build or use or\nconnect to the workspace.\n",
"name": "bmcp_coder_coder_create_workspace_build",
"parameters": {
"properties": {
"template_version_id": {
"description": "(Optional) The template version ID to use for the workspace build. If not provided, the previously built version will be used.",
"type": "string"
},
"transition": {
"description": "The transition to perform. Must be one of: start, stop, delete",
"enum": [
"start",
"stop",
"delete"
],
"type": "string"
},
"workspace_id": {
"type": "string"
}
},
"required": [
"workspace_id",
"transition"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Delete a task.",
"name": "bmcp_coder_coder_delete_task",
"parameters": {
"properties": {
"task_id": {
"description": "ID or workspace identifier in the format [owner/]workspace[.agent] for the task to delete. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"task_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Delete a template. This is irreversible.",
"name": "bmcp_coder_coder_delete_template",
"parameters": {
"properties": {
"template_id": {
"type": "string"
}
},
"required": [
"template_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Get the currently authenticated user, similar to the `whoami` command.",
"name": "bmcp_coder_coder_get_authenticated_user",
"parameters": {
"properties": {},
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Get the logs of a task.",
"name": "bmcp_coder_coder_get_task_logs",
"parameters": {
"properties": {
"task_id": {
"description": "ID or workspace identifier in the format [owner/]workspace[.agent] for the task to query. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"task_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Get the status of a task.",
"name": "bmcp_coder_coder_get_task_status",
"parameters": {
"properties": {
"task_id": {
"description": "ID or workspace identifier in the format [owner/]workspace[.agent] for the task to get. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"task_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Get the logs of a template version. This is useful to check whether a template version successfully imports or not.",
"name": "bmcp_coder_coder_get_template_version_logs",
"parameters": {
"properties": {
"template_version_id": {
"type": "string"
}
},
"required": [
"template_version_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Get a workspace by name or ID.\n\nThis returns more data than list_workspaces to reduce token usage.",
"name": "bmcp_coder_coder_get_workspace",
"parameters": {
"properties": {
"workspace_id": {
"description": "The workspace ID or name in the format [owner/]workspace. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"workspace_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Get the logs of a workspace agent.\n\n\t\tMore logs may appear after this call. It does not wait for the agent to finish.",
"name": "bmcp_coder_coder_get_workspace_agent_logs",
"parameters": {
"properties": {
"workspace_agent_id": {
"type": "string"
}
},
"required": [
"workspace_agent_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Get the logs of a workspace build.\n\n\t\tUseful for checking whether a workspace builds successfully or not.",
"name": "bmcp_coder_coder_get_workspace_build_logs",
"parameters": {
"properties": {
"workspace_build_id": {
"type": "string"
}
},
"required": [
"workspace_build_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "List tasks.",
"name": "bmcp_coder_coder_list_tasks",
"parameters": {
"properties": {
"status": {
"description": "Optional filter by task status.",
"type": "string"
},
"user": {
"description": "Username or ID of the user for which to list tasks. Omit or use the `me` keyword to list tasks for the authenticated user.",
"type": "string"
}
},
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Lists templates for the authenticated user.",
"name": "bmcp_coder_coder_list_templates",
"parameters": {
"properties": {},
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Lists workspaces for the authenticated user.",
"name": "bmcp_coder_coder_list_workspaces",
"parameters": {
"properties": {
"owner": {
"description": "The owner of the workspaces to list. Use \"me\" to list workspaces for the authenticated user. If you do not specify an owner, \"me\" will be assumed by default.",
"type": "string"
}
},
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Send input to a running task.",
"name": "bmcp_coder_coder_send_task_input",
"parameters": {
"properties": {
"input": {
"description": "The input to send to the task.",
"type": "string"
},
"task_id": {
"description": "ID or workspace identifier in the format [owner/]workspace[.agent] for the task to prompt. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"task_id",
"input"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Get the parameters for a template version. You can refer to these as workspace parameters to the user, as they are typically important for creating a workspace.",
"name": "bmcp_coder_coder_template_version_parameters",
"parameters": {
"properties": {
"template_version_id": {
"type": "string"
}
},
"required": [
"template_version_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Update the active version of a template. This is helpful when iterating on templates.",
"name": "bmcp_coder_coder_update_template_active_version",
"parameters": {
"properties": {
"template_id": {
"type": "string"
},
"template_version_id": {
"type": "string"
}
},
"required": [
"template_id",
"template_version_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create and upload a tar file by key/value mapping of file names to file contents. Use this to create template versions. Reference the tool description of \"create_template_version\" to understand template requirements.",
"name": "bmcp_coder_coder_upload_tar_file",
"parameters": {
"properties": {
"files": {
"description": "A map of file names to file contents.",
"type": "object"
}
},
"required": [
"files"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Execute a bash command in a Coder workspace.\n\nThis tool provides the same functionality as the 'coder ssh \u003cworkspace\u003e \u003ccommand\u003e' CLI command.\nIt automatically starts the workspace if it's stopped and waits for the agent to be ready.\nThe output is trimmed of leading and trailing whitespace.\n\nThe workspace parameter supports various formats:\n- workspace (uses current user)\n- owner/workspace\n- owner--workspace\n- workspace.agent (specific agent)\n- owner/workspace.agent\n\nThe timeout_ms parameter specifies the command timeout in milliseconds (defaults to 60000ms, maximum of 300000ms).\nIf the command times out, all output captured up to that point is returned with a cancellation message.\n\nFor background commands (background: true), output is captured until the timeout is reached, then the command\ncontinues running in the background. The captured output is returned as the result.\n\nFor file operations (list, write, edit), always prefer the dedicated file tools.\nDo not use bash commands (ls, cat, echo, heredoc, etc.) to list, write, or read\nfiles when the file tools are available. The bash tool should be used for:\n\n\t- Running commands and scripts\n\t- Installing packages\n\t- Starting services\n\t- Executing programs\n\nExamples:\n- workspace: \"john/dev-env\", command: \"git status\", timeout_ms: 30000\n- workspace: \"my-workspace\", command: \"npm run dev\", background: true, timeout_ms: 10000\n- workspace: \"my-workspace.main\", command: \"docker ps\"",
"name": "bmcp_coder_coder_workspace_bash",
"parameters": {
"properties": {
"background": {
"description": "Whether to run the command in the background. Output is captured until timeout, then the command continues running in the background.",
"type": "boolean"
},
"command": {
"description": "The bash command to execute in the workspace.",
"type": "string"
},
"timeout_ms": {
"default": 60000,
"description": "Command timeout in milliseconds. Defaults to 60000ms (60 seconds) if not specified.",
"minimum": 1,
"type": "integer"
},
"workspace": {
"description": "The workspace name in format [owner/]workspace[.agent]. If owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"workspace",
"command"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Edit a file in a workspace.",
"name": "bmcp_coder_coder_workspace_edit_file",
"parameters": {
"properties": {
"edits": {
"description": "An array of edit operations.",
"items": {
"properties": {
"replace": {
"description": "The new string that replaces the old string.",
"type": "string"
},
"search": {
"description": "The old string to replace.",
"type": "string"
}
},
"required": [
"search",
"replace"
],
"type": "object"
},
"type": "array"
},
"path": {
"description": "The absolute path of the file to write in the workspace.",
"type": "string"
},
"workspace": {
"description": "The workspace name in the format [owner/]workspace[.agent]. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"path",
"workspace",
"edits"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Edit one or more files in a workspace.",
"name": "bmcp_coder_coder_workspace_edit_files",
"parameters": {
"properties": {
"files": {
"description": "An array of files to edit.",
"items": {
"properties": {
"edits": {
"description": "An array of edit operations.",
"items": {
"properties": {
"replace": {
"description": "The new string that replaces the old string.",
"type": "string"
},
"search": {
"description": "The old string to replace.",
"type": "string"
}
},
"required": [
"search",
"replace"
],
"type": "object"
},
"type": "array"
},
"path": {
"description": "The absolute path of the file to write in the workspace.",
"type": "string"
}
},
"required": [
"path",
"edits"
],
"type": "object"
},
"type": "array"
},
"workspace": {
"description": "The workspace name in the format [owner/]workspace[.agent]. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"workspace",
"files"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "List the URLs of Coder apps running in a workspace for a single agent.",
"name": "bmcp_coder_coder_workspace_list_apps",
"parameters": {
"properties": {
"workspace": {
"description": "The workspace name in the format [owner/]workspace[.agent]. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"workspace"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "List directories in a workspace.",
"name": "bmcp_coder_coder_workspace_ls",
"parameters": {
"properties": {
"path": {
"description": "The absolute path of the directory in the workspace to list.",
"type": "string"
},
"workspace": {
"description": "The workspace name in the format [owner/]workspace[.agent]. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"path",
"workspace"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Fetch URLs that forward to the specified port.",
"name": "bmcp_coder_coder_workspace_port_forward",
"parameters": {
"properties": {
"port": {
"description": "The port to forward.",
"type": "number"
},
"workspace": {
"description": "The workspace name in the format [owner/]workspace[.agent]. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"workspace",
"port"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Read from a file in a workspace.",
"name": "bmcp_coder_coder_workspace_read_file",
"parameters": {
"properties": {
"limit": {
"description": "The number of bytes to read. Cannot exceed 1 MiB. Defaults to the full size of the file or 1 MiB, whichever is lower.",
"type": "integer"
},
"offset": {
"description": "A byte offset indicating where in the file to start reading. Defaults to zero. An empty string indicates the end of the file has been reached.",
"type": "integer"
},
"path": {
"description": "The absolute path of the file to read in the workspace.",
"type": "string"
},
"workspace": {
"description": "The workspace name in the format [owner/]workspace[.agent]. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"path",
"workspace"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Write a file in a workspace.\n\nIf a file write fails due to syntax errors or encoding issues, do NOT switch\nto using bash commands as a workaround. Instead:\n\n\t1. Read the error message carefully to identify the issue\n\t2. Fix the content encoding/syntax\n\t3. Retry with this tool\n\nThe content parameter expects base64-encoded bytes. Ensure your source content\nis correct before encoding it. If you encounter errors, decode and verify the\ncontent you are trying to write, then re-encode it properly.\n",
"name": "bmcp_coder_coder_workspace_write_file",
"parameters": {
"properties": {
"content": {
"description": "The base64-encoded bytes to write to the file.",
"type": "string"
},
"path": {
"description": "The absolute path of the file to write in the workspace.",
"type": "string"
},
"workspace": {
"description": "The workspace name in the format [owner/]workspace[.agent]. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"path",
"workspace",
"content"
],
"type": "object"
},
"strict": false,
"type": "function"
}
],
"top_logprobs": 0,
"top_p": 0.98,
"truncation": "disabled",
"usage": {
"input_tokens": 6371,
"input_tokens_details": {
"cached_tokens": 6144
},
"output_tokens": 75,
"output_tokens_details": {
"reasoning_tokens": 25
},
"total_tokens": 6446
},
"user": null
}
-- non-streaming/tool-call --
{
"background": false,
"billing": {
"payer": "developer"
},
"completed_at": 1768644080,
"created_at": 1768644076,
"error": null,
"frequency_penalty": 0,
"id": "resp_012db006225b0ec700696b5dec1d4c81a2a6a416e31af39b90",
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"max_tool_calls": null,
"metadata": {},
"model": "gpt-5.2-2025-12-11",
"object": "response",
"output": [
{
"id": "rs_012db006225b0ec700696b5dec8e4c81a29eae3985d087c0b3",
"summary": [],
"type": "reasoning"
},
{
"content": [
{
"annotations": [],
"logprobs": [],
"text": "The template version `aa4e30e4-a086-4df6-a364-1343f1458104` defines **one** workspace parameter:\n\n### `jetbrains_ides`\n- **Display name:** JetBrains IDEs \n- **Type:** `list(string)` \n- **Form type:** `multi-select` \n- **Default:** `[]` (empty selection) \n- **Mutable after creation:** `true` \n- **Description:** Select which JetBrains IDEs to configure for use in this workspace.\n\n**Selectable options (name → value):**\n- CLion → `CL`\n- GoLand → `GO`\n- IntelliJ IDEA → `IU`\n- PhpStorm → `PS`\n- PyCharm → `PY`\n- Rider → `RD`\n- RubyMine → `RM`\n- RustRover → `RR`\n- WebStorm → `WS`",
"type": "output_text"
}
],
"id": "msg_012db006225b0ec700696b5ded3f9881a2836e6cca7a5866e6",
"role": "assistant",
"status": "completed",
"type": "message"
}
],
"parallel_tool_calls": false,
"presence_penalty": 0,
"previous_response_id": null,
"prompt_cache_key": null,
"prompt_cache_retention": null,
"reasoning": {
"effort": "high",
"summary": null
},
"safety_identifier": null,
"service_tier": "default",
"status": "completed",
"store": true,
"temperature": 1,
"text": {
"format": {
"type": "text"
},
"verbosity": "medium"
},
"tool_choice": "auto",
"tools": [
{
"description": "Create a task.",
"name": "bmcp_coder_coder_create_task",
"parameters": {
"properties": {
"input": {
"description": "Input/prompt for the task.",
"type": "string"
},
"template_version_id": {
"description": "ID of the template version to create the task from.",
"type": "string"
},
"template_version_preset_id": {
"description": "Optional ID of the template version preset to create the task from.",
"type": "string"
},
"user": {
"description": "Username or ID of the user for which to create a task. Omit or use the `me` keyword to create a task for the authenticated user.",
"type": "string"
}
},
"required": [
"input",
"template_version_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create a new template in Coder. First, you must create a template version.",
"name": "bmcp_coder_coder_create_template",
"parameters": {
"properties": {
"description": {
"type": "string"
},
"display_name": {
"type": "string"
},
"icon": {
"description": "A URL to an icon to use.",
"type": "string"
},
"name": {
"type": "string"
},
"version_id": {
"description": "The ID of the version to use.",
"type": "string"
}
},
"required": [
"name",
"display_name",
"description",
"version_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create a new template version. This is a precursor to creating a template, or you can update an existing template.\n\nTemplates are Terraform defining a development environment. The provisioned infrastructure must run\nan Agent that connects to the Coder Control Plane to provide a rich experience.\n\nHere are some strict rules for creating a template version:\n- YOU MUST NOT use \"variable\" or \"output\" blocks in the Terraform code.\n- YOU MUST ALWAYS check template version logs after creation to ensure the template was imported successfully.\n\nWhen a template version is created, a Terraform Plan occurs that ensures the infrastructure\n_could_ be provisioned, but actual provisioning occurs when a workspace is created.\n\n\u003cterraform-spec\u003e\nThe Coder Terraform Provider can be imported like:\n\n```hcl\nterraform {\n required_providers {\n coder = {\n source = \"coder/coder\"\n }\n }\n}\n```\n\nA destroy does not occur when a user stops a workspace, but rather the transition changes:\n\n```hcl\ndata \"coder_workspace\" \"me\" {}\n```\n\nThis data source provides the following fields:\n- id: The UUID of the workspace.\n- name: The name of the workspace.\n- transition: Either \"start\" or \"stop\".\n- start_count: A computed count based on the transition field. If \"start\", this will be 1.\n\nAccess workspace owner information with:\n\n```hcl\ndata \"coder_workspace_owner\" \"me\" {}\n```\n\nThis data source provides the following fields:\n- id: The UUID of the workspace owner.\n- name: The name of the workspace owner.\n- full_name: The full name of the workspace owner.\n- email: The email of the workspace owner.\n- session_token: A token that can be used to authenticate the workspace owner. It is regenerated every time the workspace is started.\n- oidc_access_token: A valid OpenID Connect access token of the workspace owner. This is only available if the workspace owner authenticated with OpenID Connect. If a valid token cannot be obtained, this value will be an empty string.\n\nParameters are defined in the template version. They are rendered in the UI on the workspace creation page:\n\n```hcl\nresource \"coder_parameter\" \"region\" {\n name = \"region\"\n type = \"string\"\n default = \"us-east-1\"\n}\n```\n\nThis resource accepts the following properties:\n- name: The name of the parameter.\n- default: The default value of the parameter.\n- type: The type of the parameter. Must be one of: \"string\", \"number\", \"bool\", or \"list(string)\".\n- display_name: The displayed name of the parameter as it will appear in the UI.\n- description: The description of the parameter as it will appear in the UI.\n- ephemeral: The value of an ephemeral parameter will not be preserved between consecutive workspace builds.\n- form_type: The type of this parameter. Must be one of: [radio, slider, input, dropdown, checkbox, switch, multi-select, tag-select, textarea, error].\n- icon: A URL to an icon to display in the UI.\n- mutable: Whether this value can be changed after workspace creation. This can be destructive for values like region, so use with caution!\n- option: Each option block defines a value for a user to select from. (see below for nested schema)\n Required:\n - name: The name of the option.\n - value: The value of the option.\n Optional:\n - description: The description of the option as it will appear in the UI.\n - icon: A URL to an icon to display in the UI.\n\nA Workspace Agent runs on provisioned infrastructure to provide access to the workspace:\n\n```hcl\nresource \"coder_agent\" \"dev\" {\n arch = \"amd64\"\n os = \"linux\"\n}\n```\n\nThis resource accepts the following properties:\n- arch: The architecture of the agent. Must be one of: \"amd64\", \"arm64\", or \"armv7\".\n- os: The operating system of the agent. Must be one of: \"linux\", \"windows\", or \"darwin\".\n- auth: The authentication method for the agent. Must be one of: \"token\", \"google-instance-identity\", \"aws-instance-identity\", or \"azure-instance-identity\". It is insecure to pass the agent token via exposed variables to Virtual Machines. Instance Identity enables provisioned VMs to authenticate by instance ID on start.\n- dir: The starting directory when a user creates a shell session. Defaults to \"$HOME\".\n- env: A map of environment variables to set for the agent.\n- startup_script: A script to run after the agent starts. This script MUST exit eventually to signal that startup has completed. Use \"\u0026\" or \"screen\" to run processes in the background.\n\nThis resource provides the following fields:\n- id: The UUID of the agent.\n- init_script: The script to run on provisioned infrastructure to fetch and start the agent.\n- token: Set the environment variable CODER_AGENT_TOKEN to this value to authenticate the agent.\n\nThe agent MUST be installed and started using the init_script. A utility like curl or wget to fetch the agent binary must exist in the provisioned infrastructure.\n\nExpose terminal or HTTP applications running in a workspace with:\n\n```hcl\nresource \"coder_app\" \"dev\" {\n agent_id = coder_agent.dev.id\n slug = \"my-app-name\"\n display_name = \"My App\"\n icon = \"https://my-app.com/icon.svg\"\n url = \"http://127.0.0.1:3000\"\n}\n```\n\nThis resource accepts the following properties:\n- agent_id: The ID of the agent to attach the app to.\n- slug: The slug of the app.\n- display_name: The displayed name of the app as it will appear in the UI.\n- icon: A URL to an icon to display in the UI.\n- url: An external url if external=true or a URL to be proxied to from inside the workspace. This should be of the form http://localhost:PORT[/SUBPATH]. Either command or url may be specified, but not both.\n- command: A command to run in a terminal opening this app. In the web, this will open in a new tab. In the CLI, this will SSH and execute the command. Either command or url may be specified, but not both.\n- external: Whether this app is an external app. If true, the url will be opened in a new tab.\n\u003c/terraform-spec\u003e\n\nThe Coder Server may not be authenticated with the infrastructure provider a user requests. In this scenario,\nthe user will need to provide credentials to the Coder Server before the workspace can be provisioned.\n\nHere are examples of provisioning the Coder Agent on specific infrastructure providers:\n\n\u003caws-ec2-instance\u003e\n// The agent is configured with \"aws-instance-identity\" auth.\nterraform {\n required_providers {\n cloudinit = {\n source = \"hashicorp/cloudinit\"\n }\n aws = {\n source = \"hashicorp/aws\"\n }\n }\n}\n\ndata \"cloudinit_config\" \"user_data\" {\n gzip = false\n base64_encode = false\n boundary = \"//\"\n part {\n filename = \"cloud-config.yaml\"\n content_type = \"text/cloud-config\"\n\n\t// Here is the content of the cloud-config.yaml.tftpl file:\n\t// #cloud-config\n\t// cloud_final_modules:\n\t// - [scripts-user, always]\n\t// hostname: ${hostname}\n\t// users:\n\t// - name: ${linux_user}\n\t// sudo: ALL=(ALL) NOPASSWD:ALL\n\t// shell: /bin/bash\n content = templatefile(\"${path.module}/cloud-init/cloud-config.yaml.tftpl\", {\n hostname = local.hostname\n linux_user = local.linux_user\n })\n }\n\n part {\n filename = \"userdata.sh\"\n content_type = \"text/x-shellscript\"\n\n\t// Here is the content of the userdata.sh.tftpl file:\n\t// #!/bin/bash\n\t// sudo -u '${linux_user}' sh -c '${init_script}'\n content = templatefile(\"${path.module}/cloud-init/userdata.sh.tftpl\", {\n linux_user = local.linux_user\n\n init_script = try(coder_agent.dev[0].init_script, \"\")\n })\n }\n}\n\nresource \"aws_instance\" \"dev\" {\n ami = data.aws_ami.ubuntu.id\n availability_zone = \"${data.coder_parameter.region.value}a\"\n instance_type = data.coder_parameter.instance_type.value\n\n user_data = data.cloudinit_config.user_data.rendered\n tags = {\n Name = \"coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}\"\n }\n lifecycle {\n ignore_changes = [ami]\n }\n}\n\u003c/aws-ec2-instance\u003e\n\n\u003cgcp-vm-instance\u003e\n// The agent is configured with \"google-instance-identity\" auth.\nterraform {\n required_providers {\n google = {\n source = \"hashicorp/google\"\n }\n }\n}\n\nresource \"google_compute_instance\" \"dev\" {\n zone = module.gcp_region.value\n count = data.coder_workspace.me.start_count\n name = \"coder-${lower(data.coder_workspace_owner.me.name)}-${lower(data.coder_workspace.me.name)}-root\"\n machine_type = \"e2-medium\"\n network_interface {\n network = \"default\"\n access_config {\n // Ephemeral public IP\n }\n }\n boot_disk {\n auto_delete = false\n source = google_compute_disk.root.name\n }\n // In order to use google-instance-identity, a service account *must* be provided.\n service_account {\n email = data.google_compute_default_service_account.default.email\n scopes = [\"cloud-platform\"]\n }\n # ONLY FOR WINDOWS:\n # metadata = {\n # windows-startup-script-ps1 = coder_agent.main.init_script\n # }\n # The startup script runs as root with no $HOME environment set up, so instead of directly\n # running the agent init script, create a user (with a homedir, default shell and sudo\n # permissions) and execute the init script as that user.\n #\n # The agent MUST be started in here.\n metadata_startup_script = \u003c\u003cEOMETA\n#!/usr/bin/env sh\nset -eux\n\n# If user does not exist, create it and set up passwordless sudo\nif ! id -u \"${local.linux_user}\" \u003e/dev/null 2\u003e\u00261; then\n useradd -m -s /bin/bash \"${local.linux_user}\"\n echo \"${local.linux_user} ALL=(ALL) NOPASSWD:ALL\" \u003e /etc/sudoers.d/coder-user\nfi\n\nexec sudo -u \"${local.linux_user}\" sh -c '${coder_agent.main.init_script}'\nEOMETA\n}\n\u003c/gcp-vm-instance\u003e\n\n\u003cazure-vm-instance\u003e\n// The agent is configured with \"azure-instance-identity\" auth.\nterraform {\n required_providers {\n azurerm = {\n source = \"hashicorp/azurerm\"\n }\n cloudinit = {\n source = \"hashicorp/cloudinit\"\n }\n }\n}\n\ndata \"cloudinit_config\" \"user_data\" {\n gzip = false\n base64_encode = true\n\n boundary = \"//\"\n\n part {\n filename = \"cloud-config.yaml\"\n content_type = \"text/cloud-config\"\n\n\t// Here is the content of the cloud-config.yaml.tftpl file:\n\t// #cloud-config\n\t// cloud_final_modules:\n\t// - [scripts-user, always]\n\t// bootcmd:\n\t// # work around https://github.com/hashicorp/terraform-provider-azurerm/issues/6117\n\t// - until [ -e /dev/disk/azure/scsi1/lun10 ]; do sleep 1; done\n\t// device_aliases:\n\t// homedir: /dev/disk/azure/scsi1/lun10\n\t// disk_setup:\n\t// homedir:\n\t// table_type: gpt\n\t// layout: true\n\t// fs_setup:\n\t// - label: coder_home\n\t// filesystem: ext4\n\t// device: homedir.1\n\t// mounts:\n\t// - [\"LABEL=coder_home\", \"/home/${username}\"]\n\t// hostname: ${hostname}\n\t// users:\n\t// - name: ${username}\n\t// sudo: [\"ALL=(ALL) NOPASSWD:ALL\"]\n\t// groups: sudo\n\t// shell: /bin/bash\n\t// packages:\n\t// - git\n\t// write_files:\n\t// - path: /opt/coder/init\n\t// permissions: \"0755\"\n\t// encoding: b64\n\t// content: ${init_script}\n\t// - path: /etc/systemd/system/coder-agent.service\n\t// permissions: \"0644\"\n\t// content: |\n\t// [Unit]\n\t// Description=Coder Agent\n\t// After=network-online.target\n\t// Wants=network-online.target\n\n\t// [Service]\n\t// User=${username}\n\t// ExecStart=/opt/coder/init\n\t// Restart=always\n\t// RestartSec=10\n\t// TimeoutStopSec=90\n\t// KillMode=process\n\n\t// OOMScoreAdjust=-900\n\t// SyslogIdentifier=coder-agent\n\n\t// [Install]\n\t// WantedBy=multi-user.target\n\t// runcmd:\n\t// - chown ${username}:${username} /home/${username}\n\t// - systemctl enable coder-agent\n\t// - systemctl start coder-agent\n content = templatefile(\"${path.module}/cloud-init/cloud-config.yaml.tftpl\", {\n username = \"coder\" # Ensure this user/group does not exist in your VM image\n init_script = base64encode(coder_agent.main.init_script)\n hostname = lower(data.coder_workspace.me.name)\n })\n }\n}\n\nresource \"azurerm_linux_virtual_machine\" \"main\" {\n count = data.coder_workspace.me.start_count\n name = \"vm\"\n resource_group_name = azurerm_resource_group.main.name\n location = azurerm_resource_group.main.location\n size = data.coder_parameter.instance_type.value\n // cloud-init overwrites this, so the value here doesn't matter\n admin_username = \"adminuser\"\n admin_ssh_key {\n public_key = tls_private_key.dummy.public_key_openssh\n username = \"adminuser\"\n }\n\n network_interface_ids = [\n azurerm_network_interface.main.id,\n ]\n computer_name = lower(data.coder_workspace.me.name)\n os_disk {\n caching = \"ReadWrite\"\n storage_account_type = \"Standard_LRS\"\n }\n source_image_reference {\n publisher = \"Canonical\"\n offer = \"0001-com-ubuntu-server-focal\"\n sku = \"20_04-lts-gen2\"\n version = \"latest\"\n }\n user_data = data.cloudinit_config.user_data.rendered\n}\n\u003c/azure-vm-instance\u003e\n\n\u003cdocker-container\u003e\nterraform {\n required_providers {\n coder = {\n source = \"kreuzwerker/docker\"\n }\n }\n}\n\n// The agent is configured with \"token\" auth.\n\nresource \"docker_container\" \"workspace\" {\n count = data.coder_workspace.me.start_count\n image = \"codercom/enterprise-base:ubuntu\"\n # Uses lower() to avoid Docker restriction on container names.\n name = \"coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}\"\n # Hostname makes the shell more user friendly: coder@my-workspace:~$\n hostname = data.coder_workspace.me.name\n # Use the docker gateway if the access URL is 127.0.0.1.\n entrypoint = [\"sh\", \"-c\", replace(coder_agent.main.init_script, \"/localhost|127\\\\.0\\\\.0\\\\.1/\", \"host.docker.internal\")]\n env = [\"CODER_AGENT_TOKEN=${coder_agent.main.token}\"]\n host {\n host = \"host.docker.internal\"\n ip = \"host-gateway\"\n }\n volumes {\n container_path = \"/home/coder\"\n volume_name = docker_volume.home_volume.name\n read_only = false\n }\n}\n\u003c/docker-container\u003e\n\n\u003ckubernetes-pod\u003e\n// The agent is configured with \"token\" auth.\n\nresource \"kubernetes_deployment\" \"main\" {\n count = data.coder_workspace.me.start_count\n depends_on = [\n kubernetes_persistent_volume_claim.home\n ]\n wait_for_rollout = false\n metadata {\n name = \"coder-${data.coder_workspace.me.id}\"\n }\n\n spec {\n replicas = 1\n strategy {\n type = \"Recreate\"\n }\n\n template {\n spec {\n security_context {\n run_as_user = 1000\n fs_group = 1000\n run_as_non_root = true\n }\n\n container {\n name = \"dev\"\n image = \"codercom/enterprise-base:ubuntu\"\n image_pull_policy = \"Always\"\n command = [\"sh\", \"-c\", coder_agent.main.init_script]\n security_context {\n run_as_user = \"1000\"\n }\n env {\n name = \"CODER_AGENT_TOKEN\"\n value = coder_agent.main.token\n }\n }\n }\n }\n }\n}\n\u003c/kubernetes-pod\u003e\n\nThe file_id provided is a reference to a tar file you have uploaded containing the Terraform.\n",
"name": "bmcp_coder_coder_create_template_version",
"parameters": {
"properties": {
"file_id": {
"type": "string"
},
"template_id": {
"type": "string"
}
},
"required": [
"file_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create a new workspace in Coder.\n\nIf a user is asking to \"test a template\", they are typically referring\nto creating a workspace from a template to ensure the infrastructure\nis provisioned correctly and the agent can connect to the control plane.\n\nBefore creating a workspace, always confirm the template choice with the user by:\n\n\t1. Listing the available templates that match their request.\n\t2. Recommending the most relevant option.\n\t2. Asking the user to confirm which template to use.\n\nIt is important to not create a workspace without confirming the template\nchoice with the user.\n\nAfter creating a workspace, watch the build logs and wait for the workspace to\nbe ready before trying to use or connect to the workspace.\n",
"name": "bmcp_coder_coder_create_workspace",
"parameters": {
"properties": {
"name": {
"description": "Name of the workspace to create.",
"type": "string"
},
"rich_parameters": {
"description": "Key/value pairs of rich parameters to pass to the template version to create the workspace.",
"type": "object"
},
"template_version_id": {
"description": "ID of the template version to create the workspace from.",
"type": "string"
},
"user": {
"description": "Username or ID of the user for which to create a workspace. Omit or use the `me` keyword to create a workspace for the authenticated user.",
"type": "string"
}
},
"required": [
"user",
"template_version_id",
"name",
"rich_parameters"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Create a new workspace build for an existing workspace. Use this to start, stop, or delete.\n\nAfter creating a workspace build, watch the build logs and wait for the\nworkspace build to complete before trying to start another build or use or\nconnect to the workspace.\n",
"name": "bmcp_coder_coder_create_workspace_build",
"parameters": {
"properties": {
"template_version_id": {
"description": "(Optional) The template version ID to use for the workspace build. If not provided, the previously built version will be used.",
"type": "string"
},
"transition": {
"description": "The transition to perform. Must be one of: start, stop, delete",
"enum": [
"start",
"stop",
"delete"
],
"type": "string"
},
"workspace_id": {
"type": "string"
}
},
"required": [
"workspace_id",
"transition"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Delete a task.",
"name": "bmcp_coder_coder_delete_task",
"parameters": {
"properties": {
"task_id": {
"description": "ID or workspace identifier in the format [owner/]workspace[.agent] for the task to delete. If an owner is not specified, the authenticated user is used.",
"type": "string"
}
},
"required": [
"task_id"
],
"type": "object"
},
"strict": false,
"type": "function"
},
{
"description": "Delete a template. This is irreversible.",
"name": "bmcp_coder_coder_delete_template",
"parameters": {
"properties": {
"template_id": {
"type": "string"
}
},