Skip to content

Commit ce813a6

Browse files
committed
improvement(clickhouse): expand block templates and skills, normalize tool versions
- Expand ClickHouseBlockMeta templates from 3 to 9 (schema docs, table maintenance, partition retention, long-running-query alerts, table provisioning, storage growth report) - Add document-schema and maintain-tables skills (now 5, all grounded in tools.access) - Normalize tool version '1.0' to '1.0.0' across all 26 tools for repo consistency
1 parent 2554725 commit ce813a6

27 files changed

Lines changed: 106 additions & 27 deletions

apps/sim/blocks/blocks/clickhouse.ts

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import { getErrorMessage } from '@sim/utils/errors'
2-
import { ClipboardList, File } from '@/components/emcn/icons'
2+
import {
3+
Bell,
4+
ClipboardList,
5+
Database,
6+
File,
7+
Search,
8+
Server,
9+
Trash,
10+
Wrench,
11+
} from '@/components/emcn/icons'
312
import { ClickHouseIcon } from '@/components/icons'
413
import type { BlockConfig, BlockMeta } from '@/blocks/types'
514
import { IntegrationType } from '@/blocks/types'
@@ -497,6 +506,62 @@ export const ClickHouseBlockMeta = {
497506
category: 'engineering',
498507
tags: ['data-analytics', 'data-warehouse'],
499508
},
509+
{
510+
icon: Search,
511+
title: 'Document a ClickHouse schema',
512+
prompt:
513+
'Build a workflow that introspects my ClickHouse database schema, then has an agent write clear documentation describing each table, its columns, types, and engine.',
514+
modules: ['agent', 'workflows'],
515+
category: 'engineering',
516+
tags: ['data-warehouse', 'documentation'],
517+
},
518+
{
519+
icon: Wrench,
520+
title: 'Scheduled table maintenance',
521+
prompt:
522+
'Create a scheduled workflow that runs OPTIMIZE TABLE on my high-write ClickHouse tables each night to merge parts, then reports the resulting part counts and storage size.',
523+
modules: ['scheduled', 'workflows'],
524+
category: 'engineering',
525+
tags: ['data-warehouse', 'maintenance'],
526+
},
527+
{
528+
icon: Trash,
529+
title: 'Partition retention cleanup',
530+
prompt:
531+
'Build a scheduled workflow that lists the partitions of my ClickHouse events table and drops partitions older than the retention window to keep storage under control.',
532+
modules: ['scheduled', 'agent', 'workflows'],
533+
category: 'engineering',
534+
tags: ['data-warehouse', 'maintenance'],
535+
},
536+
{
537+
icon: Bell,
538+
title: 'Alert on long-running queries',
539+
prompt:
540+
'Create a scheduled workflow that checks ClickHouse for running queries, and if any has been running too long, posts an alert to Slack and optionally kills the query.',
541+
modules: ['scheduled', 'agent', 'workflows'],
542+
category: 'engineering',
543+
tags: ['monitoring', 'data-warehouse'],
544+
alsoIntegrations: ['slack'],
545+
},
546+
{
547+
icon: Database,
548+
title: 'Provision a ClickHouse table from a spec',
549+
prompt:
550+
'Build a workflow where I describe the table I need in plain English, an agent designs the columns, engine, and ORDER BY key, and the workflow creates the ClickHouse table.',
551+
modules: ['agent', 'workflows'],
552+
category: 'engineering',
553+
tags: ['data-warehouse', 'schema'],
554+
},
555+
{
556+
icon: Server,
557+
title: 'Weekly storage growth report',
558+
prompt:
559+
'Create a scheduled workflow that collects ClickHouse table stats (rows and size on disk) each week, has an agent summarize the largest tables and fastest growth, and posts the report to Slack.',
560+
modules: ['scheduled', 'agent', 'workflows'],
561+
category: 'engineering',
562+
tags: ['monitoring', 'reporting'],
563+
alsoIntegrations: ['slack'],
564+
},
500565
],
501566
skills: [
502567
{
@@ -520,5 +585,19 @@ export const ClickHouseBlockMeta = {
520585
content:
521586
'# Bulk Insert Events\n\nLoad a batch of records into a ClickHouse table.\n\n## Steps\n1. Use Describe Table to confirm the target column names and types.\n2. Map each incoming payload to those columns, coercing types (e.g. timestamps to DateTime format, numbers to the right width).\n3. Build a JSON array of row objects with consistent keys, then use Insert Rows (Bulk) against the table.\n4. Verify with Count Rows or a small SELECT.\n\n## Output\nReturn the number of rows inserted and any rows that were skipped or failed validation, with the reason. Confirm the new total row count so the caller knows ingestion succeeded.',
522587
},
588+
{
589+
name: 'document-schema',
590+
description:
591+
'Introspect a ClickHouse database and produce readable documentation of its tables, columns, and engines. Use when onboarding to an unfamiliar ClickHouse instance or refreshing schema docs.',
592+
content:
593+
'# Document Schema\n\nInspect a ClickHouse database and describe its structure.\n\n## Steps\n1. Use Introspect Schema to pull every table with its columns, types, and engine in one call. For a single table, use Describe Table or Show Create Table instead.\n2. Group columns by table and note primary/sorting key membership and defaults.\n3. Summarize each table: what it appears to store, its engine, key columns, and approximate row count.\n\n## Output\nReturn a per-table summary (name, engine, key columns, row count) followed by a column reference. Keep it concise and skimmable; call out anything unusual such as missing ORDER BY keys or very wide tables.',
594+
},
595+
{
596+
name: 'maintain-tables',
597+
description:
598+
'Keep ClickHouse tables healthy by inspecting parts, optimizing tables, and dropping stale partitions. Use for scheduled maintenance or when storage or part counts grow.',
599+
content:
600+
'# Maintain Tables\n\nRun routine ClickHouse table maintenance.\n\n## Steps\n1. Use Table Stats and List Partitions to see size on disk, part counts, and per-partition rows.\n2. For tables with many small parts, run Optimize Table (optionally with Force Final Merge) to consolidate them.\n3. For time-partitioned tables past their retention window, use Drop Partition on the oldest partitions.\n4. Re-check Table Stats to confirm the part count and size dropped.\n\n## Output\nReport what was optimized or dropped, the before/after part count and size on disk, and any partitions intentionally retained. Never drop a partition unless it is clearly outside the retention window.',
601+
},
523602
],
524603
} as const satisfies BlockMeta

