Coding Standards MCP Reference

Overview

This page documents direct MCP integration with the gloria.dev MCP server, not everyday agent workflows. It is the exception that names the tool surface, argument names, and payload shapes for integrators wiring the server directly. All calls run in the caller’s active organization. For the broader product surface, see Coding Standards and MCP Tools.

register_standard

Purpose: Ensure the project has a standards row and optionally record the rendered stamp just written into CLAUDE.md or AGENTS.md.

NameTypeRequiredDescription
projectSlugstringYesProject slug.
renderedStampnumberNoStandards version just rendered into the agent file.

Behavior:

  • Requires inventory:write.
  • Returns 403 when access is denied and 404 when the organization or project is missing.
  • Creates standards version 1 when no standards row exists yet.
  • Records renderedStamp when provided so drift checks can flag stale renders.
  • Returns the current standard with version and renderedStamp.
{
  "projectSlug": "acme-api",
  "renderedStamp": 7
}

put_rule

Purpose: Create or update one coding rule in the project’s standards library.

NameTypeRequiredDescription
projectSlugstringYesProject slug.
ruleIdstringYesStable kebab-case rule slug.
instructionstringYesImperative rule text.
authorityRuleAuthoritySchemaYesOne of enforced, stated, or observed.
scopeRuleScopeSchemaNoOptional scope object with globs? and packages?, each an array of strings.
evidenceRuleEvidenceSchemaYesEvidence object with sources: string[].
statusStandardsEntityStatusSchemaNoOne of active, stale, or retired. Defaults to active.

Behavior:

  • Requires inventory:write.
  • Returns 403 when access is denied and 404 when the organization or project is missing.
  • Auto-registers the standards row if needed.
  • Preserves the existing id and createdAt fields on updates.
  • Defaults scope to {} and status to active.
  • Bumps the project’s standards version.
  • Returns the updated rule and the new standardsVersion.
{
  "projectSlug": "acme-api",
  "ruleId": "all-d1-access-via-daos",
  "instruction": "Access D1 through DAOs only.",
  "authority": "enforced",
  "scope": {
    "packages": ["packages/core/src"]
  },
  "evidence": {
    "sources": ["packages/core/src/standards-schema.ts"]
  },
  "status": "active"
}

put_snippet

Purpose: Create or update one canonical snippet using placeholder-ized code for a reusable pattern.

NameTypeRequiredDescription
projectSlugstringYesProject slug.
snippetIdstringYesStable kebab-case snippet slug.
languagestringYesSnippet language.
namestringYesSnippet name.
descriptionstringYesSnippet description.
codestringYesPlaceholder-ized canonical code.
placeholdersstring[]NoPlaceholder names. Defaults to [].
ruleIdsstring[]NoRule slugs the snippet embodies.
statusStandardsEntityStatusSchemaNoOne of active, stale, or retired. Defaults to active.

Behavior:

  • Requires inventory:write.
  • Returns 403 when access is denied and 404 when the organization or project is missing.
  • Resolves linked rule slugs before any write.
  • Returns 404 with unknown rule: <slug> when any rule slug does not exist.
  • Replaces the linked rules wholesale and bumps the project’s standards version.
  • Returns the provided rule slugs in linkedRules alongside the snippet and new standardsVersion.
{
  "projectSlug": "acme-api",
  "snippetId": "d1-dao",
  "language": "ts",
  "name": "D1 DAO",
  "description": "Canonical DAO shape for D1 access.",
  "code": "export class D1Dao {\n  // TODO: add query methods\n}",
  "placeholders": ["query methods"],
  "ruleIds": ["all-d1-access-via-daos"],
  "status": "active"
}

find_snippets

Purpose: Find canonical snippets for a given language and search query.

NameTypeRequiredDescription
projectSlugstringYesProject slug.
languagestringYesSnippet language.
querystringYesSearch text.

Behavior:

  • Requires inventory:read.
  • Returns 403 when access is denied and 404 when the organization or project is missing.
  • Searches in this order: exact match, then name contains, then fuzzy token search across name and description.
  • Returns an empty list when nothing matches.
  • Includes ruleIds for each result and resolves them from the linked rules.
  • Returns snippet records with snippetId, language, name, description, code, placeholders, and ruleIds.
{
  "projectSlug": "acme-api",
  "language": "ts",
  "query": "D1 DAO"
}

get_standards

Purpose: Fetch the project’s current rules, standards version, and rendered stamp.

NameTypeRequiredDescription
projectSlugstringYesProject slug.

Behavior:

  • Requires inventory:read.
  • Returns 403 when access is denied and 404 when the organization or project is missing.
  • Returns the current rules together with version and renderedStamp.
  • Returns version: null when no standards row exists yet.
{
  "projectSlug": "acme-api"
}

report_check_run

Purpose: Record a Coding Standards check run and reconcile its findings with the drift ledger.

NameTypeRequiredDescription
projectSlugstringYesProject slug.
kindCheckKindSchemaYesOne of diff, audit, or metadata.
triggeredByCheckTriggerSchemaYesOne of pr, manual, or cron.
standardsVersionCheckednumberYesStandards version that the run checked.
scopeDetailCheckScopeDetailSchemaNoOptional scope object with diffRange? and prRef?.
startedAtnumberYesUnix seconds when the run started.
completedAtnumberNoUnix seconds when the run completed. Defaults to now when omitted.
findingsarrayYesFinding objects with type, optional ruleId, optional snippetId, optional file, optional line, and detail.

Behavior:

  • Requires inventory:write.
  • Returns 403 when access is denied and 404 when the organization or project is missing.
  • Accepts finding type values rule_violation, rule_stale, render_stale, snippet_stale, and unattributed_duplication.
  • Requires ruleId for rule_violation and rule_stale.
  • Requires snippetId for snippet_stale and unattributed_duplication.
  • Requires neither ruleId nor snippetId for render_stale.
  • Keys findings on (type, ruleId, snippetId, file).
  • Dedupes re-reported keys.
  • The run auto-resolves open findings that stay in scope for its kind but do not reappear in the report.
  • Keeps dismissed findings sticky.
  • Uses diff runs to auto-resolve rule_violation and unattributed_duplication, metadata runs to auto-resolve rule_stale and render_stale, and audit runs to auto-resolve all finding types.
  • Returns the check run id plus the numbers of inserted, resolved, and deduped findings.
{
  "projectSlug": "acme-api",
  "kind": "diff",
  "triggeredBy": "pr",
  "standardsVersionChecked": 12,
  "scopeDetail": {
    "prRef": "pr-123"
  },
  "startedAt": 1710000000,
  "findings": [
    {
      "type": "rule_violation",
      "ruleId": "all-d1-access-via-daos",
      "file": "packages/core/src/readers.ts",
      "line": 42,
      "detail": "Direct D1 access bypasses the DAO."
    }
  ]
}

get_drift_status

Purpose: Return the project’s current drift summary.

NameTypeRequiredDescription
projectSlugstringYesProject slug.

Behavior:

  • Requires inventory:read.
  • Returns 403 when access is denied and 404 when the organization or project is missing.
  • Returns openFindingsByType, openFindingsTotal, lastCheck, standardsVersion, and renderedStamp.
  • Returns lastCheck with id, kind, startedAt, and completedAt from the most recent check run.
  • Reads the current project state through the core drift-status DAO.
{
  "projectSlug": "acme-api"
}

Next