Skip to content

feat(mcp-bridge): add MCP annotations + outputSchema to all tools; Teranga scoped surface#75

Merged
hyperpolymath merged 5 commits into
mainfrom
feat/mcp-annotations-outputschema-teranga
May 18, 2026
Merged

feat(mcp-bridge): add MCP annotations + outputSchema to all tools; Teranga scoped surface#75
hyperpolymath merged 5 commits into
mainfrom
feat/mcp-annotations-outputschema-teranga

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Quality upgrade to the MCP bridge surface: every advertised tool now
carries MCP-spec annotations and a JSON-Schema outputSchema, and a
new BOJ_TOOL_SCOPE env var lets operators shrink the advertised
surface (a Glama Server Coherence lever) without losing any capability.
No existing description or inputSchema was rewritten or shortened —
the AAA-tier 120-char min / 200-char mean coherence floor is preserved.

Stale-score finding

The previous Glama C grade was a stale pre-AAA inspection. The
tool descriptions and input schemas had already been upgraded to
AAA-tier (rich prose, enums, ranges, patterns, sibling
disambiguation). The only remaining gaps — confirmed by grep — were
zero MCP annotations, zero outputSchema, and 41+ tools always
advertised. This PR closes exactly those gaps so a re-inspection
reflects the current surface, not the old one.

Per-task changes

1. MCP annotations (mcp-bridge/lib/tools.js)
Every tool (object literals + every ghTools/glTools entry via an
ann field) gets an annotations block: Title-Case title plus the
four boolean hints. Derived honestly from documented semantics:

  • openWorldHint:false for coord_* (loopback bus) and the local
    discovery/dispatch core; true for all external-system tools.
  • destructiveHint:true only for boj_github_merge_pr,
    coord_approve, coord_reject, boj_gitlab_setup_mirror.
  • idempotentHint:true for status/health/setter-style coord ops and
    boj_health.

2. outputSchema (mcp-bridge/lib/tools.js)
A type:"object" return descriptor with a non-empty top-level
description and an explicit additionalProperties on every tool.
Fields fully enumerated where the description already states the shape;
honest pass-through (additionalProperties:true) for opaque upstream
cartridge/provider payloads — no invented fields.

3. main.js wiring
tools/list passes whole tool objects through verbatim (no field
whitelisting), so annotations + outputSchema reach the wire
unmodified. tools capability now advertises listChanged:true.

4. Teranga scoped surface
BOJ_TOOL_SCOPE read in buildToolList():

  • unset / full — every tool (DEFAULT, fully backward-compatible).
  • coreboj_health, boj_menu, boj_cartridges,
    boj_cartridge_info, boj_cartridge_invoke + all coord_*.
  • CSV of prefixes (core,github,browser) — core + named groups.
    Verified counts: full=65, core=28 (5 + 23 coord_*),
    core,github,browser=49. Every explicit boj_<domain>_* tool stays
    reachable via boj_cartridge_invoke in every mode — the
    unified-endpoint thesis is intact. Documented in glama.json env block
    and docs/glama/SERVER_CONFIGURATION.md.

Test additions (mcp-bridge/tests/dispatch_test.js)

Existing 8 tests untouched. Added 3:

  • every tool has a complete annotations block (non-empty string
    title + four boolean hints);
  • every tool has a typed, described outputSchema (type:"object",
    non-empty description, explicit additionalProperties);
  • BOJ_TOOL_SCOPE unset advertises the full surface (back-compat) and
    core is a strict subset that keeps boj_cartridge_invoke + the
    coord_* unit.

npm test: 11/11 pass. eslint clean on all changed files.

Post-merge

  • Publish a new npm version of @hyperpolymath/boj-server so the
    registry artifact carries the new annotations/outputSchema surface.
  • Trigger a fresh Glama re-inspection to clear the stale C grade.

🤖 Generated with Claude Code

hyperpolymath and others added 2 commits May 17, 2026 07:59
…ranga scoped surface

Three quality upgrades to the MCP bridge, none of which touch the
existing AAA-tier `description` or `inputSchema` text (the 120-char
min / 200-char mean coherence floor is preserved).

1. MCP annotations on every advertised tool
   Each of the 65 tools (object literals plus every ghTools/glTools
   entry) now carries an `annotations` block with a Title-Case `title`
   and the four MCP-spec behaviour hints (readOnlyHint, destructiveHint,
   idempotentHint, openWorldHint), derived honestly from each tool's
   documented semantics. coord_* and the local discovery/dispatch core
   are openWorldHint:false (loopback/local only); all external-system
   tools are openWorldHint:true. Only the genuinely destructive
   mutations (boj_github_merge_pr, coord_approve, coord_reject,
   boj_gitlab_setup_mirror) are destructiveHint:true.

2. outputSchema on every advertised tool
   A JSON-Schema `type:"object"` return descriptor with a top-level
   description and an explicit additionalProperties flag. Fully
   enumerated where the description already states the shape
   (boj_health, boj_browser_navigate, coord_register, ...); honest
   pass-through (`additionalProperties:true`) for opaque upstream
   cartridge/provider payloads rather than inventing fields.

3. Teranga scoped tool surface (Glama Server Coherence lever)
   New BOJ_TOOL_SCOPE env var read in buildToolList():
     - unset / "full"  : advertise every tool (DEFAULT — full
                          backward compatibility, no client sees a
                          change unless they opt in).
     - "core"          : advertise only boj_health, boj_menu,
                          boj_cartridges, boj_cartridge_info,
                          boj_cartridge_invoke + ALL coord_* tools.
     - CSV of prefixes : core + named explicit domain groups
                          (e.g. "core,github,browser").
   The unified-endpoint thesis is fully preserved: every explicit
   boj_<domain>_* tool stays reachable through boj_cartridge_invoke
   regardless of scope. Narrowing the advertised surface changes
   discovery only, not capability — exactly what the coherence
   sub-score rewards.

main.js: tools/list passes whole tool objects through verbatim, so
annotations + outputSchema reach the wire with no whitelisting; the
`tools` capability now advertises listChanged:true. glama.json and
docs/glama/SERVER_CONFIGURATION.md document BOJ_TOOL_SCOPE and the
preserved unified endpoint. dispatch_test.js gains three coherence
tests (annotations completeness, outputSchema shape, BOJ_TOOL_SCOPE
back-compat); all 11 tests pass, existing tests untouched.

Note: the prior Glama "C" grade was a stale pre-AAA inspection — the
descriptions/inputSchemas were already upgraded; this commit closes
the remaining annotations / outputSchema / coherence gaps so a
re-inspection reflects the current surface.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 28 issues detected

Severity Count
🔴 Critical 17
🟠 High 4
🟡 Medium 7

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stale AI session file -- delete",
    "type": "stale",
    "file": "GEMINI.md",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "medium"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/sanctify-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/academic-workflow-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/fireflag-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/ephapax-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/bofig-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/hesiod-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath enabled auto-merge (squash) May 18, 2026 09:54
@hyperpolymath
hyperpolymath merged commit 382a000 into main May 18, 2026
10 of 15 checks passed
@hyperpolymath
hyperpolymath deleted the feat/mcp-annotations-outputschema-teranga branch May 18, 2026 21:00
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 28 issues detected

Severity Count
🔴 Critical 17
🟠 High 4
🟡 Medium 7

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stale AI session file -- delete",
    "type": "stale",
    "file": "GEMINI.md",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "medium"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/sanctify-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/academic-workflow-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/fireflag-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/ephapax-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/bofig-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/boj-server/boj-server/cartridges/hesiod-mcp/adapter/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant