Per-flag jsonschema override annotation for complex types #7

Closed
opened 2026-05-23 20:53:53 +00:00 by coilysiren · 0 comments
Owner

Originally filed by @coilysiren on 2026-05-13T14:20:02Z - https://github.com/coilysiren/cli-mcp/issues/35

njayp/ophis supports a jsonschema annotation on individual flags: "the JSON string representation of the schema" for complex types beyond the bool/int/float/string/array/duration mapping.

cli-mcp today maps urfave flag types to JSON Schema primitives. There's no escape hatch for a flag whose value is parsed as a string but represents a structured payload (JSON config blob, enum with constrained values, regex-bounded string, etc).

Proposal: relay a known cli.Flag metadata key (e.g. jsonschema or climcp.schema) into the property's JSON schema, overriding the inferred shape. Consistent with how cli-mcp already relays webops.* metadata onto tool.Meta / tool.Annotations.

Open questions:

  • Format: full JSON Schema string, or a Go map[string]any (typed but verbose)?
  • Scope: just override type, or full property replacement (incl. enum, pattern, description)?
  • Should this apply to positional args too, or stay flag-only for v1?
_Originally filed by @coilysiren on 2026-05-13T14:20:02Z - [https://github.com/coilysiren/cli-mcp/issues/35](https://github.com/coilysiren/cli-mcp/issues/35)_ [njayp/ophis](https://github.com/njayp/ophis) supports a `jsonschema` annotation on individual flags: "the JSON string representation of the schema" for complex types beyond the bool/int/float/string/array/duration mapping. cli-mcp today maps urfave flag types to JSON Schema primitives. There's no escape hatch for a flag whose value is parsed as a string but represents a structured payload (JSON config blob, enum with constrained values, regex-bounded string, etc). Proposal: relay a known `cli.Flag` metadata key (e.g. `jsonschema` or `climcp.schema`) into the property's JSON schema, overriding the inferred shape. Consistent with how cli-mcp already relays `webops.*` metadata onto `tool.Meta` / `tool.Annotations`. Open questions: - Format: full JSON Schema string, or a Go `map[string]any` (typed but verbose)? - Scope: just override `type`, or full property replacement (incl. `enum`, `pattern`, `description`)? - Should this apply to positional args too, or stay flag-only for v1?
coilysiren 2026-05-30 05:44:17 +00:00
  • closed this issue
  • added the
    icebox
    label
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilysiren/cli-mcp#7
No description provided.