@sellable/mcp 0.1.294 → 0.1.295

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ import { getApi } from "../api.js";
2
+ export const columnReorderToolDefinitions = [
3
+ {
4
+ name: "reorder_columns",
5
+ description: "Reorder workflow-table columns using exact backend order semantics. Supply every column ID in desired order.",
6
+ inputSchema: {
7
+ type: "object",
8
+ properties: {
9
+ tableId: { type: "string" },
10
+ orderedColumnIds: {
11
+ type: "array",
12
+ items: { type: "string" },
13
+ minItems: 1,
14
+ },
15
+ },
16
+ required: ["tableId", "orderedColumnIds"],
17
+ additionalProperties: false,
18
+ },
19
+ },
20
+ ];
21
+ function isRecord(value) {
22
+ return !!value && typeof value === "object" && !Array.isArray(value);
23
+ }
24
+ export async function handleReorderColumns(input) {
25
+ if (!isRecord(input)) {
26
+ return {
27
+ ok: false,
28
+ error: "invalid_arguments",
29
+ message: "Arguments must be an object.",
30
+ };
31
+ }
32
+ const { tableId, orderedColumnIds } = input;
33
+ if (typeof tableId !== "string" || tableId.trim() === "") {
34
+ return {
35
+ ok: false,
36
+ error: "invalid_arguments",
37
+ message: "tableId is required.",
38
+ };
39
+ }
40
+ if (!Array.isArray(orderedColumnIds) || orderedColumnIds.length === 0) {
41
+ return {
42
+ ok: false,
43
+ error: "invalid_arguments",
44
+ message: "orderedColumnIds must be a non-empty array.",
45
+ };
46
+ }
47
+ if (orderedColumnIds.some((id) => typeof id !== "string" || id.trim() === "")) {
48
+ return {
49
+ ok: false,
50
+ error: "invalid_arguments",
51
+ message: "orderedColumnIds must contain non-empty strings.",
52
+ };
53
+ }
54
+ const uniqueIds = new Set(orderedColumnIds);
55
+ if (uniqueIds.size !== orderedColumnIds.length) {
56
+ return {
57
+ ok: false,
58
+ error: "invalid_arguments",
59
+ message: "orderedColumnIds must not contain duplicates.",
60
+ };
61
+ }
62
+ return getApi().post(`/api/v3/workflow-tables/${tableId}/columns/reorder`, {
63
+ orderedColumnIds,
64
+ });
65
+ }
@@ -0,0 +1,101 @@
1
+ import { type ColumnSchemaRow } from "../generated/column-schema-manifest.js";
2
+ export declare const columnSchemaToolDefinitions: ({
3
+ name: string;
4
+ description: string;
5
+ inputSchema: {
6
+ type: string;
7
+ properties: {
8
+ includeHidden: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ includeDeprecated: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ optionId?: undefined;
17
+ columnType?: undefined;
18
+ };
19
+ additionalProperties: boolean;
20
+ };
21
+ } | {
22
+ name: string;
23
+ description: string;
24
+ inputSchema: {
25
+ type: string;
26
+ properties: {
27
+ optionId: {
28
+ type: string;
29
+ description: string;
30
+ };
31
+ columnType: {
32
+ type: string;
33
+ description: string;
34
+ };
35
+ includeHidden?: undefined;
36
+ includeDeprecated?: undefined;
37
+ };
38
+ additionalProperties: boolean;
39
+ };
40
+ })[];
41
+ export declare function handleListColumnTypes(input?: unknown): {
42
+ ok: boolean;
43
+ error: string;
44
+ message: string;
45
+ counts?: undefined;
46
+ createableTypes?: undefined;
47
+ rows?: undefined;
48
+ } | {
49
+ ok: boolean;
50
+ counts: {
51
+ visible: number;
52
+ hiddenActive: number;
53
+ deprecatedLoadOnly: number;
54
+ returned: number;
55
+ };
56
+ createableTypes: string[];
57
+ rows: ColumnSchemaRow[];
58
+ error?: undefined;
59
+ message?: undefined;
60
+ };
61
+ export declare function handleGetColumnSchema(input: unknown): {
62
+ ok: boolean;
63
+ error: string;
64
+ message: string;
65
+ optionId?: undefined;
66
+ row?: undefined;
67
+ columnType?: undefined;
68
+ optionIds?: undefined;
69
+ } | {
70
+ ok: boolean;
71
+ error: string;
72
+ optionId: string;
73
+ message?: undefined;
74
+ row?: undefined;
75
+ columnType?: undefined;
76
+ optionIds?: undefined;
77
+ } | {
78
+ ok: boolean;
79
+ row: ColumnSchemaRow;
80
+ error?: undefined;
81
+ message?: undefined;
82
+ optionId?: undefined;
83
+ columnType?: undefined;
84
+ optionIds?: undefined;
85
+ } | {
86
+ ok: boolean;
87
+ error: string;
88
+ columnType: string | undefined;
89
+ message?: undefined;
90
+ optionId?: undefined;
91
+ row?: undefined;
92
+ optionIds?: undefined;
93
+ } | {
94
+ ok: boolean;
95
+ error: string;
96
+ columnType: string | undefined;
97
+ optionIds: string[];
98
+ message?: undefined;
99
+ optionId?: undefined;
100
+ row?: undefined;
101
+ };
@@ -0,0 +1,137 @@
1
+ import { columnSchemaManifest, } from "../generated/column-schema-manifest.js";
2
+ export const columnSchemaToolDefinitions = [
3
+ {
4
+ name: "list_column_types",
5
+ description: "List workflow-table column options MCP can discover, including createable UI options by default and hidden/deprecated rows when requested.",
6
+ inputSchema: {
7
+ type: "object",
8
+ properties: {
9
+ includeHidden: {
10
+ type: "boolean",
11
+ description: "Include hidden active non-createable column types.",
12
+ },
13
+ includeDeprecated: {
14
+ type: "boolean",
15
+ description: "Include deprecated/load-only non-createable aliases.",
16
+ },
17
+ },
18
+ additionalProperties: false,
19
+ },
20
+ },
21
+ {
22
+ name: "get_column_schema",
23
+ description: "Get MCP discovery metadata for one workflow-table column option. Prefer optionId when a columnType has multiple visible presets.",
24
+ inputSchema: {
25
+ type: "object",
26
+ properties: {
27
+ optionId: {
28
+ type: "string",
29
+ description: "Specific option id, such as http_request.generic or http_request.enrich_prospect.",
30
+ },
31
+ columnType: {
32
+ type: "string",
33
+ description: "Column type id. Ambiguous shared types return matching optionIds.",
34
+ },
35
+ },
36
+ additionalProperties: false,
37
+ },
38
+ },
39
+ ];
40
+ function isRecord(value) {
41
+ return !!value && typeof value === "object" && !Array.isArray(value);
42
+ }
43
+ function rowIsIncluded(row, input) {
44
+ if (row.kind === "visible")
45
+ return true;
46
+ if (row.kind === "hidden_active")
47
+ return input.includeHidden === true;
48
+ if (row.kind === "deprecated_load_only") {
49
+ return input.includeDeprecated === true;
50
+ }
51
+ return false;
52
+ }
53
+ export function handleListColumnTypes(input = {}) {
54
+ if (!isRecord(input)) {
55
+ return {
56
+ ok: false,
57
+ error: "invalid_arguments",
58
+ message: "Arguments must be an object.",
59
+ };
60
+ }
61
+ if ((input.includeHidden !== undefined &&
62
+ typeof input.includeHidden !== "boolean") ||
63
+ (input.includeDeprecated !== undefined &&
64
+ typeof input.includeDeprecated !== "boolean")) {
65
+ return {
66
+ ok: false,
67
+ error: "invalid_arguments",
68
+ message: "includeHidden and includeDeprecated must be booleans.",
69
+ };
70
+ }
71
+ const listInput = input;
72
+ const rows = columnSchemaManifest.rows.filter((row) => rowIsIncluded(row, listInput));
73
+ return {
74
+ ok: true,
75
+ counts: {
76
+ returned: rows.length,
77
+ ...columnSchemaManifest.counts,
78
+ },
79
+ createableTypes: columnSchemaManifest.createableTypes,
80
+ rows,
81
+ };
82
+ }
83
+ export function handleGetColumnSchema(input) {
84
+ if (!isRecord(input)) {
85
+ return {
86
+ ok: false,
87
+ error: "invalid_arguments",
88
+ message: "Arguments must be an object.",
89
+ };
90
+ }
91
+ const { optionId, columnType } = input;
92
+ const hasOptionId = typeof optionId === "string" && optionId.trim() !== "";
93
+ const hasColumnType = typeof columnType === "string" && columnType.trim() !== "";
94
+ if ((optionId !== undefined && typeof optionId !== "string") ||
95
+ (columnType !== undefined && typeof columnType !== "string")) {
96
+ return {
97
+ ok: false,
98
+ error: "invalid_arguments",
99
+ message: "optionId and columnType must be strings when supplied.",
100
+ };
101
+ }
102
+ if (hasOptionId === hasColumnType) {
103
+ return {
104
+ ok: false,
105
+ error: "invalid_selector",
106
+ message: "Supply exactly one non-empty optionId or columnType.",
107
+ };
108
+ }
109
+ if (hasOptionId) {
110
+ const row = columnSchemaManifest.rows.find((candidate) => candidate.optionId === optionId);
111
+ if (!row) {
112
+ return {
113
+ ok: false,
114
+ error: "not_found",
115
+ optionId,
116
+ };
117
+ }
118
+ return { ok: true, row };
119
+ }
120
+ const matches = columnSchemaManifest.rows.filter((candidate) => candidate.columnType === columnType);
121
+ if (matches.length === 0) {
122
+ return {
123
+ ok: false,
124
+ error: "not_found",
125
+ columnType,
126
+ };
127
+ }
128
+ if (matches.length > 1) {
129
+ return {
130
+ ok: false,
131
+ error: "ambiguous_column_type",
132
+ columnType,
133
+ optionIds: matches.map((row) => row.optionId),
134
+ };
135
+ }
136
+ return { ok: true, row: matches[0] };
137
+ }
@@ -0,0 +1,36 @@
1
+ export type UpdateColumnInput = {
2
+ tableId: string;
3
+ columnId: string;
4
+ name?: string;
5
+ config?: Record<string, unknown>;
6
+ runCells?: boolean;
7
+ };
8
+ export declare const columnUpdateToolDefinitions: {
9
+ name: string;
10
+ description: string;
11
+ inputSchema: {
12
+ type: string;
13
+ properties: {
14
+ tableId: {
15
+ type: string;
16
+ };
17
+ columnId: {
18
+ type: string;
19
+ };
20
+ name: {
21
+ type: string;
22
+ };
23
+ config: {
24
+ type: string;
25
+ description: string;
26
+ };
27
+ runCells: {
28
+ type: string;
29
+ description: string;
30
+ };
31
+ };
32
+ required: string[];
33
+ additionalProperties: boolean;
34
+ };
35
+ }[];
36
+ export declare function handleUpdateColumn(input: unknown): Promise<unknown>;
@@ -0,0 +1,88 @@
1
+ import { getApi } from "../api.js";
2
+ export const columnUpdateToolDefinitions = [
3
+ {
4
+ name: "update_column",
5
+ description: "Update a workflow-table column name or full replacement config. Use runCells:true to reprocess eligible cells after a config update.",
6
+ inputSchema: {
7
+ type: "object",
8
+ properties: {
9
+ tableId: { type: "string" },
10
+ columnId: { type: "string" },
11
+ name: { type: "string" },
12
+ config: {
13
+ type: "object",
14
+ description: "Full replacement column config; use get_column_schema first for the expected shape.",
15
+ },
16
+ runCells: {
17
+ type: "boolean",
18
+ description: "When true, reprocess/queue eligible cells.",
19
+ },
20
+ },
21
+ required: ["tableId", "columnId"],
22
+ additionalProperties: false,
23
+ },
24
+ },
25
+ ];
26
+ function isRecord(value) {
27
+ return !!value && typeof value === "object" && !Array.isArray(value);
28
+ }
29
+ export async function handleUpdateColumn(input) {
30
+ if (!isRecord(input)) {
31
+ return {
32
+ ok: false,
33
+ error: "invalid_arguments",
34
+ message: "Arguments must be an object.",
35
+ };
36
+ }
37
+ const { tableId, columnId, name, config, runCells } = input;
38
+ if (typeof tableId !== "string" || tableId.trim() === "") {
39
+ return {
40
+ ok: false,
41
+ error: "invalid_arguments",
42
+ message: "tableId is required.",
43
+ };
44
+ }
45
+ if (typeof columnId !== "string" || columnId.trim() === "") {
46
+ return {
47
+ ok: false,
48
+ error: "invalid_arguments",
49
+ message: "columnId is required.",
50
+ };
51
+ }
52
+ if (name !== undefined && typeof name !== "string") {
53
+ return {
54
+ ok: false,
55
+ error: "invalid_arguments",
56
+ message: "name must be a string.",
57
+ };
58
+ }
59
+ if (config !== undefined && !isRecord(config)) {
60
+ return {
61
+ ok: false,
62
+ error: "invalid_arguments",
63
+ message: "config must be an object.",
64
+ };
65
+ }
66
+ if (runCells !== undefined && typeof runCells !== "boolean") {
67
+ return {
68
+ ok: false,
69
+ error: "invalid_arguments",
70
+ message: "runCells must be a boolean.",
71
+ };
72
+ }
73
+ if (name === undefined && config === undefined && runCells === undefined) {
74
+ return {
75
+ ok: false,
76
+ error: "invalid_arguments",
77
+ message: "At least one of name, config, or runCells is required.",
78
+ };
79
+ }
80
+ const body = {};
81
+ if (name !== undefined)
82
+ body.name = name;
83
+ if (config !== undefined)
84
+ body.config = config;
85
+ if (runCells !== undefined)
86
+ body.runCells = runCells;
87
+ return getApi().patch(`/api/v3/workflow-tables/${tableId}/columns/${columnId}`, body);
88
+ }