kaiten-cli 0.3.3__py3-none-any.whl
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.
- kaiten_cli/__init__.py +5 -0
- kaiten_cli/__main__.py +9 -0
- kaiten_cli/agent_gateway.py +577 -0
- kaiten_cli/app.py +1636 -0
- kaiten_cli/completion.py +570 -0
- kaiten_cli/discovery.py +39 -0
- kaiten_cli/errors.py +79 -0
- kaiten_cli/i18n.py +92 -0
- kaiten_cli/locales/ru.json +2967 -0
- kaiten_cli/localized_click.py +160 -0
- kaiten_cli/models.py +202 -0
- kaiten_cli/profiles.py +316 -0
- kaiten_cli/registry/__init__.py +260 -0
- kaiten_cli/registry/addons.py +392 -0
- kaiten_cli/registry/audit_and_analytics.py +451 -0
- kaiten_cli/registry/automation_schema.py +44 -0
- kaiten_cli/registry/automation_schemas.json +7417 -0
- kaiten_cli/registry/automations.py +342 -0
- kaiten_cli/registry/base.py +62 -0
- kaiten_cli/registry/blockers.py +320 -0
- kaiten_cli/registry/boards.py +520 -0
- kaiten_cli/registry/card_relations.py +376 -0
- kaiten_cli/registry/card_types.py +363 -0
- kaiten_cli/registry/cards.py +1329 -0
- kaiten_cli/registry/charts.py +539 -0
- kaiten_cli/registry/checklists.py +600 -0
- kaiten_cli/registry/columns.py +558 -0
- kaiten_cli/registry/comments.py +224 -0
- kaiten_cli/registry/custom_directories.py +980 -0
- kaiten_cli/registry/custom_properties.py +1460 -0
- kaiten_cli/registry/dashboards.py +564 -0
- kaiten_cli/registry/documents.py +761 -0
- kaiten_cli/registry/external_links.py +128 -0
- kaiten_cli/registry/files.py +738 -0
- kaiten_cli/registry/github_addon.py +613 -0
- kaiten_cli/registry/iterations.py +397 -0
- kaiten_cli/registry/lanes.py +205 -0
- kaiten_cli/registry/live_contracts.py +361 -0
- kaiten_cli/registry/members.py +336 -0
- kaiten_cli/registry/module_docs.py +108 -0
- kaiten_cli/registry/projects.py +369 -0
- kaiten_cli/registry/query.py +129 -0
- kaiten_cli/registry/restrictions.py +249 -0
- kaiten_cli/registry/roles_and_groups.py +1102 -0
- kaiten_cli/registry/scim.py +263 -0
- kaiten_cli/registry/service_desk.py +1270 -0
- kaiten_cli/registry/snapshot.py +187 -0
- kaiten_cli/registry/spaces.py +272 -0
- kaiten_cli/registry/subscribers.py +168 -0
- kaiten_cli/registry/tags.py +193 -0
- kaiten_cli/registry/time_logs.py +353 -0
- kaiten_cli/registry/tree.py +352 -0
- kaiten_cli/registry/utilities.py +287 -0
- kaiten_cli/registry/webhooks.py +265 -0
- kaiten_cli/runtime/__init__.py +1 -0
- kaiten_cli/runtime/automation_validation.py +115 -0
- kaiten_cli/runtime/behaviors.py +787 -0
- kaiten_cli/runtime/cache.py +733 -0
- kaiten_cli/runtime/client.py +387 -0
- kaiten_cli/runtime/endpoints.py +59 -0
- kaiten_cli/runtime/executor.py +269 -0
- kaiten_cli/runtime/fs_security.py +168 -0
- kaiten_cli/runtime/input.py +310 -0
- kaiten_cli/runtime/output.py +59 -0
- kaiten_cli/runtime/public_validation.py +35 -0
- kaiten_cli/runtime/snapshot_build.py +527 -0
- kaiten_cli/runtime/snapshot_common.py +363 -0
- kaiten_cli/runtime/snapshot_query.py +306 -0
- kaiten_cli/runtime/snapshot_store.py +1192 -0
- kaiten_cli/runtime/snapshots.py +62 -0
- kaiten_cli/runtime/sqlite_errors.py +23 -0
- kaiten_cli/runtime/support/__init__.py +1 -0
- kaiten_cli/runtime/support/addons.py +953 -0
- kaiten_cli/runtime/support/audit.py +70 -0
- kaiten_cli/runtime/support/batch.py +234 -0
- kaiten_cli/runtime/support/card_move_url.py +213 -0
- kaiten_cli/runtime/support/cards.py +174 -0
- kaiten_cli/runtime/support/checklists.py +21 -0
- kaiten_cli/runtime/support/company_users.py +117 -0
- kaiten_cli/runtime/support/dashboards.py +35 -0
- kaiten_cli/runtime/support/documents.py +175 -0
- kaiten_cli/runtime/support/files.py +561 -0
- kaiten_cli/runtime/support/markdown_export.py +525 -0
- kaiten_cli/runtime/support/pagination.py +167 -0
- kaiten_cli/runtime/support/projects.py +66 -0
- kaiten_cli/runtime/support/relations.py +86 -0
- kaiten_cli/runtime/support/restrictions.py +62 -0
- kaiten_cli/runtime/support/spaces.py +20 -0
- kaiten_cli/runtime/support/time_logs.py +61 -0
- kaiten_cli/runtime/support/tree.py +140 -0
- kaiten_cli/runtime/support/tree_sharing.py +447 -0
- kaiten_cli/runtime/trace.py +500 -0
- kaiten_cli/runtime/transforms.py +128 -0
- kaiten_cli/schema_docs.py +22 -0
- kaiten_cli/update_check.py +519 -0
- kaiten_cli-0.3.3.dist-info/METADATA +1110 -0
- kaiten_cli-0.3.3.dist-info/RECORD +99 -0
- kaiten_cli-0.3.3.dist-info/WHEEL +4 -0
- kaiten_cli-0.3.3.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"""Automation and workflow tool specs."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from kaiten_cli.models import ExampleSpec, OperationSpec, ResponsePolicy, RuntimeBehavior
|
|
6
|
+
from kaiten_cli.registry.base import make_tool
|
|
7
|
+
from kaiten_cli.registry.automation_schema import automation_properties
|
|
8
|
+
from kaiten_cli.runtime.automation_validation import validate_automation
|
|
9
|
+
from kaiten_cli.runtime.behaviors import automation_copy_request
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
TOOLS = (
|
|
13
|
+
make_tool(
|
|
14
|
+
canonical_name="automations.list",
|
|
15
|
+
mcp_alias="kaiten_list_automations",
|
|
16
|
+
description="List one page of automations for a Kaiten space.",
|
|
17
|
+
input_schema={
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"space_id": {"type": "integer", "description": "Space ID"},
|
|
21
|
+
"limit": {
|
|
22
|
+
"type": "integer",
|
|
23
|
+
"minimum": 1,
|
|
24
|
+
"maximum": 100,
|
|
25
|
+
"description": "Max results (default 50, max 100)",
|
|
26
|
+
},
|
|
27
|
+
"offset": {"type": "integer", "minimum": 0, "description": "Pagination offset"},
|
|
28
|
+
},
|
|
29
|
+
"required": ["space_id"],
|
|
30
|
+
},
|
|
31
|
+
operation=OperationSpec(
|
|
32
|
+
method="GET",
|
|
33
|
+
path_template="/spaces/{space_id}/automations",
|
|
34
|
+
path_fields=("space_id",),
|
|
35
|
+
query_fields=("limit", "offset"),
|
|
36
|
+
),
|
|
37
|
+
response_policy=ResponsePolicy(default_limit=50, result_kind="list"),
|
|
38
|
+
examples=(
|
|
39
|
+
ExampleSpec(
|
|
40
|
+
command="kaiten --json automations list --space-id 1",
|
|
41
|
+
description="List space automations.",
|
|
42
|
+
),
|
|
43
|
+
),
|
|
44
|
+
usage_notes=(
|
|
45
|
+
"This direct command returns one page; increase offset to read subsequent pages.",
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
make_tool(
|
|
49
|
+
canonical_name="automations.create",
|
|
50
|
+
mcp_alias="kaiten_create_automation",
|
|
51
|
+
description="Create a new automation in a Kaiten space.",
|
|
52
|
+
input_schema={
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"space_id": {"type": "integer", "description": "Space ID"},
|
|
56
|
+
"name": {"type": "string", "maxLength": 256, "description": "Automation name"},
|
|
57
|
+
"type": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "Automation type: on_action, on_date, on_demand. Other server-specific types are passed through.",
|
|
60
|
+
},
|
|
61
|
+
"sort_order": {"type": "number", "description": "Sort position"},
|
|
62
|
+
"source_automation_id": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Automation ID to clone from",
|
|
65
|
+
},
|
|
66
|
+
**automation_properties(),
|
|
67
|
+
},
|
|
68
|
+
"required": ["space_id"],
|
|
69
|
+
},
|
|
70
|
+
operation=OperationSpec(
|
|
71
|
+
method="POST",
|
|
72
|
+
path_template="/spaces/{space_id}/automations",
|
|
73
|
+
path_fields=("space_id",),
|
|
74
|
+
body_fields=(
|
|
75
|
+
"name",
|
|
76
|
+
"trigger",
|
|
77
|
+
"actions",
|
|
78
|
+
"conditions",
|
|
79
|
+
"type",
|
|
80
|
+
"sort_order",
|
|
81
|
+
"source_automation_id",
|
|
82
|
+
),
|
|
83
|
+
),
|
|
84
|
+
runtime_behavior=RuntimeBehavior(payload_validator=validate_automation),
|
|
85
|
+
usage_notes=(
|
|
86
|
+
"on_workflow, source_automation_id, get and copy are retained extensions, not documented Public API guarantees.",
|
|
87
|
+
"Omitting type preserves legacy validation and does not insert a default into the request.",
|
|
88
|
+
),
|
|
89
|
+
examples=(
|
|
90
|
+
ExampleSpec(
|
|
91
|
+
command='kaiten --json automations create --space-id 1 --name Auto --type on_action --trigger \'{"type":"card_created"}\' --actions \'[{"type":"add_assignee","created":"2026-01-01T00:00:00+00:00","data":{"variant":"specific","userId":42}}]\'',
|
|
92
|
+
description="Create an automation using the known live-valid add_assignee payload shape.",
|
|
93
|
+
),
|
|
94
|
+
ExampleSpec(
|
|
95
|
+
command='kaiten --json automations create --space-id 1 --type on_demand --name Complete --actions \'[{"type":"complete_checklists","created":"2026-01-01T00:00:00+00:00","data":{}}]\'',
|
|
96
|
+
description="Create a button automation without a trigger.",
|
|
97
|
+
),
|
|
98
|
+
ExampleSpec(
|
|
99
|
+
command='kaiten --json automations create --space-id 1 --type on_date --trigger \'{"type":"due_date_on_date","data":{"variant":"time_left_before_date","timezone":"UTC","offset":2,"offset_unit":"day"}}\' --actions \'[{"type":"change_asap","created":"2026-01-01T00:00:00+00:00","data":{"asap":true}}]\'',
|
|
100
|
+
description="Create a date automation without a name.",
|
|
101
|
+
),
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
make_tool(
|
|
105
|
+
canonical_name="automations.get",
|
|
106
|
+
mcp_alias="kaiten_get_automation",
|
|
107
|
+
description="Get a specific automation in a Kaiten space.",
|
|
108
|
+
input_schema={
|
|
109
|
+
"type": "object",
|
|
110
|
+
"properties": {
|
|
111
|
+
"space_id": {"type": "integer", "description": "Space ID"},
|
|
112
|
+
"automation_id": {"type": "string", "description": "Automation ID (UUID)"},
|
|
113
|
+
},
|
|
114
|
+
"required": ["space_id", "automation_id"],
|
|
115
|
+
},
|
|
116
|
+
operation=OperationSpec(
|
|
117
|
+
method="GET",
|
|
118
|
+
path_template="/spaces/{space_id}/automations/{automation_id}",
|
|
119
|
+
path_fields=("space_id", "automation_id"),
|
|
120
|
+
),
|
|
121
|
+
examples=(
|
|
122
|
+
ExampleSpec(
|
|
123
|
+
command="kaiten --json automations get --space-id 1 --automation-id auto-1",
|
|
124
|
+
description="Get an automation.",
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
),
|
|
128
|
+
make_tool(
|
|
129
|
+
canonical_name="automations.update",
|
|
130
|
+
mcp_alias="kaiten_update_automation",
|
|
131
|
+
description="Update an automation in a Kaiten space.",
|
|
132
|
+
input_schema={
|
|
133
|
+
"type": "object",
|
|
134
|
+
"properties": {
|
|
135
|
+
"space_id": {"type": "integer", "description": "Space ID"},
|
|
136
|
+
"automation_id": {"type": "string", "description": "Automation ID (UUID)"},
|
|
137
|
+
"name": {"type": "string", "maxLength": 256, "description": "New automation name"},
|
|
138
|
+
"status": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"enum": ["active", "disabled"],
|
|
141
|
+
"description": "Automation status",
|
|
142
|
+
},
|
|
143
|
+
"sort_order": {"type": "number", "description": "Sort position"},
|
|
144
|
+
**automation_properties(),
|
|
145
|
+
},
|
|
146
|
+
"required": ["space_id", "automation_id"],
|
|
147
|
+
},
|
|
148
|
+
operation=OperationSpec(
|
|
149
|
+
method="PATCH",
|
|
150
|
+
path_template="/spaces/{space_id}/automations/{automation_id}",
|
|
151
|
+
path_fields=("space_id", "automation_id"),
|
|
152
|
+
body_fields=("name", "trigger", "actions", "conditions", "status", "sort_order"),
|
|
153
|
+
),
|
|
154
|
+
runtime_behavior=RuntimeBehavior(payload_validator=validate_automation),
|
|
155
|
+
examples=(
|
|
156
|
+
ExampleSpec(
|
|
157
|
+
command="kaiten --json automations update --space-id 1 --automation-id auto-1 --status disabled",
|
|
158
|
+
description="Disable an automation.",
|
|
159
|
+
),
|
|
160
|
+
),
|
|
161
|
+
),
|
|
162
|
+
make_tool(
|
|
163
|
+
canonical_name="automations.delete",
|
|
164
|
+
mcp_alias="kaiten_delete_automation",
|
|
165
|
+
description="Delete an automation from a Kaiten space.",
|
|
166
|
+
input_schema={
|
|
167
|
+
"type": "object",
|
|
168
|
+
"properties": {
|
|
169
|
+
"space_id": {"type": "integer", "description": "Space ID"},
|
|
170
|
+
"automation_id": {"type": "string", "description": "Automation ID (UUID)"},
|
|
171
|
+
},
|
|
172
|
+
"required": ["space_id", "automation_id"],
|
|
173
|
+
},
|
|
174
|
+
operation=OperationSpec(
|
|
175
|
+
method="DELETE",
|
|
176
|
+
path_template="/spaces/{space_id}/automations/{automation_id}",
|
|
177
|
+
path_fields=("space_id", "automation_id"),
|
|
178
|
+
),
|
|
179
|
+
examples=(
|
|
180
|
+
ExampleSpec(
|
|
181
|
+
command="kaiten --json automations delete --space-id 1 --automation-id auto-1",
|
|
182
|
+
description="Delete an automation.",
|
|
183
|
+
),
|
|
184
|
+
),
|
|
185
|
+
),
|
|
186
|
+
make_tool(
|
|
187
|
+
canonical_name="automations.copy",
|
|
188
|
+
mcp_alias="kaiten_copy_automation",
|
|
189
|
+
description="Copy an automation to another space.",
|
|
190
|
+
input_schema={
|
|
191
|
+
"type": "object",
|
|
192
|
+
"properties": {
|
|
193
|
+
"space_id": {"type": "integer", "description": "Source space ID"},
|
|
194
|
+
"automation_id": {"type": "string", "description": "Automation ID (UUID)"},
|
|
195
|
+
"target_space_id": {"type": "integer", "description": "Target space ID"},
|
|
196
|
+
},
|
|
197
|
+
"required": ["space_id", "automation_id", "target_space_id"],
|
|
198
|
+
},
|
|
199
|
+
operation=OperationSpec(
|
|
200
|
+
method="POST",
|
|
201
|
+
path_template="/spaces/{space_id}/automations/{automation_id}/copy",
|
|
202
|
+
path_fields=("space_id", "automation_id"),
|
|
203
|
+
body_fields=("target_space_id",),
|
|
204
|
+
),
|
|
205
|
+
runtime_behavior=RuntimeBehavior(request_shaper=automation_copy_request),
|
|
206
|
+
examples=(
|
|
207
|
+
ExampleSpec(
|
|
208
|
+
command="kaiten --json automations copy --space-id 1 --automation-id auto-1 --target-space-id 2",
|
|
209
|
+
description="Copy an automation.",
|
|
210
|
+
),
|
|
211
|
+
),
|
|
212
|
+
),
|
|
213
|
+
make_tool(
|
|
214
|
+
canonical_name="workflows.list",
|
|
215
|
+
mcp_alias="kaiten_list_workflows",
|
|
216
|
+
description="List company workflows.",
|
|
217
|
+
input_schema={
|
|
218
|
+
"type": "object",
|
|
219
|
+
"properties": {
|
|
220
|
+
"limit": {"type": "integer", "description": "Maximum number of results"},
|
|
221
|
+
"offset": {"type": "integer", "description": "Offset for pagination"},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
operation=OperationSpec(
|
|
225
|
+
method="GET", path_template="/company/workflows", query_fields=("limit", "offset")
|
|
226
|
+
),
|
|
227
|
+
response_policy=ResponsePolicy(default_limit=50, result_kind="list"),
|
|
228
|
+
examples=(
|
|
229
|
+
ExampleSpec(command="kaiten --json workflows list", description="List workflows."),
|
|
230
|
+
),
|
|
231
|
+
),
|
|
232
|
+
make_tool(
|
|
233
|
+
canonical_name="workflows.create",
|
|
234
|
+
mcp_alias="kaiten_create_workflow",
|
|
235
|
+
description="Create a new company workflow.",
|
|
236
|
+
input_schema={
|
|
237
|
+
"type": "object",
|
|
238
|
+
"properties": {
|
|
239
|
+
"name": {"type": "string", "description": "Workflow name"},
|
|
240
|
+
"stages": {
|
|
241
|
+
"type": "array",
|
|
242
|
+
"items": {"type": "object"},
|
|
243
|
+
"description": "Workflow stages",
|
|
244
|
+
},
|
|
245
|
+
"transitions": {
|
|
246
|
+
"type": "array",
|
|
247
|
+
"items": {"type": "object"},
|
|
248
|
+
"description": "Workflow transitions",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
"required": ["name", "stages", "transitions"],
|
|
252
|
+
},
|
|
253
|
+
operation=OperationSpec(
|
|
254
|
+
method="POST",
|
|
255
|
+
path_template="/company/workflows",
|
|
256
|
+
body_fields=("name", "stages", "transitions"),
|
|
257
|
+
),
|
|
258
|
+
examples=(
|
|
259
|
+
ExampleSpec(
|
|
260
|
+
command='kaiten --json workflows create --name Flow --stages \'[{"id":"1","name":"Todo","type":"queue"}]\' --transitions \'[{"id":"t1"}]\'',
|
|
261
|
+
description="Create a workflow.",
|
|
262
|
+
),
|
|
263
|
+
),
|
|
264
|
+
),
|
|
265
|
+
make_tool(
|
|
266
|
+
canonical_name="workflows.get",
|
|
267
|
+
mcp_alias="kaiten_get_workflow",
|
|
268
|
+
description="Get a specific company workflow by ID.",
|
|
269
|
+
input_schema={
|
|
270
|
+
"type": "object",
|
|
271
|
+
"properties": {"workflow_id": {"type": "string", "description": "Workflow ID (UUID)"}},
|
|
272
|
+
"required": ["workflow_id"],
|
|
273
|
+
},
|
|
274
|
+
operation=OperationSpec(
|
|
275
|
+
method="GET",
|
|
276
|
+
path_template="/company/workflows/{workflow_id}",
|
|
277
|
+
path_fields=("workflow_id",),
|
|
278
|
+
),
|
|
279
|
+
examples=(
|
|
280
|
+
ExampleSpec(
|
|
281
|
+
command="kaiten --json workflows get --workflow-id wf-1",
|
|
282
|
+
description="Get a workflow.",
|
|
283
|
+
),
|
|
284
|
+
),
|
|
285
|
+
),
|
|
286
|
+
make_tool(
|
|
287
|
+
canonical_name="workflows.update",
|
|
288
|
+
mcp_alias="kaiten_update_workflow",
|
|
289
|
+
description="Update a company workflow.",
|
|
290
|
+
input_schema={
|
|
291
|
+
"type": "object",
|
|
292
|
+
"properties": {
|
|
293
|
+
"workflow_id": {"type": "string", "description": "Workflow ID (UUID)"},
|
|
294
|
+
"name": {"type": "string", "description": "New workflow name"},
|
|
295
|
+
"stages": {
|
|
296
|
+
"type": "array",
|
|
297
|
+
"items": {"type": "object"},
|
|
298
|
+
"description": "Updated stages",
|
|
299
|
+
},
|
|
300
|
+
"transitions": {
|
|
301
|
+
"type": "array",
|
|
302
|
+
"items": {"type": "object"},
|
|
303
|
+
"description": "Updated transitions",
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
"required": ["workflow_id"],
|
|
307
|
+
},
|
|
308
|
+
operation=OperationSpec(
|
|
309
|
+
method="PATCH",
|
|
310
|
+
path_template="/company/workflows/{workflow_id}",
|
|
311
|
+
path_fields=("workflow_id",),
|
|
312
|
+
body_fields=("name", "stages", "transitions"),
|
|
313
|
+
),
|
|
314
|
+
examples=(
|
|
315
|
+
ExampleSpec(
|
|
316
|
+
command="kaiten --json workflows update --workflow-id wf-1 --name Flow2",
|
|
317
|
+
description="Update a workflow.",
|
|
318
|
+
),
|
|
319
|
+
),
|
|
320
|
+
),
|
|
321
|
+
make_tool(
|
|
322
|
+
canonical_name="workflows.delete",
|
|
323
|
+
mcp_alias="kaiten_delete_workflow",
|
|
324
|
+
description="Delete a company workflow.",
|
|
325
|
+
input_schema={
|
|
326
|
+
"type": "object",
|
|
327
|
+
"properties": {"workflow_id": {"type": "string", "description": "Workflow ID (UUID)"}},
|
|
328
|
+
"required": ["workflow_id"],
|
|
329
|
+
},
|
|
330
|
+
operation=OperationSpec(
|
|
331
|
+
method="DELETE",
|
|
332
|
+
path_template="/company/workflows/{workflow_id}",
|
|
333
|
+
path_fields=("workflow_id",),
|
|
334
|
+
),
|
|
335
|
+
examples=(
|
|
336
|
+
ExampleSpec(
|
|
337
|
+
command="kaiten --json workflows delete --workflow-id wf-1",
|
|
338
|
+
description="Delete a workflow.",
|
|
339
|
+
),
|
|
340
|
+
),
|
|
341
|
+
),
|
|
342
|
+
)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Registry helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from kaiten_cli.models import ExampleSpec, OperationSpec, ResponsePolicy, RuntimeBehavior, ToolSpec
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def shaping_properties() -> dict[str, dict]:
|
|
9
|
+
"""Schema for the two local response-shaping options a list read can expose."""
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
"compact": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Return compact output without heavy nested fields.",
|
|
15
|
+
},
|
|
16
|
+
"fields": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Comma-separated field names to return.",
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# A list read that accepts both shaping options above.
|
|
24
|
+
SHAPED_LIST_POLICY = ResponsePolicy(
|
|
25
|
+
compact_supported=True, fields_supported=True, result_kind="list"
|
|
26
|
+
)
|
|
27
|
+
# A single small envelope: no shaping options, so none are advertised.
|
|
28
|
+
PLAIN_ENTITY_POLICY = ResponsePolicy(result_kind="entity")
|
|
29
|
+
# A list whose items are opaque to the generic transforms, so none are offered.
|
|
30
|
+
PLAIN_LIST_POLICY = ResponsePolicy(result_kind="list")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def make_tool(
|
|
34
|
+
*,
|
|
35
|
+
canonical_name: str,
|
|
36
|
+
mcp_alias: str,
|
|
37
|
+
description: str,
|
|
38
|
+
input_schema: dict,
|
|
39
|
+
operation: OperationSpec,
|
|
40
|
+
response_policy: ResponsePolicy | None = None,
|
|
41
|
+
runtime_behavior: RuntimeBehavior | None = None,
|
|
42
|
+
examples: tuple[ExampleSpec, ...] = (),
|
|
43
|
+
usage_notes: tuple[str, ...] = (),
|
|
44
|
+
search_terms: tuple[str, ...] = (),
|
|
45
|
+
bulk_alternative: str | None = None,
|
|
46
|
+
) -> ToolSpec:
|
|
47
|
+
*namespace_segments, action = canonical_name.split(".")
|
|
48
|
+
return ToolSpec(
|
|
49
|
+
canonical_name=canonical_name,
|
|
50
|
+
mcp_alias=mcp_alias,
|
|
51
|
+
namespace=".".join(namespace_segments),
|
|
52
|
+
action=action,
|
|
53
|
+
description=description,
|
|
54
|
+
input_schema=input_schema,
|
|
55
|
+
operation=operation,
|
|
56
|
+
response_policy=response_policy or ResponsePolicy(),
|
|
57
|
+
runtime_behavior=runtime_behavior or RuntimeBehavior(),
|
|
58
|
+
examples=examples,
|
|
59
|
+
usage_notes=usage_notes,
|
|
60
|
+
search_terms=search_terms,
|
|
61
|
+
bulk_alternative=bulk_alternative,
|
|
62
|
+
)
|