posterly-mcp-server 0.62.1 → 0.64.0

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.
@@ -2,25 +2,57 @@ import { z } from 'zod';
2
2
  import type { PosterlyClient } from '../lib/api-client.js';
3
3
  import { type ToolContext } from '../lib/tool-runtime.js';
4
4
  type ListLocationInput = {
5
+ view?: 'profile' | 'categories';
5
6
  workspace_id?: string;
6
7
  account_id?: number;
7
8
  location_id?: string;
9
+ include_google_updated?: boolean;
10
+ region_code?: string;
11
+ language_code?: string;
12
+ category_view?: 'BASIC' | 'FULL';
13
+ prefix?: string;
14
+ page_size?: number;
15
+ page_token?: string;
8
16
  };
9
17
  export declare const listGoogleBusinessLocationsTool: {
10
18
  name: string;
11
19
  description: string;
12
20
  inputSchema: z.ZodObject<{
21
+ view: z.ZodOptional<z.ZodEnum<["profile", "categories"]>>;
13
22
  workspace_id: z.ZodOptional<z.ZodString>;
14
23
  account_id: z.ZodOptional<z.ZodNumber>;
15
24
  location_id: z.ZodOptional<z.ZodString>;
25
+ include_google_updated: z.ZodOptional<z.ZodBoolean>;
26
+ region_code: z.ZodOptional<z.ZodString>;
27
+ language_code: z.ZodOptional<z.ZodString>;
28
+ category_view: z.ZodOptional<z.ZodEnum<["BASIC", "FULL"]>>;
29
+ prefix: z.ZodOptional<z.ZodString>;
30
+ page_size: z.ZodOptional<z.ZodNumber>;
31
+ page_token: z.ZodOptional<z.ZodString>;
16
32
  }, "strip", z.ZodTypeAny, {
17
33
  account_id?: number | undefined;
18
34
  workspace_id?: string | undefined;
19
35
  location_id?: string | undefined;
36
+ region_code?: string | undefined;
37
+ include_google_updated?: boolean | undefined;
38
+ language_code?: string | undefined;
39
+ view?: "profile" | "categories" | undefined;
40
+ prefix?: string | undefined;
41
+ page_size?: number | undefined;
42
+ page_token?: string | undefined;
43
+ category_view?: "BASIC" | "FULL" | undefined;
20
44
  }, {
21
45
  account_id?: number | undefined;
22
46
  workspace_id?: string | undefined;
23
47
  location_id?: string | undefined;
48
+ region_code?: string | undefined;
49
+ include_google_updated?: boolean | undefined;
50
+ language_code?: string | undefined;
51
+ view?: "profile" | "categories" | undefined;
52
+ prefix?: string | undefined;
53
+ page_size?: number | undefined;
54
+ page_token?: string | undefined;
55
+ category_view?: "BASIC" | "FULL" | undefined;
24
56
  }>;
25
57
  execute(client: PosterlyClient, input: ListLocationInput, ctx: ToolContext): Promise<string>;
26
58
  };
@@ -1,35 +1,45 @@
1
1
  import { z } from 'zod';
