Skip to content

Generate agentURI JSON from assessment results #11

Description

@a6b8

Assessment results contain all the data needed to generate a valid ERC-8004 agentURI JSON — the metadata document required for on-chain agent registration. This issue adds a utility that transforms assessment output into a ready-to-register agentURI.

Related: #10 validates existing agentURIs read from on-chain data. This issue generates new agentURIs from assessment results.

Gating Logic

Before generating, the assessment must confirm at least one protocol layer:

Condition Result
MCP valid OR A2A valid Proceed with generation
Neither MCP nor A2A detected Return not-recommended state

JSON Generation from Assessment Results

Map assessment layer results to agentURI fields:

agentURI Field Source
type Fixed: https://eips.ethereum.org/EIPS/eip-8004#registration-v1
services[] Auto-populated from validated layers (MCP endpoint+version, A2A endpoint+version, web URL from HTML layer)
x402Support x402 layer result
active true if HTTP layer confirms reachability
name, description, image Placeholders for user input (returned in editableFields)
registrations[] Empty array (agentId unknown before registration)
supportedTrust Based on available on-chain data from ERC-8004 layer

Data URI Encoding

Provide method to encode the generated JSON as a data URI for tokenURI registration:

  • Standard: data:application/json;base64,...
  • Compressed: data:application/json;enc=gzip;base64,...

Diff Generation (Update Case)

If the ERC-8004 layer shows the agent is already registered, compare the current on-chain agentURI with the newly generated one:

  • Return diff of changes (added/removed services, changed fields)
  • Enable informed decision on whether to update

Three Return States

{ state: 'not-recommended', reason: 'No MCP or A2A detected' }

{ state: 'register', agentURI: {...}, dataURI: '...', editableFields: ['name','description','image'] }

{ state: 'update', agentId, agentURI: {...}, dataURI: '...', diff: [...], editableFields: ['name','description','image'] }

Acceptance Criteria

  • Gating: returns not-recommended when neither MCP nor A2A layer is valid
  • Services array correctly populated from MCP, A2A, and HTML layer results
  • x402Support and active derived from respective layers
  • Data URI encoding produces valid base64 (decodeable back to identical JSON)
  • Diff generation detects added, removed, and changed fields vs on-chain agentURI
  • All three return states implemented with consistent shape
  • Tests cover all three states plus edge cases (MCP-only, A2A-only, both, neither)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions