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

Method recordProperty

server/src/federated-index.ts:326–356  ·  view source on GitHub ↗

* Record a property discovered from adagents.json and link it to authorized agents.

(
    property: {
      property_id?: string;
      publisher_domain: string;
      property_type: string;
      name: string;
      identifiers: PropertyIdentifier[];
      tags?: string[];
    },
    agentUrl: string,
    authorizedFor?: string
  )

Source from the content-addressed store, hash-verified

324 * Record a property discovered from adagents.json and link it to authorized agents.
325 */
326 async recordProperty(
327 property: {
328 property_id?: string;
329 publisher_domain: string;
330 property_type: string;
331 name: string;
332 identifiers: PropertyIdentifier[];
333 tags?: string[];
334 },
335 agentUrl: string,
336 authorizedFor?: string
337 ): Promise<void> {
338 // Upsert the property
339 const savedProperty = await this.db.upsertProperty({
340 property_id: property.property_id,
341 publisher_domain: property.publisher_domain,
342 property_type: property.property_type,
343 name: property.name,
344 identifiers: property.identifiers,
345 tags: property.tags,
346 });
347
348 // Link agent to property
349 if (savedProperty.id) {
350 await this.db.upsertAgentPropertyAuthorization({
351 agent_url: agentUrl,
352 property_id: savedProperty.id,
353 authorized_for: authorizedFor,
354 });
355 }
356 }
357
358 /**
359 * Get all properties an agent can sell (from database).

Calls 2

upsertPropertyMethod · 0.80

Tested by

no test coverage detected