Skip to main content
Glama

branch_authority_status

Read-onlyIdempotent

Query user's constitutional branch authority, view roster of authority holders, or inspect branch violations across legislative, executive, and judicial branches.

Instructions

Colony Layer 4 — Separation of Powers. Query constitutional branch authority for users, view the full roster of authority holders, or inspect branch violations. Three branches: legislative (creates law), executive (executes law), judicial (interprets law).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction: status = user's branches; roster = all holders; violations = violation log
user_idNoUser ID (required for status action)
limitNoMax results (default 50)

Implementation Reference

  • The registerBranchAuthorityTools function registers the 'branch_authority_status' MCP tool, which is the handler for querying constitutional branch authority, roster, and violations. It makes HTTP requests to the GIA Express API based on the action (status, roster, violations).
    export function registerBranchAuthorityTools(server: McpServer, engine: GovernanceEngine): void {
      server.tool(
        'branch_authority_status',
        'Colony Layer 4 — Separation of Powers. Query constitutional branch authority for users, view the full roster of authority holders, or inspect branch violations. Three branches: legislative (creates law), executive (executes law), judicial (interprets law).',
        {
          action: z.enum(['status', 'roster', 'violations']).describe(
            'Action: status = user\'s branches; roster = all holders; violations = violation log'
          ),
          user_id: z.string().optional().describe('User ID (required for status action)'),
          limit: z.number().min(1).max(200).optional().describe('Max results (default 50)'),
        },
        {
          title: 'Branch Authority (Separation of Powers)',
          readOnlyHint: true,
          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.user_id) {
                result = { error: 'user_id required for status action' };
              } else {
                const resp = await fetch(`${apiBase}/api/branch/user/${encodeURIComponent(input.user_id)}`, { headers: authHeaders });
                if (!resp.ok) {
                  const body = await resp.json() as Record<string, unknown>;
                  result = { error: body.error || `HTTP ${resp.status}` };
                } else {
                  result = await resp.json() as Record<string, unknown>;
                }
              }
            } else if (input.action === 'roster') {
              const resp = await fetch(`${apiBase}/api/branch/roster`, { headers: authHeaders });
              if (!resp.ok) {
                const body = await resp.json() as Record<string, unknown>;
                result = { error: body.error || `HTTP ${resp.status}` };
              } else {
                result = await resp.json() as Record<string, unknown>;
              }
            } else if (input.action === 'violations') {
              const limit = input.limit ?? 50;
              const resp = await fetch(`${apiBase}/api/branch/violations?limit=${limit}`, { headers: authHeaders });
              if (!resp.ok) {
                const body = await resp.json() as Record<string, unknown>;
                result = { error: body.error || `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 branch authority — GIA Express API may be unreachable',
              detail: err instanceof Error ? err.message : String(err),
            };
          }
    
          // Telemetry
          engine.telemetryService.emitToolCall('branch_authority_status', `branch-${Date.now().toString(36)}`, 'INFORMATIONAL', true);
    
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
          };
        }
      );
  • Zod schema for the 'branch_authority_status' tool: action (enum: status, roster, violations), optional user_id, optional limit (1-200).
    {
      action: z.enum(['status', 'roster', 'violations']).describe(
        'Action: status = user\'s branches; roster = all holders; violations = violation log'
      ),
      user_id: z.string().optional().describe('User ID (required for status action)'),
      limit: z.number().min(1).max(200).optional().describe('Max results (default 50)'),
    },
  • Registration entry in TOOL_REGISTRY for 'branch_authority_status' with tier 'tenant', linking to registerBranchAuthorityTools.
    { tier: 'tenant', register: registerBranchAuthorityTools, description: 'branch_authority_status (Colony Layer 4 — separation of powers)' },
  • Import statement for the registerBranchAuthorityTools function from the branchAuthority module.
    import { registerBranchAuthorityTools } from './tools/branchAuthority.js';
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds context about the three branches but does not reveal behavioral traits beyond what annotations provide. No contradiction.

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

Conciseness4/5

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

The description is front-loaded with purpose and provides necessary details in 3 sentences. It is efficient but could be slightly more concise. Still good structure.

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?

For a read-only query tool with no output schema, the description covers the actions and branch context well. It lacks return value details but is sufficient given schema richness and annotations.

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

Parameters3/5

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

Schema coverage is 100% with descriptions for each parameter. The description adds context (e.g., explaining branches) but does not add semantic meaning beyond the schema. Baseline 3 is appropriate.

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?

The description clearly states it queries constitutional branch authority, with specific sub-actions (status, roster, violations) and explains the three branches. It distinguishes itself from sibling tools like agent_citizenship_status by its focus on separation of powers.

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 provides clear sub-actions, implying when to use each (e.g., 'status' for user's branches). However, it does not explicitly exclude cases or compare to siblings, leaving some ambiguity on when not to use it.

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