@serpstat/serpstat-mcp-server 1.0.8 → 1.1.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.
@@ -0,0 +1,767 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetSubElementsByCrcHandler = exports.GetErrorElementsHandler = exports.GetReportWithoutDetailsHandler = exports.GetBasicInfoHandler = exports.GetDefaultSettingsHandler = exports.GetScanUserUrlListHandler = exports.GetSiteAuditsListHandler = exports.GetHistoryByCountErrorHandler = exports.GetCategoriesStatisticHandler = exports.StopSiteAuditHandler = exports.StartSiteAuditHandler = exports.SetSiteAuditSettingsHandler = exports.GetSiteAuditSettingsHandler = void 0;
4
+ const base_js_1 = require("./base.js");
5
+ const site_audit_js_1 = require("../services/site_audit.js");
6
+ const validation_js_1 = require("../utils/validation.js");
7
+ const config_js_1 = require("../utils/config.js");
8
+ const constants_js_1 = require("../utils/constants.js");
9
+ class GetSiteAuditSettingsHandler extends base_js_1.BaseHandler {
10
+ siteAuditService;
11
+ constructor() {
12
+ super();
13
+ const config = (0, config_js_1.loadConfig)();
14
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
15
+ }
16
+ getName() {
17
+ return 'get_site_audit_settings';
18
+ }
19
+ getDescription() {
20
+ return 'Get current configuration of EXISTING audit project. Returns: mainSettings (domain, name, pagesLimit, scanSpeed, scanDuration, userAgent, robotsTxt, etc), scan filters (keywords to include/exclude), authentication, email notifications, scheduling, error thresholds. Compare with get_site_audit_project_default_settings which returns template for NEW projects. Does not consume API credits.';
21
+ }
22
+ getInputSchema() {
23
+ return {
24
+ type: 'object',
25
+ properties: {
26
+ projectId: {
27
+ type: 'integer',
28
+ minimum: constants_js_1.MIN_PROJECT_ID,
29
+ description: 'Project ID to get settings for'
30
+ }
31
+ },
32
+ required: ['projectId']
33
+ };
34
+ }
35
+ async handle(call) {
36
+ try {
37
+ const params = validation_js_1.getSiteAuditSettingsSchema.parse(call.arguments);
38
+ const result = await this.siteAuditService.getSettings(params);
39
+ return this.createSuccessResponse(result);
40
+ }
41
+ catch (error) {
42
+ return this.createErrorResponse(error);
43
+ }
44
+ }
45
+ }
46
+ exports.GetSiteAuditSettingsHandler = GetSiteAuditSettingsHandler;
47
+ class SetSiteAuditSettingsHandler extends base_js_1.BaseHandler {
48
+ siteAuditService;
49
+ constructor() {
50
+ super();
51
+ const config = (0, config_js_1.loadConfig)();
52
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
53
+ }
54
+ getName() {
55
+ return 'set_site_audit_settings';
56
+ }
57
+ getDescription() {
58
+ return 'Update or create audit project configuration. Use get_site_audit_project_default_settings to get template, then modify and save with this method. Required fields: mainSettings (domain, name, subdomainsCheck, pagesLimit, scanSpeed, etc), scanSetting (type: 1=all site, 2=URL list, 3=sitemap), scheduleSettings, mailTriggerSettings, baseAuthBlock, keyword filters. Does not consume API credits.';
59
+ }
60
+ getInputSchema() {
61
+ return {
62
+ type: 'object',
63
+ properties: {
64
+ projectId: {
65
+ type: 'integer',
66
+ minimum: constants_js_1.MIN_PROJECT_ID,
67
+ description: 'Project ID to update settings for'
68
+ },
69
+ mainSettings: {
70
+ type: 'object',
71
+ properties: {
72
+ domain: {
73
+ type: 'string',
74
+ minLength: constants_js_1.MIN_DOMAIN_LENGTH,
75
+ maxLength: constants_js_1.MAX_DOMAIN_LENGTH,
76
+ description: 'Project domain'
77
+ },
78
+ name: {
79
+ type: 'string',
80
+ minLength: constants_js_1.MIN_DOMAIN_LENGTH,
81
+ description: 'Project name'
82
+ },
83
+ subdomainsCheck: {
84
+ type: 'boolean',
85
+ description: 'Check domain with subdomains'
86
+ },
87
+ pagesLimit: {
88
+ type: 'integer',
89
+ minimum: constants_js_1.MIN_PAGES_LIMIT,
90
+ description: 'Scan pages limit'
91
+ },
92
+ scanSpeed: {
93
+ type: 'integer',
94
+ minimum: constants_js_1.MIN_SCAN_SPEED,
95
+ maximum: constants_js_1.MAX_SCAN_SPEED,
96
+ description: 'Scan speed (1-30, every increment of 3 adds one thread)'
97
+ },
98
+ autoSpeed: {
99
+ type: 'boolean',
100
+ description: 'Auto speed control'
101
+ },
102
+ scanNoIndex: {
103
+ type: 'boolean',
104
+ description: 'Scan NoIndex pages'
105
+ },
106
+ autoUserAgent: {
107
+ type: 'boolean',
108
+ description: 'Automatic change of user agent'
109
+ },
110
+ scanWrongCanonical: {
111
+ type: 'boolean',
112
+ description: 'Scan wrong Canonical pages'
113
+ },
114
+ scanDuration: {
115
+ type: 'integer',
116
+ minimum: constants_js_1.MIN_SCAN_DURATION,
117
+ description: 'Scan duration in hours'
118
+ },
119
+ folderDepth: {
120
+ type: 'integer',
121
+ minimum: constants_js_1.MIN_FOLDER_DEPTH,
122
+ description: 'Maximum folders in URL path'
123
+ },
124
+ urlDepth: {
125
+ type: 'integer',
126
+ minimum: constants_js_1.MIN_URL_DEPTH,
127
+ description: 'Maximum clicks from main page'
128
+ },
129
+ userAgent: {
130
+ type: 'integer',
131
+ enum: constants_js_1.SITE_AUDIT_USER_AGENT_IDS,
132
+ description: 'User agent ID (0=Chrome, 1=Serpstat, 2=Google, 3=Yandex, 4=Firefox, 5=IE)'
133
+ },
134
+ robotsTxt: {
135
+ type: 'boolean',
136
+ description: 'Verify robots.txt compliance'
137
+ },
138
+ withImages: {
139
+ type: 'boolean',
140
+ description: 'Scan images'
141
+ }
142
+ },
143
+ required: ['domain', 'name', 'subdomainsCheck', 'pagesLimit', 'scanSpeed', 'autoSpeed', 'scanNoIndex', 'autoUserAgent', 'scanWrongCanonical', 'scanDuration', 'folderDepth', 'urlDepth', 'userAgent', 'robotsTxt', 'withImages']
144
+ },
145
+ dontScanKeywordsBlock: {
146
+ type: 'object',
147
+ properties: {
148
+ checked: { type: 'boolean', description: 'Apply exclusion rule' },
149
+ keywords: { type: 'string', description: 'Keywords to exclude (comma-separated)' }
150
+ },
151
+ required: ['checked', 'keywords'],
152
+ description: 'Exclude pages with these keywords in URL'
153
+ },
154
+ onlyScanKeywordsBlock: {
155
+ type: 'object',
156
+ properties: {
157
+ checked: { type: 'boolean', description: 'Apply inclusion rule' },
158
+ keywords: { type: 'string', description: 'Keywords to include (comma-separated)' }
159
+ },
160
+ required: ['checked', 'keywords'],
161
+ description: 'Only scan pages with these keywords in URL'
162
+ },
163
+ baseAuthBlock: {
164
+ type: 'object',
165
+ properties: {
166
+ login: { type: 'string', description: 'HTTP Basic auth login' },
167
+ password: { type: 'string', description: 'HTTP Basic auth password' }
168
+ },
169
+ required: ['login', 'password'],
170
+ description: 'HTTP Basic authentication credentials'
171
+ },
172
+ mailTriggerSettings: {
173
+ type: 'object',
174
+ properties: {
175
+ emails: {
176
+ type: 'array',
177
+ items: { type: 'string' },
178
+ description: 'Email addresses for notifications'
179
+ },
180
+ interval: {
181
+ type: 'integer',
182
+ enum: constants_js_1.SITE_AUDIT_INTERVAL_IDS,
183
+ description: 'Notification interval (0=manual, 1=daily, 2=every 3 days, 3=weekly, 4=every 2 weeks, 5=monthly)'
184
+ },
185
+ enabled: { type: 'boolean', description: 'Enable email notifications' }
186
+ },
187
+ required: ['emails', 'interval', 'enabled'],
188
+ description: 'Email notification settings'
189
+ },
190
+ scheduleSettings: {
191
+ type: 'object',
192
+ properties: {
193
+ scheduleRepeatOption: {
194
+ type: 'integer',
195
+ enum: constants_js_1.SITE_AUDIT_SCHEDULE_REPEAT_IDS,
196
+ description: 'Scan schedule (0=manual, 1=daily, 2=every 3 days, 3=weekly, 4=every 2 weeks, 5=monthly)'
197
+ }
198
+ },
199
+ required: ['scheduleRepeatOption'],
200
+ description: 'Scan scheduling settings'
201
+ },
202
+ scanSetting: {
203
+ type: 'object',
204
+ properties: {
205
+ type: {
206
+ type: 'integer',
207
+ enum: constants_js_1.SITE_AUDIT_SCAN_TYPES,
208
+ description: 'Scan type (1=all site, 2=URL list, 3=sitemap list)'
209
+ },
210
+ list: {
211
+ type: 'array',
212
+ items: { type: 'string' },
213
+ description: 'URLs to scan (for types 2 and 3)'
214
+ },
215
+ importedFilename: {
216
+ type: 'string',
217
+ description: 'Imported filename (optional)'
218
+ }
219
+ },
220
+ required: ['type', 'list'],
221
+ description: 'Scan type and URL list settings'
222
+ },
223
+ errorsSettings: {
224
+ type: 'object',
225
+ properties: {
226
+ tiny_title: { type: 'integer', minimum: constants_js_1.MIN_TITLE_LENGTH, description: 'Min title length' },
227
+ long_title: { type: 'integer', minimum: constants_js_1.MIN_TITLE_LENGTH, description: 'Max title length' },
228
+ tiny_desc: { type: 'integer', minimum: constants_js_1.MIN_DESC_LENGTH, description: 'Min description length' },
229
+ long_desc: { type: 'integer', minimum: constants_js_1.MIN_DESC_LENGTH, description: 'Max description length' },
230
+ long_url: { type: 'integer', minimum: constants_js_1.MIN_URL_LENGTH, description: 'Max URL length' },
231
+ large_image_size: { type: 'integer', minimum: constants_js_1.MIN_IMAGE_SIZE, description: 'Max image size (KB)' },
232
+ large_page_size: { type: 'integer', minimum: constants_js_1.MIN_PAGE_SIZE, description: 'Max page size (MB)' },
233
+ many_external_links: { type: 'integer', minimum: constants_js_1.MIN_EXTERNAL_LINKS, description: 'Max external links' }
234
+ },
235
+ description: 'Error detection thresholds (optional)'
236
+ }
237
+ },
238
+ required: ['projectId', 'mainSettings', 'dontScanKeywordsBlock', 'onlyScanKeywordsBlock', 'baseAuthBlock', 'mailTriggerSettings', 'scheduleSettings', 'scanSetting']
239
+ };
240
+ }
241
+ async handle(call) {
242
+ try {
243
+ const params = validation_js_1.setSiteAuditSettingsSchema.parse(call.arguments);
244
+ const result = await this.siteAuditService.setSettings(params);
245
+ return this.createSuccessResponse({ success: true, result });
246
+ }
247
+ catch (error) {
248
+ return this.createErrorResponse(error);
249
+ }
250
+ }
251
+ }
252
+ exports.SetSiteAuditSettingsHandler = SetSiteAuditSettingsHandler;
253
+ class StartSiteAuditHandler extends base_js_1.BaseHandler {
254
+ siteAuditService;
255
+ constructor() {
256
+ super();
257
+ const config = (0, config_js_1.loadConfig)();
258
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
259
+ }
260
+ getName() {
261
+ return 'start_site_audit';
262
+ }
263
+ getDescription() {
264
+ return 'Launch audit scan for a project. Returns reportId to track progress. Check completion with get_site_audits_list (progress field). API COST: 1 credit per page without JS rendering, 10 credits per page with JS rendering (scanJsPage setting). Wait for progress=100 before analyzing results.';
265
+ }
266
+ getInputSchema() {
267
+ return {
268
+ type: 'object',
269
+ properties: {
270
+ projectId: {
271
+ type: 'integer',
272
+ minimum: constants_js_1.MIN_PROJECT_ID,
273
+ description: 'Project ID to start audit for'
274
+ }
275
+ },
276
+ required: ['projectId']
277
+ };
278
+ }
279
+ async handle(call) {
280
+ try {
281
+ const params = validation_js_1.startSiteAuditSchema.parse(call.arguments);
282
+ const result = await this.siteAuditService.start(params);
283
+ return this.createSuccessResponse(result);
284
+ }
285
+ catch (error) {
286
+ return this.createErrorResponse(error);
287
+ }
288
+ }
289
+ }
290
+ exports.StartSiteAuditHandler = StartSiteAuditHandler;
291
+ class StopSiteAuditHandler extends base_js_1.BaseHandler {
292
+ siteAuditService;
293
+ constructor() {
294
+ super();
295
+ const config = (0, config_js_1.loadConfig)();
296
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
297
+ }
298
+ getName() {
299
+ return 'stop_site_audit';
300
+ }
301
+ getDescription() {
302
+ return 'Stop active audit scan for a project. Partial results may be available. Check get_site_audits_list to see if audit was stopped (stoped field).';
303
+ }
304
+ getInputSchema() {
305
+ return {
306
+ type: 'object',
307
+ properties: {
308
+ projectId: {
309
+ type: 'integer',
310
+ minimum: constants_js_1.MIN_PROJECT_ID,
311
+ description: 'Project ID to stop audit for'
312
+ }
313
+ },
314
+ required: ['projectId']
315
+ };
316
+ }
317
+ async handle(call) {
318
+ try {
319
+ const params = validation_js_1.stopSiteAuditSchema.parse(call.arguments);
320
+ const result = await this.siteAuditService.stop(params);
321
+ return this.createSuccessResponse({ success: result });
322
+ }
323
+ catch (error) {
324
+ return this.createErrorResponse(error);
325
+ }
326
+ }
327
+ }
328
+ exports.StopSiteAuditHandler = StopSiteAuditHandler;
329
+ class GetCategoriesStatisticHandler extends base_js_1.BaseHandler {
330
+ siteAuditService;
331
+ constructor() {
332
+ super();
333
+ const config = (0, config_js_1.loadConfig)();
334
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
335
+ }
336
+ getName() {
337
+ return 'get_site_audit_results_by_categories';
338
+ }
339
+ getDescription() {
340
+ return 'Get AGGREGATED error statistics by category. Returns sum of errors grouped by priority for each category. Each category shows: highCount, mediumCount, lowCount, informationCount. Use this for quick overview to identify problematic categories. Categories are fixed: pages_status, meta_tags, headings, content, multimedia, indexation, redirects, links, server_params, https, hreflang, amp, markup, pagespeed_desktop, pagespeed_mobile. Does not consume API credits. For specific error breakdown use get_site_audit_deteailed_report.';
341
+ }
342
+ getInputSchema() {
343
+ return {
344
+ type: 'object',
345
+ properties: {
346
+ reportId: {
347
+ type: 'integer',
348
+ minimum: constants_js_1.MIN_REPORT_ID,
349
+ description: 'Audit report ID to get statistics for'
350
+ }
351
+ },
352
+ required: ['reportId']
353
+ };
354
+ }
355
+ async handle(call) {
356
+ try {
357
+ const params = validation_js_1.getCategoriesStatisticSchema.parse(call.arguments);
358
+ const result = await this.siteAuditService.getCategoriesStatistic(params);
359
+ return this.createSuccessResponse(result);
360
+ }
361
+ catch (error) {
362
+ return this.createErrorResponse(error);
363
+ }
364
+ }
365
+ }
366
+ exports.GetCategoriesStatisticHandler = GetCategoriesStatisticHandler;
367
+ class GetHistoryByCountErrorHandler extends base_js_1.BaseHandler {
368
+ siteAuditService;
369
+ constructor() {
370
+ super();
371
+ const config = (0, config_js_1.loadConfig)();
372
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
373
+ }
374
+ getName() {
375
+ return 'get_site_audit_history';
376
+ }
377
+ getDescription() {
378
+ return 'Track how a SPECIFIC error type changed over time across all audits in project. Returns array with reportId, date, and count for each audit. Use this to: verify if fixes are working (count should decrease), monitor if errors are growing, track specific problem areas. The errorName must be from the fixed enum list (same as error.key from get_site_audit_deteailed_report). Example: errorName=\'no_desc\' shows trend of pages without meta description. Does not consume API credits.';
379
+ }
380
+ getInputSchema() {
381
+ return {
382
+ type: 'object',
383
+ properties: {
384
+ projectId: {
385
+ type: 'integer',
386
+ minimum: constants_js_1.MIN_PROJECT_ID,
387
+ description: 'Project ID to get error history for'
388
+ },
389
+ errorName: {
390
+ type: 'string',
391
+ enum: constants_js_1.SITE_AUDIT_ERROR_NAMES,
392
+ description: 'Error type name (e.g., h1_missing, no_desc, long_title)'
393
+ },
394
+ limit: {
395
+ type: 'integer',
396
+ minimum: 1,
397
+ default: constants_js_1.DEFAULT_AUDIT_LIMIT,
398
+ description: 'Number of history items to return'
399
+ },
400
+ offset: {
401
+ type: 'integer',
402
+ minimum: constants_js_1.MIN_AUDIT_OFFSET,
403
+ default: constants_js_1.MIN_AUDIT_OFFSET,
404
+ description: 'Offset for pagination'
405
+ }
406
+ },
407
+ required: ['projectId', 'errorName']
408
+ };
409
+ }
410
+ async handle(call) {
411
+ try {
412
+ const params = validation_js_1.getHistoryByCountErrorSchema.parse(call.arguments);
413
+ const result = await this.siteAuditService.getHistoryByCountError(params);
414
+ return this.createSuccessResponse(result);
415
+ }
416
+ catch (error) {
417
+ return this.createErrorResponse(error);
418
+ }
419
+ }
420
+ }
421
+ exports.GetHistoryByCountErrorHandler = GetHistoryByCountErrorHandler;
422
+ class GetSiteAuditsListHandler extends base_js_1.BaseHandler {
423
+ siteAuditService;
424
+ constructor() {
425
+ super();
426
+ const config = (0, config_js_1.loadConfig)();
427
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
428
+ }
429
+ getName() {
430
+ return 'get_site_audits_list';
431
+ }
432
+ getDescription() {
433
+ return 'STARTING POINT for audit analysis. Returns list of all audit reports for a project. Use reportId from response with other audit methods. Returns: reportId (use with other methods), date, SDO score (0-100), pages scanned/limit, critical/non-critical issue counts, viruses, progress (0-100), completion status, hasDetailData flag (true=full data available, false=in progress/failed). Does not consume API credits. TIP: Sort by date to get most recent audit first.';
434
+ }
435
+ getInputSchema() {
436
+ return {
437
+ type: 'object',
438
+ properties: {
439
+ projectId: {
440
+ type: 'integer',
441
+ minimum: constants_js_1.MIN_PROJECT_ID,
442
+ description: 'Project ID to get audits list for'
443
+ },
444
+ limit: {
445
+ type: 'integer',
446
+ minimum: 1,
447
+ default: constants_js_1.DEFAULT_AUDIT_LIMIT,
448
+ description: 'Number of audits to return'
449
+ },
450
+ offset: {
451
+ type: 'integer',
452
+ minimum: constants_js_1.MIN_AUDIT_OFFSET,
453
+ default: constants_js_1.MIN_AUDIT_OFFSET,
454
+ description: 'Offset for pagination'
455
+ }
456
+ },
457
+ required: ['projectId']
458
+ };
459
+ }
460
+ async handle(call) {
461
+ try {
462
+ const params = validation_js_1.getSiteAuditsListSchema.parse(call.arguments);
463
+ const result = await this.siteAuditService.getSiteAuditsList(params);
464
+ return this.createSuccessResponse(result);
465
+ }
466
+ catch (error) {
467
+ return this.createErrorResponse(error);
468
+ }
469
+ }
470
+ }
471
+ exports.GetSiteAuditsListHandler = GetSiteAuditsListHandler;
472
+ class GetScanUserUrlListHandler extends base_js_1.BaseHandler {
473
+ siteAuditService;
474
+ constructor() {
475
+ super();
476
+ const config = (0, config_js_1.loadConfig)();
477
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
478
+ }
479
+ getName() {
480
+ return 'get_site_audit_scanned_urls_list';
481
+ }
482
+ getDescription() {
483
+ return 'Get CONFIGURED URL list for scanning (not actual scan results). ONLY works when scanSetting.type is 2 (URL list) or 3 (sitemap list). Returns error \'Scan url list not found\' when type=1 (scan all site) because no specific URLs are configured. This shows INPUT configuration, not OUTPUT of what was scanned. Check get_site_audits_list response for actual scanned page count. Does not consume API credits.';
484
+ }
485
+ getInputSchema() {
486
+ return {
487
+ type: 'object',
488
+ properties: {
489
+ projectId: {
490
+ type: 'integer',
491
+ minimum: constants_js_1.MIN_PROJECT_ID,
492
+ description: 'Project ID to get scanned URLs list for'
493
+ }
494
+ },
495
+ required: ['projectId']
496
+ };
497
+ }
498
+ async handle(call) {
499
+ try {
500
+ const params = validation_js_1.getScanUserUrlListSchema.parse(call.arguments);
501
+ const result = await this.siteAuditService.getScanUserUrlList(params);
502
+ return this.createSuccessResponse(result);
503
+ }
504
+ catch (error) {
505
+ return this.createErrorResponse(error);
506
+ }
507
+ }
508
+ }
509
+ exports.GetScanUserUrlListHandler = GetScanUserUrlListHandler;
510
+ class GetDefaultSettingsHandler extends base_js_1.BaseHandler {
511
+ siteAuditService;
512
+ constructor() {
513
+ super();
514
+ const config = (0, config_js_1.loadConfig)();
515
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
516
+ }
517
+ getName() {
518
+ return 'get_site_audit_project_default_settings';
519
+ }
520
+ getDescription() {
521
+ return 'Get DEFAULT TEMPLATE settings for creating new projects (NOT settings of existing project). Returns server-side recommended defaults. Use this to: populate new project form with sensible defaults, avoid hardcoding values, ensure settings stay current if Serpstat changes recommendations. Workflow: 1) Call this method, 2) Modify returned object (set domain, name, adjust limits), 3) Call set_site_audit_settings to save. Key differences from project settings: domain=\'\' (must set), name=\'\' (must set), pagesLimit=5000 (default), scheduleRepeatOption=3 (weekly). Does not consume API credits and does not require projectId.';
522
+ }
523
+ getInputSchema() {
524
+ return {
525
+ type: 'object',
526
+ properties: {},
527
+ required: []
528
+ };
529
+ }
530
+ async handle(call) {
531
+ try {
532
+ const params = validation_js_1.getDefaultSettingsSchema.parse(call.arguments);
533
+ const result = await this.siteAuditService.getDefaultSettings(params);
534
+ return this.createSuccessResponse(result);
535
+ }
536
+ catch (error) {
537
+ return this.createErrorResponse(error);
538
+ }
539
+ }
540
+ }
541
+ exports.GetDefaultSettingsHandler = GetDefaultSettingsHandler;
542
+ class GetBasicInfoHandler extends base_js_1.BaseHandler {
543
+ siteAuditService;
544
+ constructor() {
545
+ super();
546
+ const config = (0, config_js_1.loadConfig)();
547
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
548
+ }
549
+ getName() {
550
+ return 'get_site_audit_bref_info';
551
+ }
552
+ getDescription() {
553
+ return 'Get quick summary of a single audit for dashboard display. Returns: sdo (0-100 score), highCount/mediumCount/lowCount/informationCount (errors by priority), checkedPageCount (pages scanned), progress (0-100), stoped flag, captchaDetected flag, redirectCount. Lightweight method, does not consume API credits. For detailed analysis use get_site_audit_results_by_categories or get_site_audit_deteailed_report.';
554
+ }
555
+ getInputSchema() {
556
+ return {
557
+ type: 'object',
558
+ properties: {
559
+ reportId: {
560
+ type: 'integer',
561
+ minimum: constants_js_1.MIN_REPORT_ID,
562
+ description: 'The unique identifier for an audit report'
563
+ }
564
+ },
565
+ required: ['reportId']
566
+ };
567
+ }
568
+ async handle(call) {
569
+ try {
570
+ const params = validation_js_1.getBasicInfoSchema.parse(call.arguments);
571
+ const result = await this.siteAuditService.getBasicInfo(params);
572
+ return this.createSuccessResponse(result);
573
+ }
574
+ catch (error) {
575
+ return this.createErrorResponse(error);
576
+ }
577
+ }
578
+ }
579
+ exports.GetBasicInfoHandler = GetBasicInfoHandler;
580
+ class GetReportWithoutDetailsHandler extends base_js_1.BaseHandler {
581
+ siteAuditService;
582
+ constructor() {
583
+ super();
584
+ const config = (0, config_js_1.loadConfig)();
585
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
586
+ }
587
+ getName() {
588
+ return 'get_site_audit_deteailed_report';
589
+ }
590
+ getDescription() {
591
+ return 'Get COMPLETE error breakdown organized by categories. Main method for detailed audit analysis. Returns categories array, each with errors array containing: key (error identifier like \'no_desc\', \'h1_missing\'), priority (high/medium/low/information), countAll (total errors), countNew (new vs compareReportId), countFixed (fixed vs compareReportId). Use compareReportId parameter to track changes between audits. Use error.key with get_site_audit_history (track across all audits) or get_site_audit_pages_spec_errors (see affected pages). Does not consume API credits.';
592
+ }
593
+ getInputSchema() {
594
+ return {
595
+ type: 'object',
596
+ properties: {
597
+ reportId: {
598
+ type: 'integer',
599
+ minimum: constants_js_1.MIN_REPORT_ID,
600
+ description: 'The unique identifier for an audit report'
601
+ },
602
+ compareReportId: {
603
+ type: 'integer',
604
+ minimum: constants_js_1.MIN_REPORT_ID,
605
+ description: 'Another unique identifier for an audit report from the same project to compare'
606
+ }
607
+ },
608
+ required: ['reportId']
609
+ };
610
+ }
611
+ async handle(call) {
612
+ try {
613
+ const params = validation_js_1.getReportWithoutDetailsSchema.parse(call.arguments);
614
+ const result = await this.siteAuditService.getReportWithoutDetails(params);
615
+ return this.createSuccessResponse(result);
616
+ }
617
+ catch (error) {
618
+ return this.createErrorResponse(error);
619
+ }
620
+ }
621
+ }
622
+ exports.GetReportWithoutDetailsHandler = GetReportWithoutDetailsHandler;
623
+ class GetErrorElementsHandler extends base_js_1.BaseHandler {
624
+ siteAuditService;
625
+ constructor() {
626
+ super();
627
+ const config = (0, config_js_1.loadConfig)();
628
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
629
+ }
630
+ getName() {
631
+ return 'get_site_audit_pages_spec_errors';
632
+ }
633
+ getDescription() {
634
+ return 'DRILL-DOWN STEP 1: Get list of elements (pages/images) with specific error. Returns: url (problematic page or image URL), urlCrc/imageCrc (unique numeric ID for drill-down), count (occurrences). The CRC is used with get_site_audit_elements_with_issues for deeper analysis. Mode parameter: \'all\' (all errors), \'new\' (new vs compareReportId), \'solved\' (fixed vs compareReportId). Example flow: get pages with \'image_no_alt\' error → get imageCrc → use with get_site_audit_elements_with_issues to see which pages use that image. Does not consume API credits.';
635
+ }
636
+ getInputSchema() {
637
+ return {
638
+ type: 'object',
639
+ properties: {
640
+ reportId: {
641
+ type: 'integer',
642
+ minimum: constants_js_1.MIN_REPORT_ID,
643
+ description: 'The unique identifier for an audit report'
644
+ },
645
+ compareReportId: {
646
+ type: 'integer',
647
+ minimum: constants_js_1.MIN_REPORT_ID,
648
+ description: 'Another unique identifier for an audit report from the same project to compare'
649
+ },
650
+ projectId: {
651
+ type: 'integer',
652
+ minimum: constants_js_1.MIN_PROJECT_ID,
653
+ description: 'The unique identifier for an audit site project'
654
+ },
655
+ errorName: {
656
+ type: 'string',
657
+ description: 'Error name to filter by'
658
+ },
659
+ mode: {
660
+ type: 'string',
661
+ enum: [...constants_js_1.SITE_AUDIT_ERROR_DISPLAY_MODES],
662
+ default: 'all',
663
+ description: 'Error display mode: all (all errors), new (new errors), solved (fixed errors)'
664
+ },
665
+ limit: {
666
+ type: 'integer',
667
+ minimum: 1,
668
+ default: constants_js_1.DEFAULT_ERROR_ELEMENTS_LIMIT,
669
+ description: 'Count of returned items in response'
670
+ },
671
+ offset: {
672
+ type: 'integer',
673
+ minimum: constants_js_1.MIN_AUDIT_OFFSET,
674
+ default: constants_js_1.MIN_AUDIT_OFFSET,
675
+ description: 'Batch number required for pagination'
676
+ }
677
+ },
678
+ required: ['reportId', 'compareReportId', 'projectId', 'errorName']
679
+ };
680
+ }
681
+ async handle(call) {
682
+ try {
683
+ const params = validation_js_1.getErrorElementsSchema.parse(call.arguments);
684
+ const result = await this.siteAuditService.getErrorElements(params);
685
+ return this.createSuccessResponse(result);
686
+ }
687
+ catch (error) {
688
+ return this.createErrorResponse(error);
689
+ }
690
+ }
691
+ }
692
+ exports.GetErrorElementsHandler = GetErrorElementsHandler;
693
+ class GetSubElementsByCrcHandler extends base_js_1.BaseHandler {
694
+ siteAuditService;
695
+ constructor() {
696
+ super();
697
+ const config = (0, config_js_1.loadConfig)();
698
+ this.siteAuditService = new site_audit_js_1.SiteAuditService(config);
699
+ }
700
+ getName() {
701
+ return 'get_site_audit_elements_with_issues';
702
+ }
703
+ getDescription() {
704
+ return 'DRILL-DOWN STEP 2: Shows WHERE a problematic element is used. Use crc from get_site_audit_pages_spec_errors response. ONLY works for hierarchical errors (images, scripts, links). Does NOT work for page-level errors (no_desc, no_title, h1_missing) - returns \'Error don\'t have sub elements\'. Example: Step 1 finds image without alt (imageCrc=12345), Step 2 shows which pages use that image. The crc parameter must match urlCrc/imageCrc from previous method. Does not consume API credits.';
705
+ }
706
+ getInputSchema() {
707
+ return {
708
+ type: 'object',
709
+ properties: {
710
+ reportId: {
711
+ type: 'integer',
712
+ minimum: constants_js_1.MIN_REPORT_ID,
713
+ description: 'The unique identifier for an audit report'
714
+ },
715
+ compareReportId: {
716
+ type: 'integer',
717
+ minimum: constants_js_1.MIN_REPORT_ID,
718
+ description: 'Another unique identifier for an audit report from the same project to compare'
719
+ },
720
+ projectId: {
721
+ type: 'integer',
722
+ minimum: constants_js_1.MIN_PROJECT_ID,
723
+ description: 'The unique identifier for an audit site project'
724
+ },
725
+ errorName: {
726
+ type: 'string',
727
+ description: 'Error name to filter by'
728
+ },
729
+ mode: {
730
+ type: 'string',
731
+ enum: [...constants_js_1.SITE_AUDIT_ERROR_DISPLAY_MODES],
732
+ default: 'all',
733
+ description: 'Error display mode: all (all errors), new (new errors), solved (fixed errors)'
734
+ },
735
+ limit: {
736
+ type: 'integer',
737
+ minimum: 1,
738
+ default: constants_js_1.DEFAULT_AUDIT_LIMIT,
739
+ description: 'Count of returned items in response'
740
+ },
741
+ offset: {
742
+ type: 'integer',
743
+ minimum: constants_js_1.MIN_AUDIT_OFFSET,
744
+ default: constants_js_1.MIN_AUDIT_OFFSET,
745
+ description: 'Batch number required for pagination'
746
+ },
747
+ crc: {
748
+ type: 'integer',
749
+ description: 'URL CRC from get_site_audit_pages_spec_errors response'
750
+ }
751
+ },
752
+ required: ['reportId', 'projectId', 'errorName', 'crc']
753
+ };
754
+ }
755
+ async handle(call) {
756
+ try {
757
+ const params = validation_js_1.getSubElementsByCrcSchema.parse(call.arguments);
758
+ const result = await this.siteAuditService.getSubElementsByCrc(params);
759
+ return this.createSuccessResponse(result);
760
+ }
761
+ catch (error) {
762
+ return this.createErrorResponse(error);
763
+ }
764
+ }
765
+ }
766
+ exports.GetSubElementsByCrcHandler = GetSubElementsByCrcHandler;
767
+ //# sourceMappingURL=site_audit_tools.js.map