MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / check

Method check

server/src/services/property-check.ts:82–189  ·  view source on GitHub ↗
(domains: string[])

Source from the content-addressed store, hash-verified

80
81export class PropertyCheckService {
82 async check(domains: string[]): Promise<CheckResult> {
83 const remove: CheckResultRemove[] = [];
84 const modify: CheckResultModify[] = [];
85 const assess: CheckResultAssess[] = [];
86 const ok: CheckResultOk[] = [];
87
88 // Step 1: normalize all inputs, track modifications, deduplicate
89 const canonicalToFirstInput = new Map<string, string>(); // canonical → first input seen
90 const toCheck: string[] = [];
91
92 for (const input of domains) {
93 if (!input || typeof input !== 'string') continue;
94
95 const { canonical, reason } = normalizeDomain(input);
96 if (!canonical) continue;
97
98 if (canonicalToFirstInput.has(canonical)) {
99 remove.push({ input, canonical, reason: 'duplicate' });
100 continue;
101 }
102
103 canonicalToFirstInput.set(canonical, input);
104
105 if (reason !== null) {
106 modify.push({ input, canonical, reason });
107 }
108
109 toCheck.push(canonical);
110 }
111
112 if (toCheck.length === 0) {
113 return {
114 summary: { total: domains.length, remove: remove.length, modify: modify.length, assess: 0, ok: 0 },
115 remove, modify, assess, ok,
116 };
117 }
118
119 // Step 2: batch check against domain classifications
120 const blocked = await domainClassificationsDb.checkDomains(toCheck);
121 const afterBlockedCheck: string[] = [];
122
123 for (const canonical of toCheck) {
124 const blockedEntry = blocked.get(canonical);
125 if (blockedEntry) {
126 remove.push({
127 input: canonicalToFirstInput.get(canonical) ?? canonical,
128 canonical,
129 reason: 'blocked',
130 domain_type: blockedEntry.domain_type,
131 blocked_reason: blockedEntry.reason ?? undefined,
132 });
133 } else {
134 afterBlockedCheck.push(canonical);
135 }
136 }
137
138 if (afterBlockedCheck.length === 0) {
139 return {

Callers 7

runOneInvariantIntoFunction · 0.45
dispatchCallToolFunction · 0.45
invariants.test.tsFile · 0.45

Calls 8

hasMethod · 0.80
checkDomainsMethod · 0.80
normalizeDomainFunction · 0.70
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected