integram-mcp 0.7.136 → 0.7.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/index.js +20 -911
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -15,7 +15,7 @@ claude mcp add integram \
15
15
  -e INTEGRAM_URL=https://ai2o.online \
16
16
  -e INTEGRAM_EMAIL=you@example.com \
17
17
  -e INTEGRAM_PASSWORD=secret \
18
- -- npx -y integram-mcp@0.7.136
18
+ -- npx -y integram-mcp@0.7.141
19
19
  ```
20
20
 
21
21
  Ставить ничего не нужно: `npx` скачает пакет сам.
@@ -49,7 +49,7 @@ claude mcp add integram \
49
49
  -e INTEGRAM_URL=http://localhost:8081 \
50
50
  -e INTEGRAM_EMAIL=you@example.com \
51
51
  -e INTEGRAM_PASSWORD=secret \
52
- -- npx -y integram-mcp@0.7.136
52
+ -- npx -y integram-mcp@0.7.141
53
53
  ```
54
54
 
55
55
  Удалить: `claude mcp remove integram`
@@ -63,7 +63,7 @@ claude mcp add integram \
63
63
  "mcpServers": {
64
64
  "integram": {
65
65
  "command": "npx",
66
- "args": ["-y", "integram-mcp@0.7.136"],
66
+ "args": ["-y", "integram-mcp@0.7.141"],
67
67
  "env": {
68
68
  "INTEGRAM_URL": "https://ai2o.online",
69
69
  "INTEGRAM_EMAIL": "you@example.com",
@@ -83,7 +83,7 @@ claude mcp add integram \
83
83
  "mcpServers": {
84
84
  "integram": {
85
85
  "command": "npx",
86
- "args": ["-y", "integram-mcp@0.7.136"],
86
+ "args": ["-y", "integram-mcp@0.7.141"],
87
87
  "env": {
88
88
  "INTEGRAM_URL": "https://ai2o.online",
89
89
  "INTEGRAM_EMAIL": "you@example.com",
package/index.js CHANGED
@@ -419,920 +419,29 @@ async function fetchTools() {
419
419
 
420
420
  // ─── MCP Server (low-level — we pass raw JSON Schema, not Zod) ──────────────
421
421
 
422
- export const INSTRUCTIONS = `Integram — workspace-based platform: tables, documents, reports, automations, permissions, forms, webhooks, files, knowledge graph.
423
- Server: ${BASE_URL}
422
+ export const INSTRUCTIONS = `Integram — workspace platform: tables, documents, reports, automations, permissions, portal, AI. Server: ${BASE_URL}
424
423
 
425
424
  ## Getting started
426
- 1. list_workspaces → switch_workspace (required before anything else). Or create_workspace to start fresh.
427
- 2. Explore: list_tables, list_documents, list_objects for data; semantic_search for fuzzy lookup.
428
- 3. Workspace management: clone_workspace to duplicate an existing workspace; delete_workspace to permanently remove one.
425
+ list_workspaces → switch_workspace (required), or create_workspace.
429
426
 
430
427
  ## Tool discovery
431
- Stuck or unsure how the platform works? docs_map() and docs_search(query) are active from the start and read the platform docs corpus (115 documents: backend, portal, frontend, ADRs, guides). Use them before guessing.
432
-
433
- Only core tools (CRUD, search, docs corpus, graph, comments, bulk, history) are loaded by default. Use search_tools to activate more — it reports what it activated and names the tools, so it doubles as the group catalog.
434
-
435
- Different tools with similar names are NOT interchangeable. Before any call that requires confirmation, verify the exact tool name against its description: set_grant (group "grants") changes access rights, set_portal_config (group "portal") writes the portal config — one is not the other. If the tool you need is not in the active list, call search_tools to activate its group — never substitute a similar active tool.
436
-
437
- ---
438
-
439
- Phrase triggers — user wording maps to a tool group; activate it and use its tools, do NOT fall back to generic objects/documents:
440
- - «создай задачу», «задача в PM», «PM-задача», «task in PM» → group "pm": pm_create_issue in the ACTIVE workspace (module PM, not EAV objects, not documents)
441
- - «создай таблицу» → "schema"; «отчёт/репорт» → "reports"; «документ/заметка» → "docs"
428
+ Only core tools are active from the start; search_tools(keyword) activates groups on demand and reports what it activated.
429
+ docs_map(), docs_search(query), ask_advisor(question) read the platform docs corpus from the start — use them before guessing.
430
+ Similar names are NOT interchangeable (set_grant vs set_portal_config): verify the exact name before a confirmation-gated call; never substitute a similar active tool.
442
431
 
443
432
  ## PM task policy
444
- - One actionable item → one task. Multi-part work → epic + child tasks (parent_id), never one task with a wall-of-text description.
445
- - Infer, don't ask: type (падает/ошибка → bug; «хочу/добавь» → feature; крупное и без краёв → epic; иначе task), priority from urgency words (срочно/блокер → urgent/high), labels from area + tier.
446
- - Labels answer «откуда задача и про что» — self-explanatory words, no cryptic codes: источник («спека»), область (backend/frontend/platform), тема («pm», «orgs»). Срочность живёт в priority, НЕ в метках. 2-4 per task. Setting labels REPLACES the whole array — read current labels first when adding to existing.
447
- - Estimates (1-2-3-5-8-13-21) only for OPEN tasks; don't set on done.
448
- - Never invent due_date; set it only if the user named a date. Done-статус — переходом через pm_update_issue, не сразу при создании.
449
- - Mutating an issue by internal id? Pass expectedNumber (the PM-N you believe the id holds): a mismatch is rejected 409 NUMBER_MISMATCH before anything is written — parallel sessions and SQL id|number columns make id mix-ups routine.
450
- - Child issues do NOT inherit labels from their epic — set labels explicitly on every create.
451
- - Ask ONLY when: the wording fits both a PM task and something else (EAV record / document), or a bulk breakdown (>3 tasks) has no obvious split.
452
-
453
- ## Data modeling — the DECISION TREE
454
-
455
- For every field, ask: "Where do the values come from?"
456
-
457
- 1. **User types any value, each entry unique** (name, address, phone, email)
458
- → **text** (or **memo** for long text)
459
-
460
- 2. **User picks ONE value from a fixed set** (status, priority, category, city, stage, department, type)
461
- → **ref** to a lookup table (single select dropdown)
462
- How: create a lookup table with options → add ref column pointing to it
463
-
464
- 3. **User picks MULTIPLE values from a fixed set** (tags, skills, features, categories)
465
- → **ref + multi=true** to a lookup table (multiselect checkboxes/chips)
466
- How: create a lookup table with options → add ref column with multi=true
467
-
468
- 4. **User picks a record from another entity** (client on a deal, assignee on a task)
469
- → **ref** to that entity's table (dropdown showing records from the target table)
470
- How: add ref column with refTypeId = target table ID
471
-
472
- 5. **Data is a sub-list owned by a parent** (order items, task steps, contact persons, comments)
473
- → **child table** with parentTableName (in plan_schema) or parentTypeId (in create_table)
474
- Child records are created with parentId and shown as nested tabs inside parent record
475
-
476
- 6. **Numeric value** (price, qty, score) → **number**
477
- 7. **Date** (deadline, birthday) → **date**; with time → **datetime**
478
- 8. **Yes/No flag** (active, done) → **bool**
479
- 9. **File upload** (photo, document) → **file**
480
-
481
- ## Lookup tables (справочники) — dropdowns & multiselects
482
-
483
- A lookup table = regular table where each record is one option. Other tables reference it via ref columns → user sees a dropdown.
484
-
485
- **Key rules:**
486
- - Lookup table itself has NO columns — only a name per record (seedRecords in plan_schema)
487
- - The ref column goes in the TABLE THAT USES the dropdown, NOT in the lookup table
488
- - One lookup can serve multiple ref columns across different tables (e.g., "Priorities" used by both "Tasks" and "Deals")
489
- - For multiselect: ref + multi=true. Multiselect WITHOUT a lookup is IMPOSSIBLE.
490
- - When setting ref values in create_object/update_object: pass either the record ID (number) OR the exact record name — the backend resolves names → ids via _v2_objects lookup. For multi: comma-separated ids or names. Ambiguous names (multiple matches) throw an error — pass id to disambiguate.
491
-
492
- **Common lookups to create:**
493
- - Statuses: "New", "In Progress", "Done", "Cancelled"
494
- - Priorities: "Low", "Medium", "High", "Critical"
495
- - Categories/Types: domain-specific classification
496
- - Stages: workflow steps ("Lead", "Negotiation", "Contract", "Closed")
497
- - Tags: multi-select labels
498
-
499
- ## Table relationships — ref vs child vs lookup
500
-
501
- | Pattern | Example | How | UI |
502
- |---|---|---|---|
503
- | **Lookup** (fixed options) | Task → Status | lookup table + ref column | dropdown |
504
- | **Lookup multi** (multiple options) | Task → Tags | lookup table + ref + multi=true | checkboxes/chips |
505
- | **Reference** (link to entity) | Deal → Client | ref column pointing to entity table | dropdown with entity records |
506
- | **Child table** (owned sub-records) | Order → Order Items | child table with parentTableName | nested tabs inside parent record |
507
-
508
- **When to use ref vs child table:**
509
- - **ref** = link between INDEPENDENT entities. Both exist on their own. Deleting one doesn't delete the other. Example: Deal references Client — Client exists without Deal.
510
- - **child table** = OWNED sub-records. Children don't exist without parent. Shown as tabs inside parent record, NOT in sidebar. Example: Order has Order Items — items don't exist outside the order.
511
-
512
- **Child table rules:**
513
- - In plan_schema: set parentTableName = name of parent table
514
- - In create_table: set parentTypeId = ID of parent table
515
- - When creating child records: pass parentId = ID of the parent record
516
- - Child tables appear as nested tabs when viewing the parent record
517
- - Child tables do NOT appear in the sidebar navigation
518
- - A child table can have its own columns, refs, and even its own child tables (nested hierarchy)
519
-
520
- ## plan_schema — create entire schema in one shot
521
-
522
- **ALWAYS use plan_schema when creating 2+ tables.** Activate via search_tools("schema").
523
-
524
- plan_schema({ tables: [...] }) creates all tables, columns, refs, and seed records with ONE confirmation.
525
-
526
- **Table properties:**
527
- - name (required) — table name
528
- - icon — emoji icon
529
- - valueColumnName — display name for the virtual _value column (record name). Default = table name in singular form (table "Clients" → column "Client"). Use valueColumnName only if you want a different header (e.g. "Full Name" instead of "Client", "Order #" instead of "Order").
530
- - isLookup — true for dropdown/lookup tables (only has seedRecords, no columns)
531
- - seedRecords — array of option names for lookup tables: ["New", "Active", "Closed"]
532
- - parentTableName — name of parent table (for child tables). Must match another table's name in the plan.
533
- - columns — array of column definitions (see below). Do NOT include a "Name"/"Title" column — it duplicates _value.
534
-
535
- **Column properties:**
536
- - alias (required) — display name
537
- - type — data type: text/memo/number/date/datetime/bool/file/pwd/uuid/url/duration/currency/percent/rating/status/choice/phone/email/collaborator/http_button/script_button/ai_button (NOT needed if refTable is set)
538
- - refTable — name of another table in the plan for ref/dropdown column
539
- - multi — true for multiselect (REQUIRES refTable)
540
- - required — true for mandatory field
541
- - unique — true for unique constraint (article codes, SKU, email if must be unique)
542
- - size — length limit: "100" (max chars) or "10,2" (precision,scale for numbers e.g. price with 2 decimals)
543
- - kind — set to "FORMULA" for a computed column. Only FORMULA is supported in plan_schema.
544
- - expr — formula for kind=FORMULA. Variables are other column aliases of the SAME table in square brackets: "[Цена] * [Количество]". Variables are resolved to column IDs automatically.
545
-
546
- **Smart header grouping — column merging under parent headers:**
547
- Use dot "." in alias to group columns: "Group.Column" → columns with same prefix merge under a shared header.
548
- Example: { "alias": "Contacts.Phone" }, { "alias": "Contacts.Email" }, { "alias": "Contacts.Telegram" } → all three appear under "CONTACTS" parent header.
549
- Rules: at least 2 consecutive columns with same prefix; columns without dot remain standalone.
550
- Use for tables with many related columns (contacts, address, financials, specs). Skip for tables with ≤4 columns.
551
-
552
- **CRITICAL — _value virtual column (record name):**
553
- Every table automatically has a virtual _value column — the record's display name (first column in UI, clickable link).
554
- - _value is filled via the "name" field in create_object / bulk_create.
555
- - Do NOT create a separate "Name"/"Title"/"Название" column — it duplicates _value and causes UI confusion.
556
- - Default _value header = table name in singular form ("Products" → "Product"). Use valueColumnName only to override (e.g. "Full Name" instead of "Client").
557
-
558
- **CRITICAL rules:**
559
- - Ref columns go in the TABLE THAT REFERENCES, NOT in the lookup. "Status" column → in "Clients", NOT in "Statuses".
560
- - Lookup tables (isLookup=true) have ONLY seedRecords, NO columns array.
561
- - Tables are auto-sorted: lookups first, then parents, then children. No need to order manually.
562
- - refTable must match the exact name of another table in the same plan.
563
- - After plan_schema completes — ALL tables, columns, refs, and seed records are ALREADY created. Do NOT call create_table, add_column, create_object, or plan_schema after it — everything is done. Just tell the user what was created.
564
- - LOOKUP/ROLLUP columns are NOT supported in plan_schema — create the tables first, then add them with create_computed.
565
-
566
- **Example — Project Management:**
567
- \`\`\`json
568
- {
569
- "tables": [
570
- { "name": "Statuses", "isLookup": true, "seedRecords": ["Backlog", "In Progress", "Review", "Done"] },
571
- { "name": "Priorities", "isLookup": true, "seedRecords": ["Low", "Medium", "High", "Critical"] },
572
- { "name": "Tags", "isLookup": true, "seedRecords": ["Bug", "Feature", "Improvement", "Urgent"] },
573
- { "name": "Projects", "icon": "📁", "columns": [
574
- { "alias": "Description", "type": "memo" },
575
- { "alias": "Status", "refTable": "Statuses" },
576
- { "alias": "Start Date", "type": "date" },
577
- { "alias": "Budget", "type": "number" }
578
- ]},
579
- { "name": "Tasks", "icon": "✅", "columns": [
580
- { "alias": "Description", "type": "memo" },
581
- { "alias": "Project", "refTable": "Projects" },
582
- { "alias": "Status", "refTable": "Statuses" },
583
- { "alias": "Priority", "refTable": "Priorities" },
584
- { "alias": "Tags", "refTable": "Tags", "multi": true },
585
- { "alias": "Deadline", "type": "date" },
586
- { "alias": "Completed", "type": "bool" }
587
- ]},
588
- { "name": "Subtasks", "parentTableName": "Tasks", "icon": "📋", "columns": [
589
- { "alias": "Done", "type": "bool" }
590
- ]},
591
- { "name": "Comments", "parentTableName": "Tasks", "columns": [
592
- { "alias": "Text", "type": "memo", "required": true },
593
- { "alias": "Date", "type": "datetime" }
594
- ]}
595
- ]
596
- }
597
- \`\`\`
598
-
599
- This creates: 3 lookups (dropdown sources), 2 main tables (Projects, Tasks) linked by refs, 2 child tables (Subtasks, Comments nested inside Tasks). Tasks has single-select Status/Priority, multiselect Tags, and a ref to Projects. Note: NO "Name"/"Title" columns — record names are set via _value (the "name" field in create_object).
600
-
601
- **Example — Manufacturing (from production template):**
602
-
603
- Lookups: Shops, Equipment Statuses ["Working","Maintenance","Broken","Decommissioned"], Maintenance Types ["Planned","Unplanned","Emergency","Diagnostic"], Severity Levels, Units, Positions
604
- Main tables: Equipment (→Shop ref, →Status ref, Model text, Serial text, Commissioned date, Description memo), Spare Parts (SKU text unique, →Unit ref, →Supplier ref, Qty number, MinQty number)
605
- Child tables: Maintenance → child of Equipment (→Type ref, →Executor ref, Planned date, Actual date, Cost number), Incidents → child of Equipment (→Severity ref, Description memo, Downtime number, Resolution memo)
606
- Independent: Suppliers (Contact text, Email text, Phone text), Staff (→Position ref, →Shop ref)
607
-
608
- **Example — E-commerce (from production template):**
609
-
610
- Lookups: Categories, Product Statuses ["Active","Draft","Discontinued"], Order Statuses ["New","Processing","Shipped","Delivered","Cancelled"], Payment Statuses ["Pending","Paid","Refund"], Ticket Statuses, Document Types ["Invoice","Waybill","Act","Return"]
611
- Main tables: Products (→Category ref, →Status ref, SKU text unique, Price number, Cost number, Description memo, Photo file, InStock bool), Clients (Email text, Phone text, Address memo, Comment memo), Orders (→Client ref, →Status ref, →Payment Status ref, →Warehouse ref, Total number, Tracking text, Date datetime)
612
- Child tables: Order Items → child of Orders (→Product ref, Qty number, Price number, Sum number)
613
- Independent: Warehouses (Address text, Phone text), Stock (→Product ref, →Warehouse ref, Qty number), Support Tickets (→Client ref, →Order ref, →Status ref, Subject text, Description memo)
614
-
615
- **Example — Farm Shop (from production template):**
616
-
617
- Lookups: Client Sources ["UDS","VK","Instagram","Telegram","Referral","Repeat"], Order Statuses, Payment Statuses, Product Categories, Messengers, Delivery Methods ["CDEK","Russian Post"], Loyalty Levels
618
- Main tables: Clients (valueColumnName="Full Name", Phone text, Email text, →Messenger ref, →Source ref, →Loyalty ref, Points number, Total number), Products (→Category ref, SKU text, Price number, Photo file, Description memo, Weight number, InStock bool), Orders (→Client ref, →Status ref, →Payment ref, →Delivery ref, →Messenger ref, Number text, Total number, Ship date, Tracking text)
619
- Child tables: Addresses → child of Clients (City text, Address memo, Zip text, Primary bool), Order Items → child of Orders (→Product ref, Qty number, Price number), Reorders → child of Orders (Sum number, Comment memo, →Payment ref), Comments → child of Orders (Text memo)
620
-
621
- **Advanced patterns (from production systems):**
622
- 1. **Shared lookup across tables** — one "Statuses" lookup can be used in Orders, Tasks, Tickets etc. One isLookup table, multiple ref columns in different tables pointing to it. Don't create "Order Statuses" + "Task Statuses" if values are the same.
623
- 2. **Multiple refs to same table** — a Contract can reference Contractor THREE times: "Customer", "Executor", "Agent". Each is a separate ref column with different alias but same refTable.
624
- 3. **Lookups with extra columns** — if a lookup needs its own data fields (e.g. Bank with BIC, Role with Template), use isLookup=false with both columns AND seedRecords.
625
-
626
- **Patterns from production templates:**
627
- - Status, Category, Type, Priority, Payment Method, Source, Messenger, Role, City → ALWAYS lookup table (isLookup + seedRecords), never text
628
- - Order items, Maintenance, Incidents, Addresses, Reorders, Details, Statistics → CHILD tables (parentTableName), not standalone
629
- - Phone, Email, Address, SKU, Tracking, TIN, URL → text
630
- - Price, Qty, Cost, Downtime, Points, Reach, Subscribers → number
631
- - Description, Notes, Resolution, Comment, Details (long) → memo
632
-
633
- **Common mistakes to avoid:**
634
- 1. Missing lookup table — if a ref column points to "OrderStatuses", a table "OrderStatuses" with isLookup=true MUST exist in the plan
635
- 2. Not using child tables — order items, maintenance records, addresses, contacts, details, statistics MUST be child (parentTableName), not standalone root tables
636
- 3. Using text for statuses/categories — these are ALWAYS lookups
637
- 4. Creating duplicate lookups — if "Statuses" is shared across Orders and Tasks, create ONE lookup, not two separate "Order Statuses" and "Task Statuses" tables
638
- 5. Forgetting multiple refs — when an entity has multiple roles (buyer/seller/agent), create separate ref columns with unique aliases pointing to the same refTable
639
-
640
- **Manual schema creation (for single table or adding to existing):**
641
- When not using plan_schema — plan ALL tables first. Ref columns need the target table to exist. Steps:
642
- 1. Create ALL lookup tables first (statuses, categories, tags)
643
- 2. Fill lookup tables with option records (create_object)
644
- 3. Create main tables with ref columns pointing to lookups (add_column with refTypeId)
645
- 4. Create data — for ref fields, use record IDs from lookup tables
646
-
647
- ---
648
-
649
- ## Records (objects)
650
-
651
- Records are created with create_object({ typeId, fields, parentId }). Fields is an object { columnAlias: value }.
652
- - For text/number/date/bool: pass the value directly: { "Название": "iPhone 15", "Цена": 999, "В наличии": true }
653
- - For single ref: pass either the record ID as a number OR the exact record name as a string — the backend resolves both: { "Статус": 42 } or { "Статус": "Новый" }. ID is preferred when names may be ambiguous.
654
- - For multiselect: comma-separated ids or names: { "Теги": "urgent, important" } or { "Теги": "12, 13" }
655
- - For child records: include parentId = ID of the parent record
656
-
657
- list_objects returns records with column aliases as keys. Use search for free-text search across all fields; filters for exact match on known aliases.
658
-
659
- ## Computed columns (LOOKUP, ROLLUP, FORMULA)
660
-
661
- Computed columns auto-calculate values based on other data. Activate via search_tools("schema"); for computed columns and formulas specifically use search_tools("schema computed formula").
662
-
663
- - **LOOKUP** — pull a value from a related record through a reference column. Like VLOOKUP in Excel.
664
- Example: Order has ref to Product → LOOKUP pulls Product's price into Order table.
665
- Config: { sourceReqId: refColumnId, targetColId: targetColumnId }
666
-
667
- - **ROLLUP** — aggregate values from child records or linked records. Like SUMIF in Excel.
668
- Example: Order has child table OrderItems → ROLLUP sums all item prices.
669
- Config: { linkReqId: columnIdInChildTable, targetColId: childColumnId, fn: "SUM"|"AVG"|"COUNT"|"MIN"|"MAX" }
670
- Note: linkReqId is the column in the CHILD table that references this (parent) table, NOT a column in this table.
671
-
672
- - **FORMULA** — calculate a value using an expression with other columns.
673
- Example: "Сумма" = [Цена] * [Количество]
674
- Config: { expr: "[Цена] * [Количество]", vars: { "varName": reqId } }
675
- Use generate_formula(typeId, description) to auto-generate formula from natural language.
676
- Formula functions: if, switch, coalesce, isnull, abs, round, floor, ceil, sqrt, power, mod, log, sign, int, sum, average, min, max, concat, upper, lower, trim, len, left, right, substr, contains, starts_with, ends_with, find, replace, today, now, year, month, day, hour, minute, weekday, date_diff, date_add, number, text, bool, and, or, not, xor
677
-
678
- Workflow: list_computed → create_computed(kind, typeId, alias, config) → update_computed / delete_computed.
679
- Backlinks: get_schema_backlinks(typeId) — show which columns from OTHER tables reference this table. Useful when creating ROLLUP to discover available linkReqId values.
680
-
681
- ## Validation rules
682
-
683
- Set constraints on column values. Activate via search_tools("schema validation rules").
684
- - get_validation_rules(reqId) — see current rules for a column
685
- - set_validation_rules(reqId, rules) — set rules: { minLength, maxLength, minValue, maxValue, regex, unique }
686
- Example: require email format → set_validation_rules(reqId, { regex: "^[\\\\w.-]+@[\\\\w.-]+\\\\.[a-z]{2,}$" })
687
-
688
- ## AI Buttons
689
-
690
- AI Button is a column that shows a clickable button per row. When clicked, it runs an LLM prompt using data from that row and optionally writes the result to another column.
691
-
692
- Setup: 1) add_column(typeId, alias, colTypeName="ai") → 2) configure_ai_button(typeId, reqId, prompt, ...)
693
- - In prompt, use [ColumnName] to inject column values: "Summarize: [Description]"
694
- - [ID] = record id, [VAL] = record display name
695
- - outputReqId = column ID where AI result is auto-written (optional)
696
- - temperature: "low" (0.2 — factual), "medium" (0.7 — balanced), "high" (1.2 — creative)
697
- - agentMode: true — run full agent with all tools (web_search, tables, docs, etc.) instead of simple LLM chat
698
- Run per row: run_ai_button(typeId, reqId, objectId). Get config: get_ai_button_config(typeId, reqId).
699
-
700
- ## HTTP Buttons
701
-
702
- HTTP Button (type 1016) is a column that makes a direct HTTP request on button click using row data as placeholders — no LLM involved.
703
-
704
- Setup: 1) add_column(typeId, alias, colTypeName="http_button") → 2) configure_http_button(typeId, reqId, url, method?, headers?, bodyTemplate?, responsePath?, outputReqId?)
705
- - url and bodyTemplate support [ColumnName] placeholders (replaced with row values)
706
- - responsePath — dot-notation path to extract value from JSON response (e.g. "data.price")
707
- - outputReqId = column ID where extracted value is auto-written (optional)
708
- Run per row: run_http_button(typeId, reqId, objectId). Get config: get_http_button_config(typeId, reqId).
709
-
710
- ## Script Buttons
711
-
712
- Script Button (type 1020) is a column that runs user-written JavaScript on button click. Scripts execute exclusively in the browser (Web Worker) — server-side execution is disabled for security.
713
-
714
- Setup: 1) add_column(typeId, alias, colTypeName="script_button") → 2) configure_script_button(typeId, reqId, script, outputReqId?)
715
- - Script globals: \`row\` (field name → value map, includes row.ID), \`fetch\` (HTTP requests via server proxy), \`ai(prompt, model?)\` (LLM call, default model: "fast"), \`output(value)\` (write result), \`setField(reqId, value)\` (write to any column)
716
- - outputReqId = column ID where result is auto-written (optional)
717
- - Timeout: 60s total (allows time for fetch + ai calls)
718
- - Scripts can only be run by clicking the button in the UI. There is no server-side run tool.
719
- Get config: get_script_button_config(typeId, reqId).
720
-
721
- Example scripts:
722
- - \`output(row['Price'] * 1.2)\` — apply markup
723
- - \`const r = await fetch('https://api.example.com?q=' + encodeURIComponent(row['Name'])); const d = await r.json(); output(d.price)\` — fetch from external API
724
- - \`const summary = await ai('Classify this product: ' + row['Name']); output(summary)\` — LLM classification
725
-
726
- ---
727
-
728
- ## run_script Tool
729
-
730
- Execute JavaScript in an isolated sandbox (isolated-vm, V8 isolate). Requires confirmation (TIER_HIGH).
731
-
732
- run_script(script, typeId, objectId?, timeoutMs?)
733
- - script: JavaScript code to execute
734
- - typeId: table ID (for column definitions and row context)
735
- - objectId: record ID (loads row data). If omitted, row = {}
736
- - timeoutMs: execution timeout (max 60000, default 60000)
737
-
738
- Script globals: row (record fields object, empty {} if no objectId), fetch(url, opts) → {status, body, ok}, ai(prompt, model?) → string, output(value), setField(reqId, value) (requires objectId — skipped without it), query(typeId, opts) → [{id, value, parentId, typeId}] (metadata only — use getRecord for full fields), getRecord(id), createRecord(typeId, {name, fields}), updateRecord(id, {fields}), deleteRecord(id), console.log(), JSON, Math, Date.
739
- - browse(query, source?) — search marketplace prices. Returns [{name, price, url, source}]. Calls browser service internally.
740
-
741
- Returns: { value, fields, logs }
742
- - value: string from output() call
743
- - fields: { reqId: value } from setField() calls (written to DB only if objectId was provided)
744
- - logs: array of console.log() messages
745
-
746
- Limits: 128MB RAM, 60s timeout, rate limits per execution (30 queries, 50 mutations, 50 fetch, 10 ai).
747
- SSRF protection: requests to localhost, private IPs, .local, .internal are blocked.
748
-
749
- ---
750
-
751
- ## search_prices Tool
752
-
753
- Search marketplace prices for a product by name. Returns array of results with name, price, URL, source.
754
-
755
- search_prices(query, source?, limit?)
756
- - query: product name to search
757
- - source: marketplace source (default: "komus"). Supported: komus, wildberries, samson.
758
- - limit: max results (default: 10)
759
- - Returns: { items: [{name, price, url, source}], query, total }
760
- - TIER_LOW — no confirmation required.
761
- - Requires browser service running on port 3099.
762
-
763
- ---
764
-
765
- ## Reports
766
-
767
- Reports aggregate and filter data from tables. Activate via search_tools("reports").
768
-
769
- **Creating a report:**
770
- 1. create_report(name, parentTypeId) — parentTypeId = source table ID. Returns reportId.
771
- 2. add_report_column(reportId, reqTypeId or columnAlias) — add columns. Returns colId.
772
- **IMPORTANT:** Do NOT add the record name (_value) column — it is included automatically as the first column of every report. Passing valueColumnName (e.g. "Наименование") or the table name as columnAlias creates a broken column with reqTypeId=0 that shows "NaN" in the report.
773
- 3. Optionally set func (SUM/AVG/COUNT/MIN/MAX/GROUP_CONCAT), totalFunc (footer totals), storedFrom/storedTo (default filters).
774
- 4. update_report(reportId, where) to add WHERE filter.
775
-
776
- **WHERE filter syntax:**
777
- - Column alias in WHERE = "c" + colId (from add_report_column response, NOT the original reqTypeId)
778
- - Tokens: [USER] = current username, [USER_ID] = current user id, [TODAY] = today's date, [NOW] = current datetime
779
- - {{DB}} = workspace EAV table name (for subqueries, auto-resolved at execution time)
780
- - Example: \`AND c35768.val = '[USER]'\` — filter to current user's records
781
- - Subquery example: \`AND EXISTS (SELECT 1 FROM {{DB}} _st WHERE _st.up = a.up AND _st.val = '378' AND _st.t = 393)\` — filter child records by parent's ref field (a.up = parent record ID)
782
-
783
- **Aggregation in reports:**
784
- - func on a column: SUM, AVG, COUNT, MIN, MAX, GROUP_CONCAT
785
- - totalFunc: shows a total in the report footer
786
- - havingFrom/havingTo: HAVING filters for aggregated columns (e.g., "show only groups with COUNT > 5")
787
- - storedFrom/storedTo: default filter range (pre-applied when user opens the report). Supports [TODAY], [NOW]. For ref columns, use the record ID (not name).
788
-
789
- **Cross-table reports (JOIN):**
790
- - create_report_join(reportId, typeId, alias) — add JOIN to another table. For child table reports, JOIN to parent table is auto-detected (uses a.up).
791
- - add_report_column with joinAlias=alias — column from the joined table. Works with ref columns (inverted EAV handled automatically).
792
- - storedFrom/storedTo on joined columns — filter by joined table's field values.
793
- - Example workflow: report on "Order Items" (child) + JOIN to "Orders" (parent, alias="order") + column "Order Status" (joinAlias="order", storedFrom=statusId, storedTo=statusId) → filters child records by parent's status.
794
- - delete_report_join(reportId, joinId) — remove JOIN (requires confirmation).
795
-
796
- **Permissions report:** create_report with parentTypeId=9001 (virtual). Columns: 9011=User, 9012=Role, 9013=Object Type, 9014=Access Level, 9015=Export flag, 9016=Delete flag.
797
-
798
- Run: get_report(reportId, limit, filters). Structure: describe_report(reportId). History: get_report_history(reportId).
799
- Export: export_report(reportId, filters?, order?, limit?) — export report data to CSV string. Returns { csv, filename, rowCount }.
800
- Bulk update: report_bulk_update(reportId, filters?) — mass-update records using SET expressions defined in report columns (requires confirmation). Only works if report has SET columns configured.
801
-
802
- ## Documents
803
-
804
- Block-based documents (like Notion). Activate via search_tools("документ document"); for a subarea narrow the query: search_tools("документ block"), search_tools("документ folder"), search_tools("документ tag"), search_tools("документ version"), search_tools("документ trash restore"), search_tools("документ template pdf"), search_tools("документ access sharing").
805
-
806
- - list_documents(search, folderId) — browse documents
807
- - get_document(docId) / get_document_blocks(docId) — read content and block structure
808
- - create_document(title, parentId) — create new doc (parentId for nesting)
809
- - append_block(docId, text, type, format) — add block at end. Types: text, heading, code, quote, list, todo. format:"delta" — text is a ready Quill delta {"ops":[…]}; without it, markdown autodetect/plain text.
810
- - update_block(docId, blockId, text, format) — modify existing block. format:"delta" — text is a ready Quill delta {"ops":[…]}; without it, plain text.
811
- - delete_block(docId, blockId) — remove block
812
- - update_document_title(docId, title)
813
- - delete_document(docId) — move document to trash (requires confirmation)
814
- - reorder_blocks(docId, order) — reorder blocks in a document. order = array of block IDs in target order.
815
- - create_document_from_template(templateId, title?, folderId?) — create document from a template (doc with is_template=true)
816
- - generate_pdf(objectId, templateId, format?, landscape?) — generate PDF from template document for a specific record. Returns { filename, size, base64 }.
817
-
818
- **Trash:**
819
- - list_doc_trash(limit?, offset?) — list deleted documents
820
- - restore_document(docId) — restore document from trash
821
-
822
- **Organization:**
823
- - Folders: list_doc_folders, create_doc_folder, update_doc_folder, delete_doc_folder
824
- - Tags: list_doc_tags, create_doc_tag, delete_doc_tag, add_tag_to_doc, remove_tag_from_doc
825
- - Versions: list_doc_versions, get_doc_version(docId, versionId), restore_doc_version
826
- - Block history: get_block_history(docId, blockId, limit?, offset?)
827
- - Purge: purge_document(docId) — permanently delete trashed doc (requires confirmation)
828
- - Sharing: list_doc_sharing, grant_doc_access(docId, targetUserId, role: viewer|editor|admin), revoke_doc_access
829
-
830
- ## Automations
831
-
832
- Event-driven rules: when X happens → check condition → do Y. Activate via search_tools("automations").
833
-
834
- create_automation({ name, trigger: { type, typeId }, active?, condition, actions: [{ type, …плоские ключи действия }] }) — действия хранятся с ПЛОСКИМИ ключами: { type: 'run_script', script: '…' }, вложенного config нет
835
- - active: false — создать выключенной (по умолчанию включена; выключенная не встаёт в расписание и не срабатывает)
836
- - Trigger types: on_create, on_update, on_delete, on_deadline, on_webhook, on_form_submit, schedule, manual, ai_analysis, on_metric_threshold, on_metric_silence, on_document, on_ncl_run_completed, on_ncl_requirement_created, on_ncl_evidence_stale, on_telegram_command, on_telegram_message, on_telegram_pre_checkout, on_telegram_shipping, on_telegram_payment, on_telegram_inline, on_telegram_join_request, on_telegram_business_connection, on_telegram_business_message, on_bot_chat_member, pm_deadline, on_issue_commented, on_issue_updated, on_issue_created, on_issue_status_changed, on_sprint_started, on_sprint_completed, on_file_processed, on_member_joined
837
- on_file_processed: { status?: 'done'|'error'|'skipped'|'confirmed' (пусто = любой терминальный) }; в действиях доступны {{file_id}}, {{file_object_id}}, {{file_status}}, {{file_error}}, {{file_name}}
838
- on_member_joined: событие member.joined — новый участник воркспейса (пригласительная ссылка); в действиях доступны {{memberUserId}}, {{memberEmail}}, {{memberRole}}, {{workspaceSlug}}, {{meta}}
839
- pm_deadline: { days: N (за сколько дней до due_date PM-задачи, default 1), hour: 0-23 (час UTC ежедневного скана, default 7) }; в действиях доступны {{pm_title}}, {{pm_number}}, {{pm_due_date}}, {{pm_assignee_email}} (send_notification адресуйте username: '{{pm_assignee_email}}')
840
- on_issue_commented / on_issue_updated: событие PM-задачи (комментарий / правка полей), pm-переменные те же
841
- - Actions: send_notification, send_notification_to_group, update_field, create_object, delete_object, fire_webhook, run_ai_agent, run_script, run_server_function, run_video_job, telegram_send_message, telegram_send_card, telegram_send_draft, telegram_send_media, create_document, run_connector, send_email, update_related_records, set_requisite, update_related, http_request, if_else, switch, transform, wait_delay, request_approval, delegate_to_agent (работает и с internal-агентами реестра воркспейса), invoke_agent, telegram_send_invoice, telegram_forward, telegram_answer_inline_query, telegram_ban, telegram_unban, telegram_restrict, telegram_promote, telegram_approve_join, telegram_decline_join, telegram_pin, telegram_unpin, telegram_get_chat, telegram_post_story, telegram_answer_shipping, telegram_business_reply, create_issue, update_issue, link_issue
842
- telegram_send_card — render a workspace record as a rich message (Bot API 10.1+, markdown template + inline buttons with callback `a:<automationId>:<objId>`). Params: botId, typeId, objId?, template, buttons[], chatId|recipients.
843
- telegram_send_draft — stream a message draft to a private chat (Bot API 10.1+; same draft_id animates text growth). Params: botId, chatId, text, draftId?, parseMode?.
844
- Deprecated aliases (send_telegram, send_telegram_media, answer_shipping, etc.) still execute but always emit canonical telegram_* names — use canonical only.
845
- create_issue: { title, description?, issue_type?, priority?, assignee_id?, parent_id?, board_id?, sprint_id?, due_date?, estimate?, labels?, assigneeRole?, assigneeStrategy? } — создаёт PM-задачу; результат: {{_created_issue_id}}, {{_created_issue_number}}. assigneeRole — имя EAV-таблицы-роли воркспейса (строки = участники, у каждого логин в колонке «Логин»/«Username»/«Email», колонка ищется по имени или алиасу); assigneeStrategy: least_busy (умолчание) | first; assignee_id и assigneeRole взаимно исключают друг друга — конфликт отвергается при сохранении. Роль без резолвимых участников → задача без исполнителя + уведомление роли (или триггера), прогон не падает.
846
- link_issue: { issue_id?, issue_number?, target_type?, target_id? } — привязывает задачу к цели через data-links (issue_id или issue_number; без них берётся {{_created_issue_id}} предыдущего create_issue); 409 (связь уже стоит) считается успехом.
847
- update_issue: { id, title?, description?, issue_type?, status?, priority?, assignee_id?, sprint_id?, parent_id?, estimate?, due_date?, labels? } — правит PM-задачу; id можно взять из {{pm_issue_id}}
848
- update_related_records: { childTypeId, matchRefReqId, targetTypeId, targetMatchReqId, targetFieldReqId, sourceFieldReqId, operation: 'add'|'subtract'|'set' } — declarative cross-table update (e.g. inventory deduction: order items → match product ref → subtract from stock)
849
- run_server_function: { repo, fn, args?, resultVar?, idempotencyKey?, idempotencyMinutes? } — call a codespace server function (api/<fn>.js in a workspace git repo) from an automation; this is how repo code gets put on a schedule (trigger.type: 'schedule'), which previously was impossible since server functions were reachable only over HTTP from the portal. Same sandbox, capabilities and limits as the portal path (codespace/server-fn-executor.js); capabilities are declared by a "// capabilities:" comment inside the function file. Replay protection is ON by default: repo+fn+args+record runs once per idempotencyMinutes (default 1) — keep it BELOW the schedule interval or runs are silently skipped; 0 disables it. A failed call releases its claim so the next run retries. Sets {{_server_fn_error}} / {{_server_fn_skipped}}.
850
- run_video_job: { scenario, resultVar? } — queue a video-engine render job (scenario = steps[] + narration, the pipeline tts→record→assemble lives in the video-engine module). Does NOT wait for the render: jobId lands in {{_video_job_id}} and {{resultVar}}; status/result via /video-engine/jobs/:id. Sets {{_video_job_error}} on failure.
851
- telegram_send_media: { kind: voice|video|document, botId?, chatId, text? (voice: TTS via Piper + ffmpeg→OGG, ffmpeg failure falls back to WAV document), videoJobId? (video-engine job id), fileUrl?, caption?, resultVar? } — send a voice note / video / file to a Telegram chat. chatId/text/caption accept {{variables}}. Sets {{_tg_media_message_id}} / {{_tg_media_error}}.
852
- create_document: { title, markdown, resultVar? } — create a workspace document from markdown (a meeting protocol lands on the portal as a document). Owner: ctx.user id or the automation's created_by. Sets {{_document_id}} / {{_document_error}}.
853
- send_notification_to_group: { typeId, usernameReqId, title, body, filter?: { reqId, val } } — notifies all members of a table whose usernameReqId field is a valid Integram username; optional filter restricts to members where reqId==val (e.g. role filter)
854
- - list_automations, get_automation (single), update_automation, delete_automation, trigger_automation (manual run), get_automation_runs (execution log)
855
-
856
- ## Permissions (admin only)
857
-
858
- Role-based access control. Activate via search_tools("permissions").
859
-
860
- - list_members — all workspace users with roles. Returns { items:[{userId,email,name,username,role,roleId,roleName,lastSeenAt}], total }; lastSeenAt is the member's last visit to this workspace (null if never). It is throttled to 5-minute granularity, so treat it as "last seen within ~5 min", not an exact timestamp
861
- - list_roles — all roles and their access levels per table
862
- - get_user_permissions(username or userId) — what a specific user can access
863
- - set_grant(roleId or username, targetTypeId, level) — level: NONE/READ/WRITE/ADMIN; NONE = deny row that overrides the role grant; revoking a grant is remove_grant. targetTypeId=0 = all tables.
864
- Optional: canExport (allow CSV export), canDelete (allow record deletion)
865
- - remove_grant — revoke access
866
-
867
- ## Graph (PostgreSQL)
868
-
869
- Knowledge graph of relationships between records stored in PostgreSQL. Activate via search_tools("graph").
870
-
871
- - get_related(objId, relType, depth) — find connected records up to depth 1-3
872
- - get_graph_node(objId) — get a single graph node: type, name, edges
873
- - get_graph_neighborhood(objId, direction, limit) — get neighbors (1-hop): edges and connected nodes
874
- - list_graph_nodes(typeId, withEdges, limit, skip) — list graph nodes by table type
875
- - get_shortest_path(fromObjId, toObjId, maxHops) — shortest path between two objects
876
- - graph_query(cypher) — read-only SQL query against graph_objects/graph_edges tables. Only SELECT/WITH. Use $1 for workspace db.
877
- - graph_health() — check graph subsystem health: node count, edge count, connection status
878
- - list_memory_agents() — list agents that store data in graph memory
879
- - browse_graph_memory(agentId) — browse an agent's memory graph: nodes, edges, keys
880
-
881
- ## Lookups
882
-
883
- Dropdown/reference value discovery. Activate via search_tools("lookups").
884
- - get_lookup(typeId, search?, limit?) — get all values from a lookup table (dropdown source). Returns records with id and display name.
885
- - get_ref_options(refId, search?, limit?) — get valid options for a specific reference column by reqId. Use before creating/updating objects to discover allowed values for ref fields.
886
-
887
- ## Webhooks
888
-
889
- HTTP callbacks on events. Activate via search_tools("webhooks").
890
- create_webhook(typeId, events: ["create","update","delete"], url, secret)
891
- - get_webhook_deliveries(webhookId, limit) — delivery history (status, response code, errors)
892
- - retry_webhook_delivery(deliveryId) — retry a failed delivery
893
-
894
- ## Forms
895
-
896
- Public data collection forms linked to a table. Activate via search_tools("forms").
897
- create_form(typeId, config, expiresAt) — generates a public URL for external users to submit records.
898
-
899
- ## Bulk operations
900
-
901
- Activate via search_tools("bulk").
902
- - bulk_create(typeId, rows, parentId?) — create many records at once
903
- - bulk_update(updates: [{ objId, fields }]) — update many records
904
- - bulk_delete(objIds) — delete many records (requires confirmation)
905
- - autofill_batch(typeId, reqId, objectIds) — run AI autofill on multiple rows
906
-
907
- ## Import / Export
908
-
909
- Activate via search_tools("файл import export download").
910
- - import_data(typeId, csv, mapping) — import CSV string into table. Auto-maps columns by header names. mapping override: { columnIndex: "colId" | "__val__" | "__skip__" }
911
- - export_data(typeId, limit, filters) — export table to CSV format
912
- - download_file(fileName, subdir?) — download a file from workspace storage. Returns base64 content (max 10 MB).
913
-
914
- ## Dashboards
915
-
916
- Visual dashboards with widgets. Activate via search_tools("dashboard widgets").
917
- - list_dashboards, get_dashboard(id), create_dashboard(title, widgets, layouts?), update_dashboard, delete_dashboard
918
-
919
- ## Workspace invitations
920
-
921
- Activate via search_tools("workspace").
922
- - list_workspace_invitations — pending invitations (email, role, status)
923
- - cancel_workspace_invitation(invitationId) — cancel an invitation (requires confirmation)
924
-
925
- ## Sharing
926
-
927
- Public links for views and records. Activate via search_tools("workspace share record view link").
928
- - share_view(viewId, typeId, expiresInDays, password) → returns share token/URL
929
- - share_record(objId, typeId, expiresInDays) → returns share token/URL
930
- - revoke_view_share, revoke_record_share — disable public links
931
-
932
- ## Connectors
933
-
934
- External data integrations. Activate via search_tools("workspace connectors"); narrow it: search_tools("workspace api docs fetch") for the AI setup workflow, search_tools("workspace connector test draft schema") for testing and schema generation, search_tools("workspace connectors cdek reconcile") for CDEK reconciliation, search_tools("delete connector") to remove one.
935
- - list_connectors, get_connector, create_connector, update_connector, delete_connector, run_connector, reconcile_cdek
936
- - list_connector_presets — available presets (1C, SAP, SCADA, REST templates)
937
- - AI-assisted connector setup workflow:
938
- 1. fetch_api_docs(url) — load API docs (OpenAPI/Swagger/HTML)
939
- 2. generate_connector_config(apiStructure, description) — LLM generates connector config
940
- 3. test_connector_draft(config, params) — test real HTTP request (requires confirmation)
941
- 4. generate_connector_schema(config, sampleResponse) — generate table schema from response (requires confirmation)
942
- 5. create_connector(...) — save the connector
943
-
944
- ## Comments & reactions
945
-
946
- Activate via search_tools("comments").
947
- - list_comments(objId), create_comment(objId, body, parentCommentId?), update_comment, delete_comment
948
- - add_reaction(commentId, emoji), remove_reaction
949
-
950
- ## History & rollback
951
-
952
- Activate via search_tools("history"); backlinks live in the objects group: search_tools("history objects backlinks").
953
- - get_object_history(objId) — full change log for a record
954
- - rollback_object(objId, auditId) — restore record to state before a specific audit entry (requires confirmation)
955
- - get_object_backlinks(objectId, limit, offset) — find all records that reference this object via ref columns or mentions
956
-
957
- ## Audit log (admin)
958
-
959
- query_audit(type?, actor?, dateFrom?, dateTo?, action?, objectId?, typeId?, reportId?, limit?, offset?) — unified audit log across objects, schema, and reports. type: all|objects|schema|reports (default all). actor filters by username; dateFrom/dateTo are ISO timestamps. objectId narrows type=objects, typeId narrows type=schema, reportId narrows type=reports.
960
-
961
- ## Notifications
962
-
963
- - list_notifications, mark_read(notifId), send_notification(targetUsername, title, body), delete_notification(notifId)
964
- - get_notification_count() — number of unread notifications for current user
965
- - get_unread_across_workspaces() — unread counts across all user's workspaces
966
- - notification_action(notifId, actionKey) — execute action on a notification (e.g. approve/reject a suspended automation). Requires confirmation.
967
- - On startup the server may append an unread-notifications summary to the first tool response — surface it to the user once, then drop it.
968
-
969
- ## Workspace admin
970
-
971
- Read-only workspace metadata available without search_tools activation.
972
- - get_workspace() — current workspace: name, slug, plan, settings (admin only)
973
- - get_template(templateId) — template details: slug, name, description, schema
974
-
975
- ## Trash
976
-
977
- - list_trash(typeId) — see deleted records for a specific table
978
- - restore_from_trash(objectId) — restore a deleted record
979
-
980
- ## Memory (agent long-term memory)
981
-
982
- Activate via search_tools("memory").
983
- - remember(key, value, tags) — save a fact for future conversations
984
- - recall(question) — retrieve relevant memories
985
- - forget(key) — delete a memory
986
- - share_insight(key, value) — share with other agents in shared namespace
987
- - find_procedure(query) — find step-by-step recipes from memory
988
- - list_contradictions / resolve_contradiction — manage conflicting facts
989
- - Правила и топ-факты воркспейса сервер сам приписывает к первому ответу (recall для этого не зови); правила воркспейса пиши через add_rule (без scope) — их подхватывает каждый внутренний агент. scope=instance — только admin, факты/указатели для всех воркспейсов инстанса.
990
-
991
- ## Portal (admin)
992
-
993
- Client-facing portal management. Activate via search_tools("portal"); for @kit blocks use search_tools("portal kit components"), for Telegram chat admin search_tools("portal telegram member join invite") and search_tools("portal telegram pin"), for stories and the business API search_tools("portal telegram story business").
994
-
995
- **Configuration:**
996
- - get_portal_config() — current portal config (branding, pages, modules, auth, chat, SEO)
997
- - portal_preview() — get preview URL
998
- - portal_publish(active) — publish (true) or unpublish (false). **Requires confirmation.**
999
-
1000
- **Data (admin read access, no client filter):**
1001
- - get_portal_catalog(category, limit, offset) — products: price, photo, category, stock status
1002
- - get_portal_carts(limit, offset) — active client carts: item count, total
1003
- - get_portal_orders(status, limit, offset) — orders with status filter
1004
- - get_portal_tickets(status, limit, offset) — support tickets with status filter
1005
- - get_portal_kb_articles(category, limit, offset) — KB articles: category, date, excerpt
1006
- - get_portal_metrics() — order counts by status + total revenue
1007
- - get_portal_documents(limit, offset) — client documents
1008
-
1009
- **Clients:**
1010
- - get_portal_profile(email, phone, customerId) — find customer by email/phone/ID
1011
- - get_portal_client_role(customerId) — role, grants, allowed pages
1012
-
1013
- **Custom Code:**
1014
- - Before writing data reading or the markup of a portal section, call kit_list_components — the @kit library already has reading with a completeness proof, EAV value recovery and the three absence states. Don't reinvent them.
1015
- - kit_list_components(version?, kind?, search?) — catalog of @kit building blocks: name, kind, one-line summary, module. Generated from the library sources at build time, so it cannot drift from the code. An empty list means an empty filter; a missing catalog comes back as a refusal (KIT_NOT_DEPLOYED / KIT_VERSION_NOT_FOUND / KIT_CATALOG_MISSING / KIT_CATALOG_BROKEN). KIT_NOT_DEPLOYED means the server has no KIT_ASSETS_DIR root or no catalog versions — kit.js itself may still be served by nginx; the fix is deploying the manifest, not moving artifacts.
1016
- - kit_get_component(name, version?) — one entry in detail: module, kind, summary, props, slots and uiKeys for components. Unknown name → refusal listing similar names.
1017
- - Styling a @kit widget: never invent class names or token names. Node classes go in through the \`ui\` prop — a map of node key to your classes, e.g. \`<DataTable :ui="{ row: 'my-row' }" />\`; the keys are \`uiKeys\` from kit_get_component, your classes are APPENDED to the widget's own, and a key outside that list does not exist (the widget refuses it and warns in the console). Token names come from kit_get_tokens. A widget with no uiKeys field takes no \`ui\` prop at all — either it is headless, or the deployed version predates the prop.
1018
- - kit_get_tokens(version?, kind?, component?) — the styling contract: every CSS variable the @kit widgets read (colour, spacing, radius, font, motion) plus the stable class names of each widget. Call it BEFORE writing any style for a @kit widget. A name that is not in this dictionary does not exist: it resolves to nothing, and the section comes out structurally correct, with correct ARIA, and completely unstyled — behavioural tests will not catch it, only looking at the rendered page will. Never invent a token name, never guess a prefix. Each token ships a ready \`usage\` string, e.g. \`var(--kit-color-text, var(--color-text, #1f2328))\` — write it whole, fallback included, because the middle link is the portal shell's own token and that is what makes the widget inherit the portal theme. Refusals: KIT_TOKENS_MISSING (versions up to 0.4.0 carry no dictionary), KIT_NO_STYLING (headless widget, nothing to style).
1019
- - The \`classes\` field of that answer is a contract too: those class names are safe to hook your own styles and animations onto. Everything else inside a widget is behind scoped styles and may change.
1020
- - kit_list_versions() — which versions of @kit are deployed, plus \`latest\`. Ordering is numeric, so 0.1.10 is newer than 0.1.2.
1021
- - The version a portal uses is set by the \`kit\` field in the custom_code module config, not in component code. Omit \`version\` and the catalog answers for the latest deployed one.
1022
- - Reading rule: never build a portal API URL by hand. \`readAll(source, {db})\` takes \`type:id\` — the registry knows the path, the page ceiling and how that route proves the end of data. Seven incompatible pagination contracts exist across portal routes; the library hides all of them behind one answer \`{items, total, complete, reason}\`.
1023
- - \`total\` may be \`null\` — most routes never state a grand total. Print "N of M" only when \`total\` is a number, and raise the alarm on \`complete === false\`, not on a non-empty \`reason\`: reason is also filled on healthy reads.
1024
- - \`doc\` and \`record\` are single entities, not lists — read them with \`fetchOne\`, and note \`record\` is keyed by slug, not by a number.
1025
- - Widgets take ready data, not ids: \`DataTable\` gets \`rows\`, and \`Source\` (or \`fetchOne\`) does the reading. \`AiPanel\` is the exception — it owns its own SSE stream against /agent/run.
1026
- - commit_portal_component(repo, file, code, message?, branch?) — commit Vue SFC to codespace repo for custom_code module. Repo is auto-created if it doesn't exist.
1027
-
1028
- **Telegram Bots:**
1029
- - list_telegram_bots() — list all Telegram bots for the workspace
1030
- - create_telegram_bot(name, username, token, config?) — create bot + auto-register webhook. **Requires confirmation.**
1031
- - update_telegram_bot(id, ...) — update bot (name, username, token, enabled, config). config is replaced wholesale (no merge) — pass the full config. Token change re-registers webhook. **Requires confirmation.**
1032
- - delete_telegram_bot(id) — permanently delete bot. **Requires HITL confirmation.**
1033
- - sync_telegram_bot(id) — sync config → Telegram API (commands menu, description, short description, menu button). **Requires confirmation.**
1034
- - get_telegram_bot_status(id) — get bot info (getMe) + webhook status (getWebhookInfo). Read-only.
1035
- - test_telegram_bot(id, chatId, text) — send test message from bot to a chat. **Requires confirmation.**
1036
-
1037
- **Telegram Messaging:**
1038
- - telegram_forward_message(botId, fromChatId, toChatId, messageId, copy?) — forward or copy a message. copy=true removes "Forwarded from". **Requires confirmation.**
1039
-
1040
- **Telegram Payments:**
1041
- - telegram_send_invoice(botId, chatId, title, description, payload?, currency?, prices?, providerToken?, photoUrl?) — send payment invoice. currency "XTR" for Telegram Stars. **Requires confirmation.**
1042
- - telegram_create_invoice_link(botId, title, description, payload?, currency?, prices?, providerToken?) — create payment URL (no chat needed). Returns { url }.
1043
-
1044
- **Telegram Chat Admin:**
1045
- - telegram_ban_member(botId, chatId, userId, untilDate?, revokeMessages?) — ban user. **Requires confirmation.**
1046
- - telegram_unban_member(botId, chatId, userId) — unban user. **Requires confirmation.**
1047
- - telegram_restrict_member(botId, chatId, userId, permissions?, untilDate?) — restrict user permissions. **Requires confirmation.**
1048
- - telegram_promote_member(botId, chatId, userId, canManageChat?, canDeleteMessages?, ...) — promote/demote to admin. **Requires confirmation.**
1049
- - telegram_approve_join(botId, chatId, userId) — approve pending join request. **Requires confirmation.**
1050
- - telegram_decline_join(botId, chatId, userId) — decline pending join request. **Requires confirmation.**
1051
- - telegram_pin_message(botId, chatId, messageId, disableNotification?) — pin a message. **Requires confirmation.**
1052
- - telegram_unpin_message(botId, chatId, messageId?) — unpin one or all messages. **Requires confirmation.**
1053
- - telegram_get_chat(botId, chatId) — get chat info (title, type, members). Read-only.
1054
- - telegram_get_chat_member_count(botId, chatId) — get member count. Read-only.
1055
- - telegram_create_invite_link(botId, chatId, name?, expireDate?, memberLimit?, createsJoinRequest?) — create invite link.
1056
-
1057
- **Telegram Stories:**
1058
- - telegram_post_story(botId, chatId, content, caption?, activePeriod?) — publish story. content: {type:"photo"|"video", photo/video: "URL"}. **Requires confirmation.**
1059
- - telegram_edit_story(botId, chatId, storyId, content?, caption?) — edit story. **Requires confirmation.**
1060
- - telegram_delete_story(botId, chatId, storyId) — delete story. **Requires confirmation.**
1061
-
1062
- **Telegram Business API:**
1063
- - telegram_get_business_connection(botId, businessConnectionId) — get business connection info. Read-only.
1064
- - telegram_set_business_bio(botId, businessConnectionId, bio) — set bio (0-140 chars). **Requires confirmation.**
1065
- - telegram_set_business_name(botId, businessConnectionId, firstName, lastName?) — set account name. **Requires confirmation.**
1066
-
1067
- Bot config schema: { description?: "...", shortDescription?: "...", welcomeMessage?: "...", menuButton?: {type: "commands"|"web_app"|"default"}, employeeTable?: {typeId, chatIdReqId, roleReqId, emailReqId?} }.
1068
- config.builtinsDisabled: true — клиентский бот без встроенных обработчиков (только welcomeMessage, правила, платежи); в области с ботом сотрудников (employeeTable) новый бот обязан быть клиентским или нести свою employeeTable.
1069
- Bot reactions (commands + keywords) are stored as **automations** with trigger.botId — use create_automation with:
1070
- - Command: trigger: { type: "on_telegram_command", command: "status", botId: N }
1071
- - Keyword: trigger: { type: "on_telegram_message", pattern: "привет,hello", matchMode: "contains", botId: N }
1072
- - Intake (every message, incl. media): trigger: { type: "on_telegram_message", botId: N } — no pattern. Optional messageTypes: ["voice","document"]. Runs alongside keyword rules; template vars _message, _message_type, _from_user_id, _message_id, _date, _file_id, _file_name
1073
- - Payment: trigger: { type: "on_telegram_payment", botId: N } — fires on successful payment
1074
- - Pre-checkout: trigger: { type: "on_telegram_pre_checkout", botId: N } — validate before charging
1075
- - Shipping: trigger: { type: "on_telegram_shipping", botId: N } — provide shipping options
1076
- - Inline query: trigger: { type: "on_telegram_inline", botId: N } — respond to @bot queries
1077
- - Join request: trigger: { type: "on_telegram_join_request", botId: N, chatId? } — auto-approve/decline
1078
- - Business connection: trigger: { type: "on_telegram_business_connection", botId: N }
1079
- - Business message: trigger: { type: "on_telegram_business_message", botId: N }
1080
- Actions use telegram_send_message with chatId: "{{_tgChatId}}" to reply to sender.
1081
- Template vars: {{_tgCommand}}, {{_tgArgs}}, {{_tgChatId}}, {{_tgFromUsername}}, {{_tgFromFirstName}}, {{_tgMessage}}.
1082
- Payment vars: {{_tgPaymentCurrency}}, {{_tgPaymentAmount}}, {{_tgPaymentPayload}}, {{_tgPaymentChargeId}}.
1083
- Inline vars: {{_tgInlineQuery}}, {{_tgInlineQueryId}}, {{_tgInlineOffset}}.
1084
- Join vars: {{_tgJoinUserId}}, {{_tgJoinUsername}}, {{_tgJoinFirstName}}, {{_tgJoinBio}}.
1085
- Business vars: {{_tgBusinessConnectionId}}, {{_tgBusinessUserId}}, {{_tgBusinessChatId}}, {{_tgBusinessCanReply}}.
1086
- Filter automations by bot: list_automations with filter by trigger.botId (GET /automations?botId=N).
1087
-
1088
- **Multi-screen keyboards (screens):** telegram_send_message supports hierarchical navigation via \`screens\`:
1089
- \`\`\`
1090
- { screens: {
1091
- main: { text: "Menu", buttons: [{ text: "Orders", go: "orders" }] },
1092
- orders: {
1093
- text: "Orders (page {{_page}})",
1094
- listSource: { queryMode: "table", typeId: 311, pageSize: 6, filterReqId: 378 },
1095
- listButton: { text: "Order #{{name}}", go: "detail" },
1096
- buttons: [
1097
- { text: "New", go: "orders", goFilter: "391" },
1098
- { text: "All", go: "orders" },
1099
- { text: "Back", go: "_back" }
1100
- ]
1101
- },
1102
- detail: {
1103
- text: "Order #{{val}}\\nStatus: {{req_378}}\\nSum: {{req_340}}",
1104
- buttons: [{ text: "Back", go: "_back" }]
1105
- }
1106
- }}
1107
- \`\`\`
1108
- - go: "screenId" — navigate forward; go: "_back" — linear back (preserves page+filter); goBackTo: "screenId" — named back (jumps to specific screen, clears stack above)
1109
- - goFilter: "value" — apply filter to listSource (e.g., status ID)
1110
- - listSource: dynamic paginated list. queryMode: "table" (root records) | "children". pageSize (default 8). filterReqId — EAV field for goFilter.
1111
- - listButton.go — detail screen on item click. Detail screen gets {{id}}, {{val}}, {{req_NNN}} from the object's EAV data.
1112
- - {{_breadcrumb}} — breadcrumb trail built from nav stack: «Меню > Заказы > №6278886»
1113
- - Navigation stack in Redis (1h TTL) stores {automationId, screenId, page, filterValue}. _back restores full context.
1114
- - botId (preferred over botToken) — resolves token from _v2_tg_bots table.
1115
-
1116
- Portal data comes from workspace EAV tables. Portal config maps page types to EAV typeId/reqId references.
1117
-
1118
- ## Codespace (git repositories)
1119
-
1120
- Git repository hosting per workspace. Activate via search_tools("codespace").
1121
-
1122
- **Repositories:**
1123
- - list_repos() — list all git repos in workspace
1124
- - get_repo(slug) — repo info (branches, size, last commit)
1125
-
1126
- **Branches:**
1127
- - list_branches(slug) — list branches
1128
- - create_branch(slug, name, fromRef?) — create branch from ref/HEAD
1129
- - delete_branch(slug, name) — delete branch (cannot delete default branch). **TIER_HIGH**
1130
-
1131
- **Commits & files:**
1132
- - list_commits(slug, ref?, limit?, offset?) — list commits on a branch
1133
- - get_commit_diff(slug, sha) — unified diff for a single commit (works for initial commit)
1134
- - search_code(slug, query, ref?, path?, isRegex?, caseSensitive?, limit?) — git grep across repo contents. Search FIRST before reading whole files. Returns { hits: [{ path, line, text }], total, truncated }
1135
- - get_file_tree(slug, ref?, path?) — list files/dirs in a repo. Returns { items: [{ name, type, size, path }], ref, path }
1136
- - read_blob(slug, path, ref?, offset?, limit?) — прочитать файл. Возвращает baseCommit — состояние ветки на момент чтения. Если baseCommit пришёл null, файл прочитан не целиком: перечитайте без offset/limit, прежде чем писать.
1137
- - patch_file(slug, branch, filePath, oldStr, newStr, message?, baseCommit?) — ПРЕДПОЧТИТЕЛЬНЫЙ способ править существующий файл. Заменяет уникальный кусок текста, файл целиком слать не нужно. oldStr должен встречаться ровно один раз.
1138
- - commit_file(slug, branch, filePath, content, message?, baseCommit?) — записать файл целиком. Для новых и коротких файлов; для правки существующих используйте patch_file.
1139
- - commit_multi_files(slug, branch, files, message, baseCommit?) — несколько файлов одним коммитом.
1140
- - delete_repo_file(slug, branch, filePath, message?, baseCommit?) — удалить файл (git rm + commit). **TIER_HIGH**
1141
-
1142
- Запись ведёт себя как git: коммит создаётся на указанном baseCommit, ветка двигается только если не ушла вперёд, иначе выполняется слияние. Всегда передавайте baseCommit при правке существующего — иначе рискуете затереть чужую работу.
1143
-
1144
- Разрешение конфликта. Ответ MERGE_CONFLICT содержит всё нужное, перечитывать файл не надо:
1145
- - details.conflicts — список конфликтующих файлов;
1146
- - details.blocks — их содержимое с конфликтными блоками. В блоке три части: ваша версия, исходная (между строками ||||||| и =======), версия ветки. Сравнивайте с исходной — она показывает, что именно меняла каждая сторона;
1147
- - details.baseCommit — состояние, на которое надо писать разрешение;
1148
- - details.retryable=false — повторять ту же запись бессмысленно, ответ будет тот же.
1149
-
1150
- Порядок разрешения — выполняйте именно так, не сокращая:
1151
- 1. Для каждого конфликтного блока выпишите ДВА изменения относительно исходной части: что сделала ваша сторона и что сделала сторона ветки.
1152
- 2. Сформулируйте намерение каждой стороны. Удаление строки — тоже намерение: если исходная часть содержит строку, которой нет в одной из версий, эту строку намеренно удалили, и в итог её возвращать нельзя.
1153
- 3. Соедините оба намерения. Механическое склеивание обеих половин — типичная ошибка: так в итог попадает то, что одна из сторон осознанно убрала.
1154
- 4. Соберите итоговый текст без маркеров конфликта и запишите через commit_file с baseCommit из details.
1155
-
1156
- При WRITE_CONTENTION (retryable=true) — наоборот, ничего разбирать не надо, достаточно повторить запись.
1157
-
1158
- **Pull Requests:**
1159
- - list_prs(slug, status?, limit?, offset?) — list PRs (status: open|closed|merged|draft)
1160
- - get_pr(slug, number) — PR details
1161
- - create_pr(slug, title, sourceBranch, targetBranch, description?, mergeStrategy?) — create PR
1162
- - update_pr(slug, number, title?, description?, status?, mergeStrategy?) — update PR; pass status="open" to reopen
1163
- - merge_pr(slug, number, strategy?, allowKnownLoss?) — merge PR into target branch; rejected 409 MERGE_WOULD_REVERT when it erases recent target-branch edits (allowKnownLoss confirms intentional removal). **TIER_HIGH**
1164
- - list_pr_comments(slug, number) — list PR comments
1165
- - add_pr_comment(slug, number, body) — add comment to PR
1166
-
1167
- **GitHub Sync:**
1168
- - get_github_sync(slug) — get GitHub Sync config (remoteUrl, direction, lastSync, lastError)
1169
- - configure_github_sync(slug, remoteUrl, token, direction, autoSync?) — set up sync; direction: push_only | pull_only | both. **TIER_HIGH**
1170
- - push_to_github(slug) — manually push all branches to GitHub
1171
- - pull_from_github(slug) — manually pull all branches from GitHub
1172
-
1173
- ## Advisor (platform expert)
1174
-
1175
- Platform expert for guidance and help. docs_map and docs_search are core — active from the start. The rest: search_tools("advisor"), also reachable by "документация", "справка", "инструкция", "help", "guide".
1176
-
1177
- - ask_advisor(question, topic?) — ask about schema design, best practices, troubleshooting, feature usage. Grounded in the platform docs corpus + current workspace schema. topic: schema/reports/automations/portal/documents/permissions/import/dashboards/integrations/general
1178
- - list_platform_capabilities() — full list of Integram features by category (data, columns, analytics, automations, documents, integrations, security, portal, AI, graph)
1179
- - docs_map(area?, module?, query?) — map of the platform docs corpus: what documents exist, what each is about, when it last changed. Start here.
1180
- - docs_search(query, area?, limit?) — hybrid search over doc fragments; returns citations (path#section). Empty result means "not in what was retrieved", NOT "not in the platform"
1181
- - docs_read(path, section?, offset?, maxChars?) — read a doc or one section in full; paginated via nextOffset
1182
- - docs_tool(name? | query? | group?) — card for a platform tool: purpose, params, risk tier. Read live from the tool catalog, so counts and names always match the code
1183
-
1184
- Use advisor when user asks "help", "how to", "what can you do", "best practice", or needs guidance on platform features.
1185
- Never state a capability, count, or setting you did not confirm via docs_* — say "not covered in the docs" instead.
1186
-
1187
- ## Teamchat (internal messaging)
1188
-
1189
- Internal messaging with rooms, topics, and decisions. Activate via search_tools("teamchat"); narrow it: search_tools("teamchat room member"), search_tools("teamchat room delete"), search_tools("teamchat topic read export"), search_tools("teamchat messages").
1190
-
1191
- **Rooms:**
1192
- - list_rooms() — list chat rooms the user has access to
1193
- - create_room(name, isPublic?) — create a new room
1194
- - get_room(roomId) — room details
1195
- - update_room(roomId, name?) — rename a room (name is the only editable field)
1196
- - delete_room(roomId) — delete room. **Requires confirmation.**
1197
- - join_room(roomId) — join a public room
1198
-
1199
- **Room members:**
1200
- - list_room_members(roomId) — list members
1201
- - add_room_member(roomId, userId) — add a member
1202
- - remove_room_member(roomId, userId) — remove a member
1203
-
1204
- **Topics:**
1205
- - list_topics(search?, limit?) — list topics across ALL rooms the user is a member of; there is no per-room filter
1206
- - list_recent_topics(limit?) — recently active topics
1207
- - create_topic(roomId, title, first_message?) — create a topic in a room; first_message posts an opening message
1208
- - update_topic(topicId, name?, status?, pinned?, assigned_to?, priority?, deadline_at?) — update topic. The title is called \`name\` here, not \`title\` as in create_topic.
1209
- - delete_topic(topicId) — delete topic. **Requires confirmation.**
1210
- - summarize_topic(topicId) — AI-generated summary of topic discussion
1211
- - mark_topic_read(topicId) — mark topic as read
1212
- - export_topic_to_document(topicId) — export topic content to a document
1213
-
1214
- **Messages:**
1215
- - list_messages(topicId, limit?, cursor?) — list messages in a topic
1216
- - create_message(topicId, text) — post a message
1217
- - send_teamchat_message(topicId, text, cards?) — post a message with optional code_cell cards for executable code
1218
- - update_message(msgId, text) — edit a message
1219
- - delete_message(msgId) — delete a message. **Requires confirmation.**
1220
- - move_message(msgId, targetTopicId) — move a message to another topic
1221
- - search_teamchat(query, room_id?, limit?, task_only?) — full-text search across messages; task_only narrows to task-flagged messages
1222
-
1223
- **Decisions:**
1224
- - create_decision(title, description?, domain?) — create an architectural decision record
1225
- - get_decision(id) — get decision details
1226
- - update_decision(id, title?, description?, domain?, verdict?, impact?) — update a decision. There is no \`status\` field: the lifecycle field is \`verdict\` (proposed | accepted | rejected | superseded | draft). \`impact\`: critical | high | medium | low. When the caller is an agent account (username starting with \`agent:\`), changing \`verdict\` is not applied immediately — the call returns \`status: "approval_requested"\` and waits for a human.
1227
- - delete_decision(id) — delete a decision. **Requires confirmation.**
1228
- - search_similar_decisions(query, domain?, limit?) — semantic search for similar decisions
1229
- - analyze_decision_conflicts(decisionId) — find conflicts with other decisions
1230
- - list_decision_links(id) — list links to/from a decision
1231
- - create_decision_link(id, targetId, type) — link two decisions. \`id\` is the SOURCE decision (the "from" side), \`targetId\` is the destination — the link reads id → targetId. type: supersedes|depends_on|related_to|conflicts_with
1232
- - delete_decision_link(linkId) — remove a link
1233
-
1234
- **Analytics:**
1235
- - get_agent_metrics(agentId?) — AI agent usage metrics
1236
- - get_wmatrix(room_id?, days?) — W-matrix (Organizational Network Analysis) for collaboration patterns
1237
-
1238
- ## Organizations
1239
-
1240
- Multi-workspace organizations. Activate via search_tools("orgs").
1241
- Organizations are addressed by \`slug\`, never by a numeric id.
1242
-
1243
- - list_orgs() — list organizations the user belongs to
1244
- - get_org(slug) — organization details
1245
- - create_org(name, slug) — create a new organization. **Requires confirmation.**
1246
- - update_org(slug, name?) — update organization. **Requires confirmation.**
1247
- - delete_org(slug) — delete organization. **Requires confirmation.**
1248
- - list_org_members(slug, page?, pageSize?) — list members of an organization, one page at a time (default 50). Compare items length with total and ask for the next page.
1249
- - list_org_team(slug) — team of the organization: everyone who inherits membership from its workspaces, with their org roles (должности).
1250
- - set_org_member_role(slug, userId, role) — assign org role (admin|editor|viewer) to a team member, or pass "none" to clear it. Only the org owner can do this; the user must be a member of at least one org workspace. **Requires confirmation.**
1251
- - add_org_member(slug, email, role?) — add member by e-mail. **Requires confirmation.**
1252
- - remove_org_member(slug, memberId) — remove member by membership id (from list_org_members). **Requires confirmation.**
1253
- - transfer_org_ownership(slug, userId) — hand ownership to another member; \`userId\` is the member's user id, not the membership id. The former owner stays an admin. **Requires confirmation.**
1254
- - leave_org(slug) — leave the organization yourself. An owner must transfer ownership first; the last admin must promote a successor first. **Requires confirmation.**
1255
- - invite_to_org(slug, email, role) — invite by e-mail (role: admin, editor or viewer; default viewer). Works for people without an account; the invitation lives 7 days. **Requires confirmation.**
1256
- - revoke_org_invitation(slug, invitationId) — revoke a pending invitation (id from list_org_invitations).
1257
- - list_org_invitations(slug) — invitations of the organization: pending, accepted and revoked.
1258
-
1259
- ## Timeseries
1260
-
1261
- Time-series data ingestion and aggregated queries. Activate via search_tools("timeseries").
1262
-
1263
- - record_timeseries(source_id, metric, value?, text_val?, ts?) — record one data point. \`value\` is numeric, \`text_val\` is its textual alternative — one of the two is required. \`ts\` is an ISO timestamp (defaults to now). There is no \`tags\` field.
1264
- - record_timeseries(points) — batch form: points is an array of { source_id, metric, value?, text_val?, ts? }. Every point needs its own source_id and metric.
1265
- - query_timeseries(source_id, metric, from?, to?, bucket?, agg?, limit?) — query aggregated data. source_id and metric are REQUIRED. from/to are ISO timestamps. agg: avg|sum|min|max|count (default avg). bucket: 1m|5m|15m|30m|1h|6h|1d|7d|30d (default 1h) — any other value is rejected.
1266
- - list_timeseries_sources() — list available data sources and their metrics
1267
-
1268
- ## KAG (Knowledge-Augmented Generation)
1269
-
1270
- Knowledge graph search, question answering, and population. Activate via search_tools("kag").
1271
-
1272
- **Read:**
1273
- - kag_search(query, limit?) — search entities in the knowledge graph by text
1274
- - kag_traverse(entityId, depth?, relType?) — traverse graph from an entity, discover related nodes
1275
- - kag_ask(question) — answer a natural language question using knowledge graph context. Auto-searches relevant entities and synthesizes an answer.
1276
- - kag_stats() — get entity/class/relation counts
1277
- - kag_browse(entityType?, source?, limit?, offset?) — browse entities with filters, returns available entity types
1278
- - kag_clusters() — degree-centrality clustering grouped by entity type
1279
- - kag_anomalies() — detect hub nodes (overly connected) and isolated entities (no relations)
1280
-
1281
- **Write:**
1282
- - kag_import_entities(entities, source?, version?) — import entities into the knowledge graph (max 100 per call). Each entity: {id?, name, entityType, observations?, properties?}. Embeddings generated automatically.
1283
- - kag_import_relations(relations, source?, version?) — import typed relations (max 200 per call). Each relation: {sourceId, targetId, type, properties?}. Types: USES, REPLACES, CONFLICTS, PART_OF, DEPENDS_ON, RELATED_TO, IMPLEMENTS, COMPARED_TO.
1284
- - kag_import_ontology(classes, source?, version?) — import ontology classes (max 200 per call). Each class: {id, name, description?, parentClassId?}.
1285
- - kag_update_tags(entityId, tags) — update access tags on an entity
1286
- - kag_delete(source?) — delete KAG data by source (or ALL if no source). ⚠️ Irreversible.
1287
-
1288
- ## Objects (advanced operations)
1289
-
1290
- Move, reorder, and duplicate records. Activate via search_tools("objects").
1291
-
1292
- - move_object(objectId, parentId) — move a record to a different parent (change parentId)
1293
- - reorder_object(objectId, order, afterId?) — change record position (ord) within its parent
1294
- - duplicate_object(objectId) — create a copy of a record with all its field values
1295
-
1296
- ## AI (Text-to-Speech)
1297
-
1298
- Text-to-speech synthesis. Activate via search_tools("ai").
1299
-
1300
- - speak_text(text, voice?, speed?) — synthesize speech from text. Returns audio file URL.
1301
- - list_tts_voices() — list available TTS voices with language and gender info
1302
- - get_tts_status() — check TTS service availability
1303
-
1304
- ## Excel export
1305
-
1306
- Create Excel files from raw data. Available via search_tools("workspace excel xlsx").
1307
-
1308
- - create_excel(title?, sheets) — create an XLSX file from raw data. sheets: [{ name, headers: ["Col1","Col2"], rows: [["val1","val2"]] }]. File is saved to workspace storage. Returns download link.
1309
-
1310
- ## External agents
1311
-
1312
- Delegate tasks to registered external agents. Activate via search_tools("agents").
1313
- - list_agents — discover available registry agents (external and internal) and their capabilities
1314
- - delegate_to_agent(agentSlug, task, context) — delegate a task to a registry agent by slug: external via callback URL, internal (workspace-defined) via the shared agent executor (its prompt and tools); returns the result
1315
-
1316
- ## Meta KB mode
1317
-
1318
- POST /ai/agent-chat accepts optional agentSlug and topicId params:
1319
- - agentSlug: 'teamchat-agent' — bypasses orchestrator, calls teamchat-agent directly
1320
- - topicId: number — for multi-turn conversation in teamchat topic
1321
- When agentSlug is set, Q&A is saved to teamchat room 'meta-kb' instead of _v2_ai_conversations.
1322
-
1323
- ---
1324
-
1325
- ## Anti-hallucination rules
1326
- - NEVER state record counts, specific values, or data without calling a tool first.
1327
- - Any question like "how many records", "what's in the table", "show records" MUST call list_objects.
1328
- - If unsure about data — always call a tool, never guess.
1329
-
1330
- ## Confirmation flow
1331
- Destructive and schema operations return "REQUIRES CONFIRMATION". Ask the user to confirm, then call confirm_action(approved=true/false). Never auto-confirm without explicit user approval.
1332
-
1333
- ## Reporting platform issues
1334
- - report_platform_issue(toolName, title, whatHappened, errorCode?, errorMessage?, category?, severity?, mcpVersion?) — отправить отчёт о проблеме платформы мейнтейнеру. ЗОВИ ЕГО: (1) после необъяснимого отказа инструмента — отказ не по правам/данным, а похожий на поломку (500, INTERNAL, противоречивый ответ); (2) когда несколько попыток подряд не приводят к цели и причина непонятна; (3) когда сам понял, что сделал не то, чего хотел пользователь, и это следствие ограничения платформы, а не твоей ошибки; (4) когда пользователь просит сообщить о проблеме. НЕ зови при обычных отказах прав (FORBIDDEN, NO_READ_ACCESS) — это законные ответы, не баги. Категория: bug — платформа сломалась; missing_capability — нужной возможности нет; docs — документация неясна или неверна; ux — работает, но против всякого здравого смысла. Перед вызовом составь черновик из контекста (что было целью, что делал, сколько попыток, что ответил сервер) и покажи пользователю. Секреты в поля не писать — сервер дополнительно санитизирует. Ответ содержит номер issue — назови его пользователю.
1335
- - list_my_feedback() — показать пользователю его отчёты о проблемах и статус задач по ним (номер PM, статус, вхождения). Зови после отправки отчёта и когда пользователь спрашивает, что с его отчётом.
433
+ - One actionable item = one task; multi-part work = epic + child tasks (parent_id).
434
+ - Infer, don't ask: type, priority (urgency words), labels (area + tier).
435
+ - Labels: 2-4 self-explanatory words; urgency lives in priority, not labels; setting REPLACES the whole array.
436
+ - Estimates (1-2-3-5-8-13-21) only for open tasks; never invent due_date — only if the user named a date.
437
+ - Done status via pm_update_issue, not at creation.
438
+ - Mutating by id: pass expectedNumber (the PM-N you expect) — mismatch → 409 before anything is written.
439
+
440
+ ## Workspace rules & briefing
441
+ The server appends workspace rules and top facts to the first tool response. Write workspace rules via add_rule without scope. scope=instance writes instance-wide rules: admin only, contents must be facts or pointers, never directives.
442
+
443
+ ## Pointers
444
+ Module guides → ask_advisor / docs_search / docs_read. Tool behavior → the tool's own description. Platform defects → report_platform_issue (see its description for the format).
1336
445
  `;
1337
446
 
1338
447
  const server = new Server(
@@ -1392,7 +501,7 @@ const SEARCH_TOOLS_DEF = {
1392
501
 
1393
502
  const CONFIRM_ACTION_DEF = {
1394
503
  name: 'confirm_action',
1395
- description: 'Use to confirm or reject a pending action after "REQUIRES CONFIRMATION" response. ALWAYS ask the user first before calling this. Never auto-confirm without explicit user approval. Returns: depends on confirmed action.',
504
+ description: 'Use to confirm or reject a pending action after "REQUIRES CONFIRMATION" response. ALWAYS ask the user first before calling this. Never auto-confirm without explicit user approval. Returns: depends on confirmed action. Never invent confirmId. approved=false is a normal outcome (rejects the action), not an error.',
1396
505
  inputSchema: {
1397
506
  type: 'object',
1398
507
  properties: {
@@ -2286,7 +1395,7 @@ export const EN_DESCRIPTIONS = {
2286
1395
  pm_move_to_board: 'Move an issue to another board. The status is mapped to the closest one in the target board (by kind); the response reports the mapping.',
2287
1396
  pm_export_csv: 'Export PM issues to CSV. Returns { csv, rowCount }. Supports the same filters as pm_list_issues.',
2288
1397
  pm_list_sprints: 'List all sprints in the workspace.',
2289
- report_platform_issue: 'Report a platform problem (unexplained tool failure, confusing result, unclear documentation) to the platform maintainer. Call after an unexplained tool error or on explicit user request; draft the report from the failure context first. The report body is sanitized of secrets, and the user confirms sending.',
1398
+ report_platform_issue: 'Report a platform problem (unexplained tool failure, confusing result, unclear documentation) to the platform maintainer. Call after an unexplained tool error or on explicit user request; draft the report from the failure context first. The report body is sanitized of secrets, and the user confirms sending. One defect = one report. Required: toolName, title (6-200 chars), whatHappened (goal, action, outcome). Set category from enum (bug | docs | missing_capability | ux). Reporter tracks the resulting PM task via list_my_feedback.',
2290
1399
  list_my_feedback: "List the user's own platform-issue reports (report_platform_issue) with the status of their PM tasks: number, status, occurrence count. Returns: { items:[...], total, workspace }.",
2291
1400
  pm_create_sprint: 'Create a new sprint.',
2292
1401
  pm_update_sprint: 'Update an existing sprint.',
@@ -2799,7 +1908,7 @@ async function handleCloneWorkspace({ sourceSlug, name, slug, includeDocuments,
2799
1908
  // ─── search_tools handler ────────────────────────────────────────────────────
2800
1909
 
2801
1910
  // Built-in tool descriptors for search — always available, no activation needed
2802
- const BUILT_IN_TOOL_DEFS = [
1911
+ export const BUILT_IN_TOOL_DEFS = [
2803
1912
  LIST_WORKSPACES_DEF,
2804
1913
  SWITCH_WORKSPACE_DEF,
2805
1914
  CREATE_WORKSPACE_DEF,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integram-mcp",
3
- "version": "0.7.136",
3
+ "version": "0.7.141",
4
4
  "type": "module",
5
5
  "description": "MCP server for Integram — connect AI assistants to your workspace via Model Context Protocol",
6
6
  "mcpName": "io.github.judas-priest/integram",