Skip to main content
Glama

score_governance

Read-onlyIdempotent

Compute a weighted governance score from provided integrity, accuracy, and compliance values, then return pass/fail against configured thresholds.

Instructions

Compute weighted governance score from caller-provided Integrity, Accuracy, and Compliance values (0-1). Returns weighted composite and pass/fail against configured thresholds. Scores are caller-assessed — this tool applies weights and thresholds, not independent evaluation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYesName of the operation being scored
integrityYesData integrity score (0.0-1.0)
accuracyYesFactual accuracy score (0.0-1.0)
complianceYesRegulatory compliance score (0.0-1.0)

Implementation Reference

  • Main handler for the score_governance tool. Registers the tool via server.tool() with a Zod schema (operation, integrity, accuracy, compliance as inputs). The async handler calls engine.scorer.score() to compute a weighted composite score, records to the forensic ledger, emits telemetry, and returns composite/weights/threshold results.
    export function registerScoreGovernanceTool(server: McpServer, engine: GovernanceEngine): void {
      server.tool(
        'score_governance',
        'Compute weighted governance score from caller-provided Integrity, Accuracy, and Compliance values (0-1). Returns weighted composite and pass/fail against configured thresholds. Scores are caller-assessed — this tool applies weights and thresholds, not independent evaluation.',
        {
          operation: z.string().describe('Name of the operation being scored'),
          integrity: z.number().min(0).max(1).describe('Data integrity score (0.0-1.0)'),
          accuracy: z.number().min(0).max(1).describe('Factual accuracy score (0.0-1.0)'),
          compliance: z.number().min(0).max(1).describe('Regulatory compliance score (0.0-1.0)'),
        },
        { title: 'Score Governance', readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false },
        async (input) => {
          // Begin forensic ledger entry
          const entry = engine.ledger.begin(
            'score-governance',
            MaiClassification.ADVISORY,
            GiaLayer.MCP,
            'SYSTEM'
          );
          entry.addMetadata('operation', input.operation);
    
          try {
            const auditId = generateAuditId();
            const score = engine.scorer.score(
              { integrity: input.integrity, accuracy: input.accuracy, compliance: input.compliance },
              input.operation,
              auditId
            );
    
            // Record to forensic ledger
            entry.addMetadata('composite', score.composite);
            entry.addMetadata('meetsThreshold', engine.scorer.meetsThreshold(score));
            const completedEntry = entry.complete(score, {
              classification: MaiClassification.ADVISORY,
              confidence: score.composite >= 0.7 ? 0.95 : 0.70,
              rationale: `Governance score computed: ${score.composite.toFixed(3)}`,
              requiresGate: false,
            });
            engine.ledger.record(completedEntry);
    
            // Auto-emit governance telemetry
            engine.telemetryService.emitScoring(entry.id, input.operation, score.composite, engine.scorer.meetsThreshold(score));
            engine.telemetryService.emitToolCall('score_governance', entry.id, 'ADVISORY', true);
    
            return {
              content: [{ type: 'text' as const, text: JSON.stringify({
                composite: score.composite,
                integrity: score.integrity,
                accuracy: score.accuracy,
                compliance: score.compliance,
                weights: score.weights,
                meetsThreshold: engine.scorer.meetsThreshold(score),
                minimumThreshold: 0.70,
                auditId: entry.id,
              }, null, 2) }],
            };
          } catch (error) {
            // Record failure to forensic ledger
            engine.telemetryService.emitToolCall('score_governance', entry.id, 'MANDATORY', false);
            const failedEntry = entry.fail(error instanceof Error ? error : new Error('Scoring failed'), MaiClassification.MANDATORY);
            engine.ledger.record(failedEntry);
    
            if (error instanceof GovernedError) {
              return { content: [{ type: 'text' as const, text: JSON.stringify(error.toPublicResponse()) }], isError: true };
            }
            return { content: [{ type: 'text' as const, text: JSON.stringify({ error: 'SCORING_FAILED' }) }], isError: true };
          }
        }
      );
    }
  • Input schema for score_governance: operation (string), integrity (0-1), accuracy (0-1), compliance (0-1). Uses Zod validation.
    {
      operation: z.string().describe('Name of the operation being scored'),
      integrity: z.number().min(0).max(1).describe('Data integrity score (0.0-1.0)'),
      accuracy: z.number().min(0).max(1).describe('Factual accuracy score (0.0-1.0)'),
      compliance: z.number().min(0).max(1).describe('Regulatory compliance score (0.0-1.0)'),
    },
  • Registration entry in TOOL_REGISTRY array, mapping this tool to the 'public' visibility tier with description 'score_governance'.
    { tier: 'public', register: registerScoreGovernanceTool, description: 'score_governance' },
  • Telemetry service emits scoring and tool call events for score_governance (lines 58-59 in the handler).
     * Emit after score_governance completes.
     */
    emitScoring(
      auditId: string,
      operation: string,
      composite: number,
      meetsThreshold: boolean
    ): void {
      this.emit({
        eventType: 'scoring_executed',
        sourceTool: 'score_governance',
        sourceAuditId: auditId,
        maiLevel: 'ADVISORY',
        details: `Governance score: ${composite.toFixed(3)} for "${operation}" (${meetsThreshold ? 'PASS' : 'FAIL'})`,
        metadata: { operation, composite, meetsThreshold },
      });
    }
    
    /**
     * Emit after SRT watchdog/diagnose completes.
     */
    emitProbeResult(
      auditId: string,
      category: string,
      passed: boolean,
      probeCount: number
    ): void {
      this.emit({
        eventType: 'probe_completed',
        sourceTool: 'srt_run_watchdog',
        sourceAuditId: auditId,
        maiLevel: 'INFORMATIONAL',
        details: `SRT probe: ${category} — ${passed ? 'PASS' : 'FAIL'} (${probeCount} checks)`,
        metadata: { category, passed, probeCount },
      });
    }
    
    /**
     * Emit a generic governance event (used by record_governance_event tool).
     */
    emitGeneric(
      eventType: string,
      details: string,
      sourceTool?: string,
      sourceAuditId?: string,
      maiLevel?: string,
      metadata?: Record<string, unknown>
    ): void {
      this.emit({
        eventType,
        sourceTool: sourceTool || 'record_governance_event',
        sourceAuditId,
        maiLevel,
        details,
        metadata,
  • Telemetry audit configuration defines score_governance as toolClass 'read', riskTier 'moderate', maiDefault 'ADVISOR'.
    { toolName: 'score_governance',    toolClass: 'read',     riskTier: 'moderate', maiDefault: 'ADVISORY',       requiresHumanApproval: false, category: 'governance' },
    { toolName: 'evaluate_threshold',  toolClass: 'read',     riskTier: 'low',      maiDefault: 'INFORMATIONAL',  requiresHumanApproval: false, category: 'governance' },
    { toolName: 'assess_risk_tier',    toolClass: 'read',     riskTier: 'moderate', maiDefault: 'ADVISORY',       requiresHumanApproval: false, category: 'governance' },
    { toolName: 'map_compliance',      toolClass: 'read',     riskTier: 'low',      maiDefault: 'INFORMATIONAL',  requiresHumanApproval: false, category: 'governance' },
Behavior4/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true. The description adds the key behavioral trait that it is caller-assessed, meaning the tool does not independently verify inputs. This goes beyond annotations and provides important context for safe usage.

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?

Two dense sentences with no redundancy. First sentence defines purpose and inputs. Second sentence describes output and clarifies the tool's role. Every word earns its place, making it highly efficient for an agent to parse.

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

Completeness5/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 sufficiently explains return values (weighted composite and pass/fail). Parameters are well-covered. The tool's moderate complexity is fully addressed, and the clarification about caller-assessment ensures the agent understands the tool's limitations.

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 coverage is 100% with descriptions for all parameters. The description adds value by summarizing the purpose of the parameters ('Integrity, Accuracy, and Compliance values (0-1)') and stating the output ('Returns weighted composite and pass/fail'). This unifies the parameter meaning beyond individual schema entries.

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 the tool computes a weighted governance score from three caller-provided values (Integrity, Accuracy, Compliance) and returns a weighted composite and pass/fail. It uses specific verbs 'compute' and 'returns', and distinguishes itself from independent evaluation tools.

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 explicitly says scores are caller-assessed and the tool applies weights/thresholds, not independent evaluation. This guides when to use it (when you have self-assessed scores) and when not (if you need independent evaluation). However, it does not name specific alternative siblings, which would improve clarity.

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