@disruptorganic/mcp-google-search-console 1.0.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.
- package/.env.example +141 -0
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth2.d.ts +31 -0
- package/dist/auth/oauth2.d.ts.map +1 -0
- package/dist/auth/oauth2.js +380 -0
- package/dist/auth/oauth2.js.map +1 -0
- package/dist/config/index.d.ts +36 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +87 -0
- package/dist/config/index.js.map +1 -0
- package/dist/gsc/client.d.ts +72 -0
- package/dist/gsc/client.d.ts.map +1 -0
- package/dist/gsc/client.js +243 -0
- package/dist/gsc/client.js.map +1 -0
- package/dist/gsc/index.d.ts +3 -0
- package/dist/gsc/index.d.ts.map +1 -0
- package/dist/gsc/index.js +3 -0
- package/dist/gsc/index.js.map +1 -0
- package/dist/gsc/properties.d.ts +42 -0
- package/dist/gsc/properties.d.ts.map +1 -0
- package/dist/gsc/properties.js +393 -0
- package/dist/gsc/properties.js.map +1 -0
- package/dist/gsc/queries.d.ts +73 -0
- package/dist/gsc/queries.d.ts.map +1 -0
- package/dist/gsc/queries.js +390 -0
- package/dist/gsc/queries.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +186 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/compare-date-ranges.d.ts +83 -0
- package/dist/tools/compare-date-ranges.d.ts.map +1 -0
- package/dist/tools/compare-date-ranges.js +462 -0
- package/dist/tools/compare-date-ranges.js.map +1 -0
- package/dist/tools/get-property-info.d.ts +30 -0
- package/dist/tools/get-property-info.d.ts.map +1 -0
- package/dist/tools/get-property-info.js +174 -0
- package/dist/tools/get-property-info.js.map +1 -0
- package/dist/tools/get-top-pages.d.ts +103 -0
- package/dist/tools/get-top-pages.d.ts.map +1 -0
- package/dist/tools/get-top-pages.js +254 -0
- package/dist/tools/get-top-pages.js.map +1 -0
- package/dist/tools/get-top-queries.d.ts +103 -0
- package/dist/tools/get-top-queries.d.ts.map +1 -0
- package/dist/tools/get-top-queries.js +254 -0
- package/dist/tools/get-top-queries.js.map +1 -0
- package/dist/tools/health-check.d.ts +12 -0
- package/dist/tools/health-check.d.ts.map +1 -0
- package/dist/tools/health-check.js +107 -0
- package/dist/tools/health-check.js.map +1 -0
- package/dist/tools/index.d.ts +1124 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +70 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-properties.d.ts +50 -0
- package/dist/tools/list-properties.d.ts.map +1 -0
- package/dist/tools/list-properties.js +234 -0
- package/dist/tools/list-properties.js.map +1 -0
- package/dist/tools/query-advanced.d.ts +109 -0
- package/dist/tools/query-advanced.d.ts.map +1 -0
- package/dist/tools/query-advanced.js +378 -0
- package/dist/tools/query-advanced.js.map +1 -0
- package/dist/tools/query-by-keyword.d.ts +115 -0
- package/dist/tools/query-by-keyword.d.ts.map +1 -0
- package/dist/tools/query-by-keyword.js +339 -0
- package/dist/tools/query-by-keyword.js.map +1 -0
- package/dist/tools/query-by-url.d.ts +116 -0
- package/dist/tools/query-by-url.d.ts.map +1 -0
- package/dist/tools/query-by-url.js +366 -0
- package/dist/tools/query-by-url.js.map +1 -0
- package/dist/utils/cache.d.ts +22 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +75 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +15 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/metrics.d.ts +9 -0
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/utils/metrics.js +54 -0
- package/dist/utils/metrics.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +24 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +175 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/token-estimator.d.ts +33 -0
- package/dist/utils/token-estimator.d.ts.map +1 -0
- package/dist/utils/token-estimator.js +226 -0
- package/dist/utils/token-estimator.js.map +1 -0
- package/dist/utils/types.d.ts +68 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +13 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/validators.d.ts +579 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +358 -0
- package/dist/utils/validators.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAuDA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,YAAY,IAAI,0BAA0B,GAChD,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,YAAY,IAAI,0BAA0B,GAChD,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,IAAI,sBAAsB,GAC5C,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,KAAK,YAAY,IAAI,uBAAuB,GAC7C,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,YAAY,IAAI,yBAAyB,G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|
1
|
+
export { listPropertiesTool, handleListProperties, ListPropertiesSchema, } from './list-properties.js';
|
|
2
|
+
export { queryByKeywordTool, handleQueryByKeyword, QueryByKeywordSchema, } from './query-by-keyword.js';
|
|
3
|
+
export { queryByUrlTool, handleQueryByUrl, QueryByUrlSchema, } from './query-by-url.js';
|
|
4
|
+
export { healthCheckTool, handleHealthCheck, } from './health-check.js';
|
|
5
|
+
export { queryAdvancedTool, handleQueryAdvanced, } from './query-advanced.js';
|
|
6
|
+
export { getTopQueriesTool, handleGetTopQueries, } from './get-top-queries.js';
|
|
7
|
+
export { getTopPagesTool, handleGetTopPages, } from './get-top-pages.js';
|
|
8
|
+
export { compareDateRangesTool, handleCompareDateRanges, } from './compare-date-ranges.js';
|
|
9
|
+
export { getPropertyInfoTool, handleGetPropertyInfo, } from './get-property-info.js';
|
|
10
|
+
import { listPropertiesTool, handleListProperties } from './list-properties.js';
|
|
11
|
+
import { queryByKeywordTool, handleQueryByKeyword } from './query-by-keyword.js';
|
|
12
|
+
import { queryByUrlTool, handleQueryByUrl } from './query-by-url.js';
|
|
13
|
+
import { healthCheckTool, handleHealthCheck } from './health-check.js';
|
|
14
|
+
import { queryAdvancedTool, handleQueryAdvanced } from './query-advanced.js';
|
|
15
|
+
import { getTopQueriesTool, handleGetTopQueries } from './get-top-queries.js';
|
|
16
|
+
import { getTopPagesTool, handleGetTopPages } from './get-top-pages.js';
|
|
17
|
+
import { compareDateRangesTool, handleCompareDateRanges } from './compare-date-ranges.js';
|
|
18
|
+
import { getPropertyInfoTool, handleGetPropertyInfo } from './get-property-info.js';
|
|
19
|
+
export const allTools = [
|
|
20
|
+
listPropertiesTool,
|
|
21
|
+
queryByKeywordTool,
|
|
22
|
+
queryByUrlTool,
|
|
23
|
+
queryAdvancedTool,
|
|
24
|
+
getTopQueriesTool,
|
|
25
|
+
getTopPagesTool,
|
|
26
|
+
compareDateRangesTool,
|
|
27
|
+
getPropertyInfoTool,
|
|
28
|
+
healthCheckTool,
|
|
29
|
+
];
|
|
30
|
+
export const toolHandlers = {
|
|
31
|
+
list_properties: handleListProperties,
|
|
32
|
+
query_by_keyword: handleQueryByKeyword,
|
|
33
|
+
query_by_url: handleQueryByUrl,
|
|
34
|
+
query_advanced: handleQueryAdvanced,
|
|
35
|
+
get_top_queries: handleGetTopQueries,
|
|
36
|
+
get_top_pages: handleGetTopPages,
|
|
37
|
+
compare_date_ranges: handleCompareDateRanges,
|
|
38
|
+
get_property_info: handleGetPropertyInfo,
|
|
39
|
+
health_check: handleHealthCheck,
|
|
40
|
+
};
|
|
41
|
+
export function getToolByName(name) {
|
|
42
|
+
return allTools.find(tool => tool.name === name);
|
|
43
|
+
}
|
|
44
|
+
export function getToolHandler(name) {
|
|
45
|
+
return toolHandlers[name];
|
|
46
|
+
}
|
|
47
|
+
export function hasToolHandler(name) {
|
|
48
|
+
return name in toolHandlers;
|
|
49
|
+
}
|
|
50
|
+
export function getToolNames() {
|
|
51
|
+
return Object.keys(toolHandlers);
|
|
52
|
+
}
|
|
53
|
+
export function getToolStats() {
|
|
54
|
+
return {
|
|
55
|
+
total: allTools.length,
|
|
56
|
+
names: getToolNames(),
|
|
57
|
+
tools: allTools.map(tool => {
|
|
58
|
+
const requiredParams = tool.inputSchema.required || [];
|
|
59
|
+
const allParams = Object.keys(tool.inputSchema.properties || {});
|
|
60
|
+
const optionalParams = allParams.filter(key => !requiredParams.includes(key));
|
|
61
|
+
return {
|
|
62
|
+
name: tool.name,
|
|
63
|
+
description: tool.description,
|
|
64
|
+
requiredParams,
|
|
65
|
+
optionalParams,
|
|
66
|
+
};
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAuDA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,GAGrB,MAAM,sBAAsB,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AE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAE9E,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,cAAc;gBACd,cAAc;aACf,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GSCClient } from '../gsc/client.js';
|
|
3
|
+
export interface ToolResponse {
|
|
4
|
+
content: Array<{
|
|
5
|
+
type: 'text';
|
|
6
|
+
text: string;
|
|
7
|
+
}>;
|
|
8
|
+
isError?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const ListPropertiesSchema: z.ZodObject<{
|
|
11
|
+
forceRefresh: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
12
|
+
groupByType: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
13
|
+
includeMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
forceRefresh: boolean;
|
|
16
|
+
groupByType: boolean;
|
|
17
|
+
includeMetadata: boolean;
|
|
18
|
+
}, {
|
|
19
|
+
forceRefresh?: boolean | undefined;
|
|
20
|
+
groupByType?: boolean | undefined;
|
|
21
|
+
includeMetadata?: boolean | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export type ListPropertiesParams = z.infer<typeof ListPropertiesSchema>;
|
|
24
|
+
export declare const listPropertiesTool: {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: string;
|
|
29
|
+
properties: {
|
|
30
|
+
forceRefresh: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
groupByType: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
includeMetadata: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
required: never[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function handleListProperties(params: any, client: GSCClient): Promise<ToolResponse>;
|
|
50
|
+
//# sourceMappingURL=list-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-properties.d.ts","sourceRoot":"","sources":["../../src/tools/list-properties.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAY7C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAWD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAe/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAcxE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;CAwB9B,CAAC;AAgNF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,YAAY,CAAC,CAkJvB"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { listProperties, groupPropertiesByType } from '../gsc/properties.js';
|
|
3
|
+
import { propertyCache, CACHE_KEYS } from '../utils/cache.js';
|
|
4
|
+
import { logger } from '../utils/logger.js';
|
|
5
|
+
export const ListPropertiesSchema = z.object({
|
|
6
|
+
forceRefresh: z.boolean()
|
|
7
|
+
.optional()
|
|
8
|
+
.default(false)
|
|
9
|
+
.describe('Force refresh from API, bypassing 24h cache (default: false)'),
|
|
10
|
+
groupByType: z.boolean()
|
|
11
|
+
.optional()
|
|
12
|
+
.default(true)
|
|
13
|
+
.describe('Group properties by type (domain vs url_prefix) for better organization (default: true)'),
|
|
14
|
+
includeMetadata: z.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.default(true)
|
|
17
|
+
.describe('Include cache statistics, property counts, and usage recommendations (default: true)'),
|
|
18
|
+
});
|
|
19
|
+
export const listPropertiesTool = {
|
|
20
|
+
name: 'list_properties',
|
|
21
|
+
description: 'Lists all Google Search Console properties accessible to the authenticated account. Returns domain properties (sc-domain:*) and URL prefix properties (https://*, http://*). MUST be called before any query tool to identify the correct property identifier. Prefer domain properties over URL prefix when both exist for the same site, as domain properties provide more comprehensive data covering all protocols and subdomains. Results are cached for 24 hours by default.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
forceRefresh: {
|
|
26
|
+
type: 'boolean',
|
|
27
|
+
description: 'Force refresh from API, bypassing 24h cache (default: false)',
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
groupByType: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
description: 'Group properties by type (domain vs url_prefix) for better organization (default: true)',
|
|
33
|
+
default: true,
|
|
34
|
+
},
|
|
35
|
+
includeMetadata: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
description: 'Include cache statistics, property counts, and usage recommendations (default: true)',
|
|
38
|
+
default: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
required: [],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
function formatDuration(seconds) {
|
|
45
|
+
if (seconds < 0) {
|
|
46
|
+
return '0 seconds';
|
|
47
|
+
}
|
|
48
|
+
const hours = Math.floor(seconds / 3600);
|
|
49
|
+
const minutes = Math.floor((seconds % 3600) / 60);
|
|
50
|
+
const secs = Math.floor(seconds % 60);
|
|
51
|
+
if (hours > 0) {
|
|
52
|
+
if (minutes > 0) {
|
|
53
|
+
return `${hours} hour${hours !== 1 ? 's' : ''}, ${minutes} minute${minutes !== 1 ? 's' : ''}`;
|
|
54
|
+
}
|
|
55
|
+
return `${hours} hour${hours !== 1 ? 's' : ''}`;
|
|
56
|
+
}
|
|
57
|
+
if (minutes > 0) {
|
|
58
|
+
return `${minutes} minute${minutes !== 1 ? 's' : ''}`;
|
|
59
|
+
}
|
|
60
|
+
return `${secs} second${secs !== 1 ? 's' : ''}`;
|
|
61
|
+
}
|
|
62
|
+
function generateRecommendation(grouped) {
|
|
63
|
+
const { counts } = grouped;
|
|
64
|
+
if (counts.domain > 0 && counts.url_prefix > 0) {
|
|
65
|
+
return 'Multiple property types found. Prefer domain properties (sc-domain:*) as they provide more comprehensive data covering all protocols and subdomains. URL prefix properties only cover specific protocol and path combinations.';
|
|
66
|
+
}
|
|
67
|
+
if (counts.domain > 0) {
|
|
68
|
+
return 'Domain properties found. These provide comprehensive coverage across all protocols (HTTP/HTTPS) and subdomains. Use these property identifiers for query tools.';
|
|
69
|
+
}
|
|
70
|
+
if (counts.url_prefix > 0) {
|
|
71
|
+
return 'URL prefix properties found. Note: these only cover specific protocol and path combinations. Consider setting up domain properties in Google Search Console for more comprehensive data.';
|
|
72
|
+
}
|
|
73
|
+
return 'No properties found. Ensure your Google account has access to at least one Search Console property. Visit https://search.google.com/search-console to add properties.';
|
|
74
|
+
}
|
|
75
|
+
function getCacheMetadata(forceRefresh) {
|
|
76
|
+
const cacheKey = CACHE_KEYS.PROPERTIES;
|
|
77
|
+
if (forceRefresh) {
|
|
78
|
+
return {
|
|
79
|
+
cacheStatus: 'bypassed',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const hasCached = propertyCache.has(cacheKey);
|
|
83
|
+
if (!hasCached) {
|
|
84
|
+
return {
|
|
85
|
+
cacheStatus: 'miss',
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const ttlMs = propertyCache.getTtl(cacheKey);
|
|
89
|
+
const ttl = ttlMs ? Math.floor(ttlMs / 1000) : undefined;
|
|
90
|
+
const maxTtl = 86400;
|
|
91
|
+
const age = ttl !== undefined ? maxTtl - ttl : undefined;
|
|
92
|
+
return {
|
|
93
|
+
cacheStatus: 'hit',
|
|
94
|
+
cacheAge: age !== undefined ? formatDuration(age) : undefined,
|
|
95
|
+
cacheTtlRemaining: ttl !== undefined ? formatDuration(ttl) : undefined,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function createResponse(properties, params) {
|
|
99
|
+
const { groupByType, includeMetadata, forceRefresh } = params;
|
|
100
|
+
const grouped = groupPropertiesByType(properties);
|
|
101
|
+
const response = {
|
|
102
|
+
properties: groupByType
|
|
103
|
+
? { domain: grouped.domain, url_prefix: grouped.url_prefix }
|
|
104
|
+
: properties,
|
|
105
|
+
counts: groupByType
|
|
106
|
+
? {
|
|
107
|
+
domain: grouped.counts.domain,
|
|
108
|
+
url_prefix: grouped.counts.url_prefix,
|
|
109
|
+
total: grouped.counts.total,
|
|
110
|
+
}
|
|
111
|
+
: { total: properties.length },
|
|
112
|
+
};
|
|
113
|
+
if (includeMetadata) {
|
|
114
|
+
const cacheMetadata = getCacheMetadata(forceRefresh);
|
|
115
|
+
response.metadata = {
|
|
116
|
+
...cacheMetadata,
|
|
117
|
+
recommendation: generateRecommendation(grouped),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return response;
|
|
121
|
+
}
|
|
122
|
+
export async function handleListProperties(params, client) {
|
|
123
|
+
try {
|
|
124
|
+
logger.info('Handling list_properties request', {
|
|
125
|
+
forceRefresh: params.forceRefresh,
|
|
126
|
+
groupByType: params.groupByType,
|
|
127
|
+
includeMetadata: params.includeMetadata,
|
|
128
|
+
});
|
|
129
|
+
const validationResult = ListPropertiesSchema.safeParse(params);
|
|
130
|
+
if (!validationResult.success) {
|
|
131
|
+
const errorMessages = validationResult.error.issues.map(issue => {
|
|
132
|
+
const path = issue.path.length > 0 ? `${issue.path.join('.')}: ` : '';
|
|
133
|
+
return `${path}${issue.message}`;
|
|
134
|
+
}).join('; ');
|
|
135
|
+
logger.error('Input validation failed', {
|
|
136
|
+
errors: errorMessages,
|
|
137
|
+
params,
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
content: [{
|
|
141
|
+
type: 'text',
|
|
142
|
+
text: JSON.stringify({
|
|
143
|
+
error: 'Input validation failed',
|
|
144
|
+
details: errorMessages,
|
|
145
|
+
}, null, 2),
|
|
146
|
+
}],
|
|
147
|
+
isError: true,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const validated = validationResult.data;
|
|
151
|
+
logger.info('Fetching properties', {
|
|
152
|
+
forceRefresh: validated.forceRefresh,
|
|
153
|
+
source: validated.forceRefresh ? 'api' : 'cache-or-api',
|
|
154
|
+
});
|
|
155
|
+
let properties;
|
|
156
|
+
try {
|
|
157
|
+
properties = await listProperties(client, validated.forceRefresh);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
161
|
+
logger.error('Failed to fetch properties', {
|
|
162
|
+
error: errorMessage,
|
|
163
|
+
forceRefresh: validated.forceRefresh,
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
content: [{
|
|
167
|
+
type: 'text',
|
|
168
|
+
text: JSON.stringify({
|
|
169
|
+
error: 'Failed to fetch properties',
|
|
170
|
+
details: errorMessage,
|
|
171
|
+
suggestion: 'Ensure you are authenticated with Google Search Console. Try running the authentication flow again.',
|
|
172
|
+
}, null, 2),
|
|
173
|
+
}],
|
|
174
|
+
isError: true,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (!properties || properties.length === 0) {
|
|
178
|
+
logger.warn('No properties found for this account');
|
|
179
|
+
return {
|
|
180
|
+
content: [{
|
|
181
|
+
type: 'text',
|
|
182
|
+
text: JSON.stringify({
|
|
183
|
+
properties: validated.groupByType
|
|
184
|
+
? { domain: [], url_prefix: [] }
|
|
185
|
+
: [],
|
|
186
|
+
counts: validated.groupByType
|
|
187
|
+
? { domain: 0, url_prefix: 0, total: 0 }
|
|
188
|
+
: { total: 0 },
|
|
189
|
+
metadata: validated.includeMetadata
|
|
190
|
+
? {
|
|
191
|
+
cacheStatus: getCacheMetadata(validated.forceRefresh).cacheStatus,
|
|
192
|
+
recommendation: 'No properties found. Ensure your Google account has access to at least one Search Console property. Visit https://search.google.com/search-console to add properties.',
|
|
193
|
+
}
|
|
194
|
+
: undefined,
|
|
195
|
+
}, null, 2),
|
|
196
|
+
}],
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
const response = createResponse(properties, validated);
|
|
200
|
+
logger.info('Properties listed successfully', {
|
|
201
|
+
total: response.counts.total,
|
|
202
|
+
domain: response.counts.domain,
|
|
203
|
+
url_prefix: response.counts.url_prefix,
|
|
204
|
+
grouped: validated.groupByType,
|
|
205
|
+
cacheStatus: response.metadata?.cacheStatus,
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
content: [{
|
|
209
|
+
type: 'text',
|
|
210
|
+
text: JSON.stringify(response, null, 2),
|
|
211
|
+
}],
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
216
|
+
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
217
|
+
logger.error('Unexpected error in handleListProperties', {
|
|
218
|
+
error: errorMessage,
|
|
219
|
+
stack: errorStack,
|
|
220
|
+
params,
|
|
221
|
+
});
|
|
222
|
+
return {
|
|
223
|
+
content: [{
|
|
224
|
+
type: 'text',
|
|
225
|
+
text: JSON.stringify({
|
|
226
|
+
error: 'Unexpected error occurred',
|
|
227
|
+
details: errorMessage,
|
|
228
|
+
}, null, 2),
|
|
229
|
+
}],
|
|
230
|
+
isError: true,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=list-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-properties.js","sourceRoot":"","sources":["../../src/tools/list-properties.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1G,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AA0B5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;SACtB,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,8DAA8D,CAAC;IAE3E,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;SACrB,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,yFAAyF,CAAC;IAEtG,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;SACzB,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,sFAAsF,CAAC;CACpG,CAAC,CAAC;AAgBH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,odAAod;IACje,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,YAAY,EAAE;gBACZ,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,8DAA8D;gBAC3E,OAAO,EAAE,KAAK;aACf;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,yFAAyF;gBACtG,OAAO,EAAE,IAAI;aACd;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,SAAS;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,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { GSCClient } from '../gsc/client.js';
|
|
2
|
+
export interface ToolResponse {
|
|
3
|
+
content: Array<{
|
|
4
|
+
type: 'text';
|
|
5
|
+
text: string;
|
|
6
|
+
}>;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface AdvancedQueryResultRow {
|
|
10
|
+
[dimension: string]: string | number;
|
|
11
|
+
clicks: number;
|
|
12
|
+
impressions: number;
|
|
13
|
+
ctr: number;
|
|
14
|
+
position: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const queryAdvancedTool: {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: string;
|
|
21
|
+
properties: {
|
|
22
|
+
property: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
startDate: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
pattern: string;
|
|
30
|
+
};
|
|
31
|
+
endDate: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
pattern: string;
|
|
35
|
+
};
|
|
36
|
+
dimensions: {
|
|
37
|
+
type: string;
|
|
38
|
+
items: {
|
|
39
|
+
type: string;
|
|
40
|
+
enum: string[];
|
|
41
|
+
};
|
|
42
|
+
description: string;
|
|
43
|
+
minItems: number;
|
|
44
|
+
maxItems: number;
|
|
45
|
+
};
|
|
46
|
+
filters: {
|
|
47
|
+
type: string;
|
|
48
|
+
items: {
|
|
49
|
+
type: string;
|
|
50
|
+
properties: {
|
|
51
|
+
dimension: {
|
|
52
|
+
type: string;
|
|
53
|
+
enum: string[];
|
|
54
|
+
};
|
|
55
|
+
operator: {
|
|
56
|
+
type: string;
|
|
57
|
+
enum: string[];
|
|
58
|
+
};
|
|
59
|
+
expression: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
required: string[];
|
|
64
|
+
};
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
searchType: {
|
|
68
|
+
type: string;
|
|
69
|
+
enum: string[];
|
|
70
|
+
description: string;
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
73
|
+
rowLimit: {
|
|
74
|
+
type: string;
|
|
75
|
+
description: string;
|
|
76
|
+
minimum: number;
|
|
77
|
+
maximum: number;
|
|
78
|
+
default: number;
|
|
79
|
+
};
|
|
80
|
+
sortBy: {
|
|
81
|
+
type: string;
|
|
82
|
+
enum: string[];
|
|
83
|
+
description: string;
|
|
84
|
+
default: string;
|
|
85
|
+
};
|
|
86
|
+
sortOrder: {
|
|
87
|
+
type: string;
|
|
88
|
+
enum: string[];
|
|
89
|
+
description: string;
|
|
90
|
+
default: string;
|
|
91
|
+
};
|
|
92
|
+
offset: {
|
|
93
|
+
type: string;
|
|
94
|
+
description: string;
|
|
95
|
+
default: number;
|
|
96
|
+
minimum: number;
|
|
97
|
+
};
|
|
98
|
+
limit: {
|
|
99
|
+
type: string;
|
|
100
|
+
description: string;
|
|
101
|
+
minimum: number;
|
|
102
|
+
maximum: number;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
required: string[];
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export declare function handleQueryAdvanced(params: any, client: GSCClient): Promise<ToolResponse>;
|
|
109
|
+
//# sourceMappingURL=query-advanced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-advanced.d.ts","sourceRoot":"","sources":["../../src/tools/query-advanced.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAc7C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAQD,MAAM,WAAW,sBAAsB;IACrC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AAiCD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2F7B,CAAC;AAkNF,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,YAAY,CAAC,CA6SvB"}
|