2
- import { code, mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
2
+ import { formatGbpCategoryCatalog, formatGbpLocationProfile } from '../lib/gbp-location-preview.js';
3
3
  import { validateArgs } from '../lib/tool-runtime.js';
4
4
  const LOCATION_ID_DESCRIPTION = 'Google Business numeric location id (the location_id/platform_user_id from list_accounts, e.g. "197940849675145390"). NOT the ChIJ... Place ID from list_google_business_reviews view=review_link. Prefer account_id.';
5
5
  export const listGoogleBusinessLocationsTool = {
6
6
  name: 'list_google_business_locations',
7
- description: 'Read regular opening hours and attributes for one Google Business location. Stays off until location edits are switched on, and does not call Google while it is off. Pass account_id or location_id. Does not return the business name, address, phone, or website.',
7
+ description: 'Read a Google Business location profile or look up Google Business categories. view=profile (default): read title, description, primary and additional categories, services, phone numbers, website URL, regular opening hours, attributes, and pending-review status for one location (pass account_id or location_id). view=categories: search Google Business categories via categories.list (region_code and language_code required, optional prefix filter, category_view BASIC or FULL, page_size up to 100, page_token). Stays off until location edits are switched on, and does not call Google while it is off.',
8
8
  inputSchema: z.object({
9
+ view: z.enum(['profile', 'categories']).optional().describe('profile (default) or categories.'),
9
10
  workspace_id: z.string().optional().describe('Filter to a workspace ID from whoami.'),
10
11
  account_id: z.number().int().positive().optional().describe('Google Business account ID from list_accounts.'),
11
12
  location_id: z.string().optional().describe(LOCATION_ID_DESCRIPTION),
13
+ include_google_updated: z.boolean().optional().describe('profile: when true, also check Google-suggested updates (the getGoogleUpdated method).'),
14
+ region_code: z.string().optional().describe('categories: two-letter ISO country code, e.g. US or GB.'),
15
+ language_code: z.string().optional().describe('categories: BCP-47 language code, e.g. en or en-GB.'),
16
+ category_view: z.enum(['BASIC', 'FULL']).optional().describe('categories: BASIC (default) or FULL (includes service types and more-hours types).'),
17
+ prefix: z.string().optional().describe('categories: optional category display name prefix filter.'),
18
+ page_size: z.number().int().min(1).max(100).optional().describe('categories: max results per page (1 to 100, default 50).'),
19
+ page_token: z.string().optional().describe('categories: next_page_token from a previous categories response.'),
12
20
  }),
13
21
  async execute(client, input, ctx) {
14
- const { args } = validateArgs(ctx, 'list_google_business_locations', input);
15
- const result = await client.listGoogleBusinessLocation(args);
16
- if (result.enabled !== true) {
17
- return 'Google Business location edits are switched off. Nothing was read from Google.';
22
+ const { mode, args } = validateArgs(ctx, 'list_google_business_locations', input);
23
+ if (mode === 'categories') {
24
+ const result = await client.listGoogleBusinessCategories({
25
+ workspace_id: args.workspace_id,
26
+ account_id: args.account_id,
27
+ location_id: args.location_id,
28
+ region_code: args.region_code,
29
+ language_code: args.language_code,
30
+ category_view: args.category_view,
31
+ prefix: args.prefix,
32
+ page_size: args.page_size,
33
+ page_token: args.page_token,
34
+ });
35
+ return formatGbpCategoryCatalog(result);
18
36
  }
19
- const periods = Array.isArray(result.regular_hours?.periods) ? result.regular_hours.periods : [];
20
- const attributes = Array.isArray(result.attributes) ? result.attributes : [];
21
- return [
22
- mdTitle('Google Business location'),
23
- mdSection('Location', mdKeyValue([
24
- ['Account ID', result.account_id != null ? code(result.account_id) : undefined],
25
- ['Location', result.location ? code(String(result.location)) : undefined],
26
- ])),
27
- mdSection('Regular hours', periods.length
28
- ? periods.map((period) => `- ${period.open_day} ${period.open_time} to ${period.close_day} ${period.close_time}`).join('\n')
29
- : 'No regular hours saved.'),
30
- mdSection('Attributes', attributes.length
31
- ? attributes.map((attribute) => `- ${attribute.name} (${attribute.value_type}): ${(attribute.values || []).join(', ')}`).join('\n')
32
- : 'No attributes saved.'),
33
- ].join('\n\n');
37
+ const result = await client.listGoogleBusinessLocation({
38
+ workspace_id: args.workspace_id,
39
+ account_id: args.account_id,
40
+ location_id: args.location_id,
41
+ include_google_updated: args.include_google_updated,
42
+ });
43
+ return formatGbpLocationProfile(result);
34
44
  },
35
45
  };
@@ -1,8 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  import type { PosterlyClient } from '../lib/api-client.js';
3
3
  import { type ToolContext } from '../lib/tool-runtime.js';
4
+ type ManageLocationAction = 'update_hours' | 'update_attributes' | 'update_description' | 'update_categories' | 'update_services' | 'update_title' | 'update_phones' | 'update_website';
4
5
  type ManageLocationInput = {
5
- action: 'update_hours' | 'update_attributes';
6
+ action: ManageLocationAction;
6
7
  workspace_id?: string;
7
8
  account_id?: number;
8
9
  location_id?: string;
@@ -19,6 +20,20 @@ type ManageLocationInput = {
19
20
  value_type: 'BOOL' | 'URL' | 'ENUM';
20
21
  values: Array<boolean | string>;
21
22
  }>;
23
+ description?: string;
24
+ categories?: {
25
+ primary_category: string;
26
+ additional_categories?: string[];
27
+ carried_over_additional_categories?: boolean;
28
+ };
29
+ service_items?: Array<Record<string, unknown>>;
30
+ title?: string;
31
+ phone_numbers?: {
32
+ primary_phone: string;
33
+ additional_phones?: string[];
34
+ carried_over_additional_phones?: boolean;
35
+ };
36
+ website_uri?: string;
22
37
  confirm?: boolean;
23
38
  preview_id?: string;
24
39
  };
@@ -26,7 +41,7 @@ export declare const manageGoogleBusinessLocationTool: {
26
41
  name: string;
27
42
  description: string;
28
43
  inputSchema: z.ZodObject<{
29
- action: z.ZodEnum<["update_hours", "update_attributes"]>;
44
+ action: z.ZodEnum<["update_hours", "update_attributes", "update_description", "update_categories", "update_services", "update_title", "update_phones", "update_website"]>;
30
45
  workspace_id: z.ZodOptional<z.ZodString>;
31
46
  account_id: z.ZodOptional<z.ZodNumber>;
32
47
  location_id: z.ZodOptional<z.ZodString>;
@@ -75,12 +90,127 @@ export declare const manageGoogleBusinessLocationTool: {
75
90
  name: string;
76
91
  value_type: "URL" | "BOOL" | "ENUM";
77
92
  }>, "many">>;
93
+ description: z.ZodOptional<z.ZodString>;
94
+ categories: z.ZodOptional<z.ZodObject<{
95
+ primary_category: z.ZodString;
96
+ additional_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ primary_category: string;
99
+ additional_categories?: string[] | undefined;
100
+ }, {
101
+ primary_category: string;
102
+ additional_categories?: string[] | undefined;
103
+ }>>;
104
+ service_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
105
+ structured_service_item: z.ZodOptional<z.ZodObject<{
106
+ service_type_id: z.ZodString;
107
+ description: z.ZodOptional<z.ZodString>;
108
+ }, "strip", z.ZodTypeAny, {
109
+ service_type_id: string;
110
+ description?: string | undefined;
111
+ }, {
112
+ service_type_id: string;
113
+ description?: string | undefined;
114
+ }>>;
115
+ free_form_service_item: z.ZodOptional<z.ZodObject<{
116
+ category: z.ZodString;
117
+ label: z.ZodObject<{
118
+ display_name: z.ZodString;
119
+ description: z.ZodOptional<z.ZodString>;
120
+ language_code: z.ZodOptional<z.ZodString>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ display_name: string;
123
+ description?: string | undefined;
124
+ language_code?: string | undefined;
125
+ }, {
126
+ display_name: string;
127
+ description?: string | undefined;
128
+ language_code?: string | undefined;
129
+ }>;
130
+ }, "strip", z.ZodTypeAny, {
131
+ label: {
132
+ display_name: string;
133
+ description?: string | undefined;
134
+ language_code?: string | undefined;
135
+ };
136
+ category: string;
137
+ }, {
138
+ label: {
139
+ display_name: string;
140
+ description?: string | undefined;
141
+ language_code?: string | undefined;
142
+ };
143
+ category: string;
144
+ }>>;
145
+ price: z.ZodOptional<z.ZodObject<{
146
+ currency_code: z.ZodString;
147
+ units: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
148
+ nanos: z.ZodOptional<z.ZodNumber>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ currency_code: string;
151
+ units?: string | number | undefined;
152
+ nanos?: number | undefined;
153
+ }, {
154
+ currency_code: string;
155
+ units?: string | number | undefined;
156
+ nanos?: number | undefined;
157
+ }>>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ structured_service_item?: {
160
+ service_type_id: string;
161
+ description?: string | undefined;
162
+ } | undefined;
163
+ free_form_service_item?: {
164
+ label: {
165
+ display_name: string;
166
+ description?: string | undefined;
167
+ language_code?: string | undefined;
168
+ };
169
+ category: string;
170
+ } | undefined;
171
+ price?: {
172
+ currency_code: string;
173
+ units?: string | number | undefined;
174
+ nanos?: number | undefined;
175
+ } | undefined;
176
+ }, {
177
+ structured_service_item?: {
178
+ service_type_id: string;
179
+ description?: string | undefined;
180
+ } | undefined;
181
+ free_form_service_item?: {
182
+ label: {
183
+ display_name: string;
184
+ description?: string | undefined;
185
+ language_code?: string | undefined;
186
+ };
187
+ category: string;
188
+ } | undefined;
189
+ price?: {
190
+ currency_code: string;
191
+ units?: string | number | undefined;
192
+ nanos?: number | undefined;
193
+ } | undefined;
194
+ }>, "many">>;
195
+ title: z.ZodOptional<z.ZodString>;
196
+ phone_numbers: z.ZodOptional<z.ZodObject<{
197
+ primary_phone: z.ZodString;
198
+ additional_phones: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
199
+ }, "strip", z.ZodTypeAny, {
200
+ primary_phone: string;
201
+ additional_phones?: string[] | undefined;
202
+ }, {
203
+ primary_phone: string;
204
+ additional_phones?: string[] | undefined;
205
+ }>>;
206
+ website_uri: z.ZodOptional<z.ZodString>;
78
207
  confirm: z.ZodOptional<z.ZodBoolean>;
79
208
  preview_id: z.ZodOptional<z.ZodString>;
80
209
  }, "strip", z.ZodTypeAny, {
81
- action: "update_hours" | "update_attributes";
210
+ action: "update_hours" | "update_attributes" | "update_description" | "update_categories" | "update_services" | "update_title" | "update_phones" | "update_website";
82
211
  account_id?: number | undefined;
83
212
  workspace_id?: string | undefined;
213
+ description?: string | undefined;
84
214
  confirm?: boolean | undefined;
85
215
  preview_id?: string | undefined;
86
216
  location_id?: string | undefined;
@@ -97,10 +227,40 @@ export declare const manageGoogleBusinessLocationTool: {
97
227
  name: string;
98
228
  value_type: "URL" | "BOOL" | "ENUM";
99
229
  }[] | undefined;
230
+ title?: string | undefined;
231
+ categories?: {
232
+ primary_category: string;
233
+ additional_categories?: string[] | undefined;
234
+ } | undefined;
235
+ phone_numbers?: {
236
+ primary_phone: string;
237
+ additional_phones?: string[] | undefined;
238
+ } | undefined;
239
+ service_items?: {
240
+ structured_service_item?: {
241
+ service_type_id: string;
242
+ description?: string | undefined;
243
+ } | undefined;
244
+ free_form_service_item?: {
245
+ label: {
246
+ display_name: string;
247
+ description?: string | undefined;
248
+ language_code?: string | undefined;
249
+ };
250
+ category: string;
251
+ } | undefined;
252
+ price?: {
253
+ currency_code: string;
254
+ units?: string | number | undefined;
255
+ nanos?: number | undefined;
256
+ } | undefined;
257
+ }[] | undefined;
258
+ website_uri?: string | undefined;
100
259
  }, {
101
- action: "update_hours" | "update_attributes";
260
+ action: "update_hours" | "update_attributes" | "update_description" | "update_categories" | "update_services" | "update_title" | "update_phones" | "update_website";
102
261
  account_id?: number | undefined;
103
262
  workspace_id?: string | undefined;
263
+ description?: string | undefined;
104
264
  confirm?: boolean | undefined;
105
265
  preview_id?: string | undefined;
106
266
  location_id?: string | undefined;
@@ -117,6 +277,35 @@ export declare const manageGoogleBusinessLocationTool: {
117
277
  name: string;
118
278
  value_type: "URL" | "BOOL" | "ENUM";
119
279
  }[] | undefined;
280
+ title?: string | undefined;
281
+ categories?: {
282
+ primary_category: string;
283
+ additional_categories?: string[] | undefined;
284
+ } | undefined;
285
+ phone_numbers?: {
286
+ primary_phone: string;
287
+ additional_phones?: string[] | undefined;
288
+ } | undefined;
289
+ service_items?: {
290
+ structured_service_item?: {
291
+ service_type_id: string;
292
+ description?: string | undefined;
293
+ } | undefined;
294
+ free_form_service_item?: {
295
+ label: {
296
+ display_name: string;
297
+ description?: string | undefined;
298
+ language_code?: string | undefined;
299
+ };
300
+ category: string;
301
+ } | undefined;
302
+ price?: {
303
+ currency_code: string;
304
+ units?: string | number | undefined;
305
+ nanos?: number | undefined;
306
+ } | undefined;
307
+ }[] | undefined;
308
+ website_uri?: string | undefined;
120
309
  }>;
121
310
  execute(client: PosterlyClient, input: ManageLocationInput, ctx: ToolContext): Promise<string>;
122
311
  };