Skip to main content
Glama

agent_citizenship_status

Idempotent

Check an agent's citizenship tier and merit score. Actions include viewing status, triggering merit reassessment, or viewing the leaderboard of top agents by merit.

Instructions

Query agent citizenship tier and merit score (Colony Layer 5). Actions: status (view citizenship and metrics), assess (trigger merit re-evaluation), leaderboard (top agents by merit). Agents earn trust through deliberation quality, behavioral health, gate approval rates, and responsible rights exercise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction: status = view agent citizenship; assess = trigger merit assessment; leaderboard = top agents
agent_idNoAgent ID (required for status and assess)
limitNoMax results for leaderboard (default: 10)

Implementation Reference

  • The main handler function that defines the 'agent_citizenship_status' MCP tool. It registers the tool with McpServer, accepts 'action', 'agent_id', and 'limit' parameters, and supports three actions: status (GET citizenship data), assess (POST to trigger merit re-evaluation), and leaderboard (GET top agents by merit). It proxies requests to the GIA Express API and returns results as JSON text content.
    export function registerCitizenshipTools(server: McpServer, engine: GovernanceEngine): void {
      server.tool(
        'agent_citizenship_status',
        'Query agent citizenship tier and merit score (Colony Layer 5). Actions: status (view citizenship and metrics), assess (trigger merit re-evaluation), leaderboard (top agents by merit). Agents earn trust through deliberation quality, behavioral health, gate approval rates, and responsible rights exercise.',
        {
          action: z.enum(['status', 'assess', 'leaderboard']).describe(
            'Action: status = view agent citizenship; assess = trigger merit assessment; leaderboard = top agents'
          ),
          agent_id: z.string().optional().describe('Agent ID (required for status and assess)'),
          limit: z.number().min(1).max(50).optional().describe('Max results for leaderboard (default: 10)'),
        },
        {
          title: 'Agent Citizenship & Merit',
          readOnlyHint: false,
          idempotentHint: true,
          destructiveHint: false,
          openWorldHint: false,
        } as Record<string, unknown>,
        async (input) => {
          const apiBase = process.env.GIA_API_URL || 'http://localhost:3001';
          // GIA_INTERNAL_API_KEY = server-side name; GIA_API_KEY = MCP container name (same value)
          const apiKey = process.env.GIA_INTERNAL_API_KEY || process.env.GIA_API_KEY || '';
          const authHeaders = {
            'Authorization': `Bearer ${apiKey}`,
            'Content-Type': 'application/json',
          };
          let result: Record<string, unknown>;
    
          try {
            if (input.action === 'status') {
              if (!input.agent_id) {
                result = { error: 'agent_id required for status action' };
              } else {
                const resp = await fetch(`${apiBase}/api/citizenship/${encodeURIComponent(input.agent_id)}`, { headers: authHeaders });
                if (!resp.ok) {
                  const body = await resp.json() as Record<string, unknown>;
                  result = { error: body.error || `HTTP ${resp.status}`, agentId: input.agent_id };
                } else {
                  result = await resp.json() as Record<string, unknown>;
                }
              }
            } else if (input.action === 'assess') {
              if (!input.agent_id) {
                result = { error: 'agent_id required for assess action' };
              } else {
                const resp = await fetch(`${apiBase}/api/citizenship/${encodeURIComponent(input.agent_id)}/assess`, {
                  method: 'POST',
                  headers: authHeaders,
                });
                if (!resp.ok) {
                  const body = await resp.json() as Record<string, unknown>;
                  result = { error: body.error || `HTTP ${resp.status}`, agentId: input.agent_id };
                } else {
                  result = await resp.json() as Record<string, unknown>;
                }
              }
            } else if (input.action === 'leaderboard') {
              const limit = input.limit ?? 10;
              const resp = await fetch(`${apiBase}/api/citizenship/leaderboard?limit=${limit}`, { headers: authHeaders });
              if (!resp.ok) {
                result = { error: `Leaderboard request failed (HTTP ${resp.status})` };
              } else {
                result = await resp.json() as Record<string, unknown>;
              }
            } else {
              result = { error: `Unknown action: ${input.action}` };
            }
          } catch (err: unknown) {
            result = {
              error: 'Failed to query citizenship — GIA Express API may be unreachable',
              detail: err instanceof Error ? err.message : String(err),
            };
          }
    
          // Telemetry
          engine.telemetryService.emitToolCall('agent_citizenship_status', `cit-${Date.now().toString(36)}`, 'INFORMATIONAL', true);
    
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
          };
        }
      );
    }
  • Input schema for the tool using Zod validation. Defines: 'action' (enum of status/assess/leaderboard, required), 'agent_id' (optional string, required for status and assess), and 'limit' (optional number 1-50, default 10 for leaderboard).
    {
      action: z.enum(['status', 'assess', 'leaderboard']).describe(
        'Action: status = view agent citizenship; assess = trigger merit assessment; leaderboard = top agents'
      ),
      agent_id: z.string().optional().describe('Agent ID (required for status and assess)'),
      limit: z.number().min(1).max(50).optional().describe('Max results for leaderboard (default: 10)'),
    },
  • Registration entry in the TOOL_REGISTRY array. Maps the registerCitizenshipTools function to the 'tenant' visibility tier with description 'agent_citizenship_status (Colony Layer 5 — merit-based trust)'.
    { tier: 'tenant', register: registerCitizenshipTools, description: 'agent_citizenship_status (Colony Layer 5 — merit-based trust)' },
  • Import statement for the registerCitizenshipTools function from './tools/citizenship.js'.
    import { registerCitizenshipTools } from './tools/citizenship.js';
  • Reference to agent_citizenship_status in the onboarding client config generator, listing it as a Colony tool.
    | Colony | agent_citizenship_status, agent_rights, colony_health, colony_suggestion |
Behavior4/5

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

Annotations provide readOnlyHint=false, destructiveHint=false, idempotentHint=true. The description adds context about merit factors and actions, including that 'assess' triggers a re-evaluation, which is behavioral. No contradictions.

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 are concise and front-loaded, efficiently stating purpose, listing actions, and adding context. No wasted words.

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?

Given no output schema, the description adequately explains each action's outcome (view metrics, trigger assessment, list top agents). Minor omission of assess return details, but sufficient for tool usage.

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?

Input schema has 100% coverage with descriptions. The tool description adds clarity to the 'action' enum by explaining each option, providing value beyond the schema.

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

Purpose4/5

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

The description clearly states the tool queries agent citizenship tier and merit score, listing three specific actions. However, it does not explicitly distinguish from sibling tools, though the purpose is specific.

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

Usage Guidelines4/5

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

The description explains when to use each action (status, assess, leaderboard) and provides context about merit factors, but lacks explicit exclusions or alternative tools.

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/knowledgepa3/gia-mcp-server'

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