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

Method validate

server/src/validator.ts:40–66  ·  view source on GitHub ↗
(
    domain: string,
    agentUrl: string,
    scope?: AuthorizationScope
  )

Source from the content-addressed store, hash-verified

38 }
39
40 async validate(
41 domain: string,
42 agentUrl: string,
43 scope?: AuthorizationScope
44 ): Promise<AuthorizationResult> {
45 const normalizedDomain = this.normalizeDomain(domain);
46 const normalizedAgentUrl = this.normalizeUrl(agentUrl);
47 const normalizedScope = this.normalizeScope(scope);
48 const cacheKey = JSON.stringify({
49 domain: normalizedDomain,
50 agent_url: normalizedAgentUrl,
51 scope: normalizedScope,
52 });
53 const cached = this.cache.get(cacheKey);
54 if (cached) {
55 return cached;
56 }
57
58 const result = await this.fetchAndValidate(
59 normalizedDomain,
60 agentUrl,
61 normalizedAgentUrl,
62 normalizedScope
63 );
64 this.cache.set(cacheKey, result);
65 return result;
66 }
67
68 private async fetchAndValidate(
69 normalizedDomain: string,

Callers 7

setupRoutesMethod · 0.80
handleToolCallMethod · 0.80
getPropertiesForAgentMethod · 0.80
createAdcpToolHandlersFunction · 0.80
runActionTriggerTestsFunction · 0.80
validator.test.tsFile · 0.80

Calls 6

normalizeDomainMethod · 0.95
normalizeUrlMethod · 0.95
normalizeScopeMethod · 0.95
fetchAndValidateMethod · 0.95
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected