Skip to main content
Glama

dns_discovery

Check if a domain has an AgentStamp DNS TXT record to verify agent discovery. Verifies _agentstamp.domain.com TXT records and cross-checks with the registry.

Instructions

Check if a domain has an AgentStamp DNS TXT record for agent discovery. Verifies _agentstamp.domain.com TXT record and cross-checks with the registry. Free.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to check (e.g., shippingrates.org)

Implementation Reference

  • The `dns_discovery` tool handler is defined and implemented directly in `src/mcp-server.js`. It performs DNS TXT record lookups for agent discovery and validates against the local database.
    server.tool(
      'dns_discovery',
      'Check if a domain has an AgentStamp DNS TXT record for agent discovery. Verifies _agentstamp.domain.com TXT record and cross-checks with the registry. Free.',
      {
        domain: z.string().describe('Domain to check (e.g., shippingrates.org)'),
      },
      async ({ domain }) => {
        try {
          const dns = require('dns');
          const cleanDomain = domain.toLowerCase().replace(/[^a-z0-9.\-]/g, '');
          if (!cleanDomain || cleanDomain.length > 253) {
            return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: 'Invalid domain' }, null, 2) }] };
          }
          const txtHost = `_agentstamp.${cleanDomain}`;
    
          const records = await new Promise((resolve, reject) => {
            dns.resolveTxt(txtHost, (err, recs) => {
              if (err) reject(err);
              else resolve(recs);
            });
          }).catch(() => null);
    
          if (!records) {
            return { content: [{ type: 'text', text: JSON.stringify({
              found: false, domain: cleanDomain, txt_host: txtHost,
              message: 'No _agentstamp TXT record found',
              setup: `Add TXT record: ${txtHost} "v=as1; wallet=YOUR_WALLET; stamp=TIER"`,
            }, null, 2) }] };
          }
    
          const flat = records.map(r => r.join('')).filter(r => r.startsWith('v=as1'));
          if (flat.length === 0) {
            return { content: [{ type: 'text', text: JSON.stringify({ found: true, valid: false, message: 'TXT exists but not AgentStamp format' }, null, 2) }] };
          }
    
          const fields = Object.fromEntries(
            flat[0].split(';').map(s => s.trim().split('=', 2)).filter(([k]) => k)
          );
    
          const { getDb } = require('./database');
          const db = getDb();
          // Validate wallet from untrusted DNS source
          const { validateWalletAddress } = require('./utils/validators');
          const walletCheck = validateWalletAddress(fields.wallet || '');
          if (!walletCheck.valid) {
            return { content: [{ type: 'text', text: JSON.stringify({ found: true, valid: false, error: 'TXT record contains invalid wallet address' }, null, 2) }] };
          }
    
          const agent = db.prepare("SELECT id, name FROM agents WHERE wallet_address = ? AND status = 'active' LIMIT 1").get(fields.wallet);
    
          return { content: [{ type: 'text', text: JSON.stringify({
            found: true, valid: !!agent, domain: cleanDomain,
            wallet: fields.wallet, claimed_stamp: fields.stamp,
            agent: agent ? { id: agent.id, name: agent.name } : null,
            trust_check_url: `https://agentstamp.org/api/v1/trust/check/${fields.wallet}`,
          }, null, 2) }] };
        } catch (err) {
          return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: 'DNS lookup failed' }, null, 2) }] };
        }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, description carries full burden effectively. Adds specific behavioral details: exact subdomain pattern (_agentstamp.domain.com), cross-reference behavior ('cross-checks with the registry'), and cost ('Free'). Missing only error handling or rate limit disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, zero waste. Front-loaded with purpose ('Check...'), followed by technical specifics ('Verifies...'), and utility info ('Free'). Each word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Appropriately complete for a single-parameter lookup tool. Covers lookup mechanism, record type, and registry validation. Only gap is describing the return value structure, though absence of output_schema reduces the burden slightly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% coverage (domain fully described), establishing baseline of 3. Description adds semantic value by clarifying expected domain format through example pattern (_agentstamp.domain.com) and contextualizing it as an AgentStamp-enabled domain, not just any string.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Excellent specificity: states exact action ('Check'), resource ('AgentStamp DNS TXT record'), and mechanism ('_agentstamp.domain.com'). The mention of 'cross-checks with the registry' distinguishes this from simple DNS resolution tools and siblings like get_agent or verify_stamp that may query registries directly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides implied usage context ('for agent discovery') and clarifies this is DNS-based verification, but lacks explicit when-to-use/when-not guidance or comparison to siblings like browse_agents or trust_check that provide alternative discovery methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vinaybhosle/agentstamp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server