Make repo the canonical arg name (demote name to alias) — advertised schema is non-idiomatic #38

Closed
opened 2026-06-10 08:45:19 +00:00 by mathias · 1 comment
Owner

Follow-up to #36. Root cause was that per-repo tools declare the repo identifier as name while every caller (claude.ai connector, LLMs primed on gitea/GitHub) reaches for repo. v0.2.8 added a reponame / indexnumber alias shim in parseArgs, so it works — but the advertised inputSchema still says name/number, so the contract a client reads is the non-idiomatic one. The alias is a band-aid over a misleading schema.

Proposal: flip canonical to repo/number in every per-repo tool schema (the idiomatic gitea/GitHub convention), keep name/index as accepted aliases for back-compat via the existing shim. Then the advertised contract matches what callers actually send and the shim becomes pure back-compat rather than load-bearing.

Scope: ~30 tool schemas + struct tags; the alias logic already exists. Mechanical, well-covered by the round-trip + alias tests.

Follow-up to #36. Root cause was that per-repo tools declare the repo identifier as `name` while every caller (claude.ai connector, LLMs primed on gitea/GitHub) reaches for `repo`. v0.2.8 added a `repo`→`name` / `index`→`number` alias shim in `parseArgs`, so it works — but the **advertised** `inputSchema` still says `name`/`number`, so the contract a client reads is the non-idiomatic one. The alias is a band-aid over a misleading schema. Proposal: flip canonical to `repo`/`number` in every per-repo tool schema (the idiomatic gitea/GitHub convention), keep `name`/`index` as accepted aliases for back-compat via the existing shim. Then the advertised contract matches what callers actually send and the shim becomes pure back-compat rather than load-bearing. Scope: ~30 tool schemas + struct tags; the alias logic already exists. Mechanical, well-covered by the round-trip + alias tests.
Author
Owner

Done in v0.4.0 (commit on main).

What changed: flipped the canonical repo-identifier arg from namerepo across all 33 per-repo identifier tools — schema property, required array, and struct field/tag. The advertised contract now matches what every caller actually sends, and the alias shim is pure back-compat rather than load-bearing.

  • normalizeAliases is now bidirectional (namerepo): legacy name callers still resolve, and repo_create / create_project_from_template — where name means "name of the new repo", not an existing-repo id — keep name and still accept repo.
  • Explicit repo now wins over name (canonical priority flipped).
  • Tests: added TestRepoIsCanonicalInAdvertisedSchema (schema advertises repo, create tools keep name) + flipped the alias round-trip cases.
  • task check green (lint 0, tests -race, vet, govulncheck clean). Verified only repo_create + create_project_from_template retain json:"name".

Scoped out — number/index: the issue also listed number as canonical. Most issue tools already use number canonical (with index aliased), so no change was needed there. But I found pr_merge (and the PR tools) advertise index, not number — a separate pre-existing inconsistency. Flipping those is a distinct change with its own back-compat surface, so I left it untouched and filed it separately to keep this diff surgical. See follow-up issue.

CD will build + deploy v0.4.0 automatically; the claude.ai connector picks up the new repo schema on next reconnect.

Done in v0.4.0 (commit on `main`). **What changed:** flipped the canonical repo-identifier arg from `name` → `repo` across all **33 per-repo identifier tools** — schema property, `required` array, and struct field/tag. The advertised contract now matches what every caller actually sends, and the alias shim is pure back-compat rather than load-bearing. - `normalizeAliases` is now **bidirectional** (`name`↔`repo`): legacy `name` callers still resolve, and `repo_create` / `create_project_from_template` — where `name` means "name of the **new** repo", not an existing-repo id — keep `name` and still accept `repo`. - Explicit `repo` now wins over `name` (canonical priority flipped). - Tests: added `TestRepoIsCanonicalInAdvertisedSchema` (schema advertises `repo`, create tools keep `name`) + flipped the alias round-trip cases. - `task check` green (lint 0, tests `-race`, vet, govulncheck clean). Verified only `repo_create` + `create_project_from_template` retain `json:"name"`. **Scoped out — `number`/`index`:** the issue also listed `number` as canonical. Most issue tools already use `number` canonical (with `index` aliased), so no change was needed there. But I found **`pr_merge` (and the PR tools) advertise `index`, not `number`** — a separate pre-existing inconsistency. Flipping those is a distinct change with its own back-compat surface, so I left it untouched and filed it separately to keep this diff surgical. See follow-up issue. CD will build + deploy v0.4.0 automatically; the claude.ai connector picks up the new `repo` schema on next reconnect.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/gitea-mcp#38