apps/sim/tools/clickhouse/count-rows.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const countRowsTool: ToolConfig<ClickHouseCountRowsParams, ClickHouseCoun
55
id: 'clickhouse_count_rows',
66
name: 'ClickHouse Count Rows',
77
description: 'Count rows in a ClickHouse table, optionally filtered',
8-
version: '1.0',
8+
version: '1.0.0',
99

1010
params: {
1111
host: {

apps/sim/tools/clickhouse/create-database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const createDatabaseTool: ToolConfig<
1111
id: 'clickhouse_create_database',
1212
name: 'ClickHouse Create Database',
1313
description: 'Create a new database on a ClickHouse server',
14-
version: '1.0',
14+
version: '1.0.0',
1515

1616
params: {
1717
host: {

apps/sim/tools/clickhouse/create-table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const createTableTool: ToolConfig<ClickHouseCreateTableParams, ClickHouse
88
id: 'clickhouse_create_table',
99
name: 'ClickHouse Create Table',
1010
description: 'Create a new MergeTree-family table in ClickHouse',
11-
version: '1.0',
11+
version: '1.0.0',
1212

1313
params: {
1414
host: {

apps/sim/tools/clickhouse/delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const deleteTool: ToolConfig<ClickHouseDeleteParams, ClickHouseDeleteResp
55
id: 'clickhouse_delete',
66
name: 'ClickHouse Delete',
77
description: 'Delete rows from a ClickHouse table via an ALTER TABLE ... DELETE mutation',
8-
version: '1.0',
8+
version: '1.0.0',
99

1010
params: {
1111
host: {

apps/sim/tools/clickhouse/describe-table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const describeTableTool: ToolConfig<ClickHouseDescribeTableParams, ClickH
99
id: 'clickhouse_describe_table',
1010
name: 'ClickHouse Describe Table',
1111
description: 'Describe the columns of a ClickHouse table',
12-
version: '1.0',
12+
version: '1.0.0',
1313

1414
params: {
1515
host: {

apps/sim/tools/clickhouse/drop-database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const dropDatabaseTool: ToolConfig<ClickHouseDropDatabaseParams, ClickHou
99
id: 'clickhouse_drop_database',
1010
name: 'ClickHouse Drop Database',
1111
description: 'Drop a database from a ClickHouse server',
12-
version: '1.0',
12+
version: '1.0.0',
1313

1414
params: {
1515
host: {

apps/sim/tools/clickhouse/drop-partition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const dropPartitionTool: ToolConfig<
1111
id: 'clickhouse_drop_partition',
1212
name: 'ClickHouse Drop Partition',
1313
description: 'Drop a partition from a ClickHouse table',
14-
version: '1.0',
14+
version: '1.0.0',
1515

1616
params: {
1717
host: {

apps/sim/tools/clickhouse/drop-table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const dropTableTool: ToolConfig<ClickHouseDropTableParams, ClickHouseMess
55
id: 'clickhouse_drop_table',
66
name: 'ClickHouse Drop Table',
77
description: 'Drop a table from a ClickHouse database',
8-
version: '1.0',
8+
version: '1.0.0',
99

1010
params: {
1111
host: {

apps/sim/tools/clickhouse/execute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const executeTool: ToolConfig<ClickHouseExecuteParams, ClickHouseExecuteR
55
id: 'clickhouse_execute',
66
name: 'ClickHouse Execute',
77
description: 'Execute raw SQL (DDL, mutations, or queries) on a ClickHouse database',
8-
version: '1.0',
8+
version: '1.0.0',
99

1010
params: {
1111
host: {

0 commit comments

Comments
 (0)