feat(resolvemcp): add model descriptions, usage guide and catalogue export

- modelregistry: ModelInfo (description, purpose, tags, column docs) with
  external JSON loader, Describer fallback and gorm/bun/comment tag support
- resolvemcp: surface descriptions in list_tables and describe_table, send a
  usage guide as MCP server instructions, add package docs
- add BuildCatalog/ExportCatalog to write a JSON or Markdown API catalogue
- document the descriptions map and catalogue in the README
This commit is contained in:
Hein
2026-10-07 14:09:37 +02:00
parent 234aac9770
commit 431b674162
12 changed files with 816 additions and 20 deletions
+7
View File
@@ -9,6 +9,7 @@ import (
"github.com/mark3labs/mcp-go/mcp"
"github.com/bitechdev/ResolveSpec/pkg/common"
"github.com/bitechdev/ResolveSpec/pkg/modelregistry"
"github.com/bitechdev/ResolveSpec/pkg/reflection"
)
@@ -30,6 +31,7 @@ type columnInfo struct {
isUnique bool
isFK bool
nullable bool
comment string // from struct tags (gorm/bun comment:, comment/note/desc tags)
}
// buildModelInfo extracts column metadata and pre-builds the schema documentation string.
@@ -100,7 +102,12 @@ func buildModelInfo(schema, entity string, model interface{}) modelInfo {
isPrimary := d.SQLKey == "primary_key" ||
(info.pkName != "" && (sqlName == info.pkName || jsonName == info.pkName))
comment := ""
if found {
comment = modelregistry.FieldComment(fieldType)
}
ci := columnInfo{
comment: comment,
jsonName: jsonName,
sqlName: sqlName,
goType: goType,