@hed-hog/tag 0.0.350 → 0.0.351

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ import { McpContext } from '@hed-hog/core';
2
+ import { TagService } from '../tag.service';
3
+ export declare class TagMcpTools {
4
+ private readonly tagService;
5
+ constructor(tagService: TagService);
6
+ list(args: Record<string, any>, _context: McpContext): Promise<any>;
7
+ stats(_args: Record<string, any>, _context: McpContext): Promise<any>;
8
+ get(args: Record<string, any>, context: McpContext): Promise<any>;
9
+ create(args: Record<string, any>, context: McpContext): Promise<any>;
10
+ update(args: Record<string, any>, context: McpContext): Promise<any>;
11
+ delete(args: Record<string, any>, context: McpContext): Promise<any>;
12
+ }
13
+ //# sourceMappingURL=tag.mcp-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag.mcp-tools.d.ts","sourceRoot":"","sources":["../../src/mcp-tools/tag.mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,qBACa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAe7C,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAgBnE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAgBrE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAiBjE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAkBpE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAgBpE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;CAG3E"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.TagMcpTools = void 0;
24
+ const core_1 = require("@hed-hog/core");
25
+ const common_1 = require("@nestjs/common");
26
+ const tag_service_1 = require("../tag.service");
27
+ let TagMcpTools = class TagMcpTools {
28
+ constructor(tagService) {
29
+ this.tagService = tagService;
30
+ }
31
+ async list(args, _context) {
32
+ var _a, _b, _c;
33
+ const page = (_a = args.page) !== null && _a !== void 0 ? _a : 1;
34
+ const pageSize = (_b = args.pageSize) !== null && _b !== void 0 ? _b : 20;
35
+ return this.tagService.list({
36
+ skip: (page - 1) * pageSize,
37
+ take: pageSize,
38
+ search: (_c = args.search) !== null && _c !== void 0 ? _c : '',
39
+ });
40
+ }
41
+ async stats(_args, _context) {
42
+ return this.tagService.getStats();
43
+ }
44
+ async get(args, context) {
45
+ return this.tagService.getById(args.id, context.locale);
46
+ }
47
+ async create(args, context) {
48
+ return this.tagService.create(context.locale, args);
49
+ }
50
+ async update(args, context) {
51
+ const { id } = args, data = __rest(args, ["id"]);
52
+ return this.tagService.update(id, data, context.locale);
53
+ }
54
+ async delete(args, context) {
55
+ return this.tagService.delete(args.id, context.locale);
56
+ }
57
+ };
58
+ exports.TagMcpTools = TagMcpTools;
59
+ __decorate([
60
+ (0, core_1.McpTool)({
61
+ name: 'tag.list',
62
+ description: 'Lists tags with pagination and optional search.',
63
+ inputSchema: {
64
+ type: 'object',
65
+ properties: {
66
+ page: { type: 'number', description: 'Page number (default: 1)' },
67
+ pageSize: { type: 'number', description: 'Items per page (default: 20)' },
68
+ search: { type: 'string', description: 'Search term (matches slug)' },
69
+ },
70
+ },
71
+ readOnly: true,
72
+ }),
73
+ __metadata("design:type", Function),
74
+ __metadata("design:paramtypes", [Object, Object]),
75
+ __metadata("design:returntype", Promise)
76
+ ], TagMcpTools.prototype, "list", null);
77
+ __decorate([
78
+ (0, core_1.McpTool)({
79
+ name: 'tag.stats',
80
+ description: 'Returns tag counts: total, active, inactive.',
81
+ inputSchema: { type: 'object', properties: {} },
82
+ readOnly: true,
83
+ }),
84
+ __metadata("design:type", Function),
85
+ __metadata("design:paramtypes", [Object, Object]),
86
+ __metadata("design:returntype", Promise)
87
+ ], TagMcpTools.prototype, "stats", null);
88
+ __decorate([
89
+ (0, core_1.McpTool)({
90
+ name: 'tag.get',
91
+ description: 'Returns a single tag by ID.',
92
+ inputSchema: {
93
+ type: 'object',
94
+ properties: {
95
+ id: { type: 'number', description: 'Tag ID' },
96
+ },
97
+ required: ['id'],
98
+ },
99
+ readOnly: true,
100
+ }),
101
+ __metadata("design:type", Function),
102
+ __metadata("design:paramtypes", [Object, Object]),
103
+ __metadata("design:returntype", Promise)
104
+ ], TagMcpTools.prototype, "get", null);
105
+ __decorate([
106
+ (0, core_1.McpTool)({
107
+ name: 'tag.create',
108
+ description: 'Creates a new tag.',
109
+ inputSchema: {
110
+ type: 'object',
111
+ properties: {
112
+ slug: { type: 'string', description: 'Unique slug identifier' },
113
+ color: { type: 'string', description: 'Color in hex format (e.g. #ff0000 or #f00)' },
114
+ status: { type: 'string', enum: ['active', 'inactive'], description: 'Tag status (default: active)' },
115
+ },
116
+ required: ['slug', 'color'],
117
+ },
118
+ }),
119
+ __metadata("design:type", Function),
120
+ __metadata("design:paramtypes", [Object, Object]),
121
+ __metadata("design:returntype", Promise)
122
+ ], TagMcpTools.prototype, "create", null);
123
+ __decorate([
124
+ (0, core_1.McpTool)({
125
+ name: 'tag.update',
126
+ description: 'Updates an existing tag by ID.',
127
+ inputSchema: {
128
+ type: 'object',
129
+ properties: {
130
+ id: { type: 'number', description: 'Tag ID' },
131
+ slug: { type: 'string', description: 'Unique slug identifier' },
132
+ color: { type: 'string', description: 'Color in hex format' },
133
+ status: { type: 'string', enum: ['active', 'inactive'], description: 'Tag status' },
134
+ },
135
+ required: ['id'],
136
+ },
137
+ }),
138
+ __metadata("design:type", Function),
139
+ __metadata("design:paramtypes", [Object, Object]),
140
+ __metadata("design:returntype", Promise)
141
+ ], TagMcpTools.prototype, "update", null);
142
+ __decorate([
143
+ (0, core_1.McpTool)({
144
+ name: 'tag.delete',
145
+ description: 'Deletes a tag by ID.',
146
+ inputSchema: {
147
+ type: 'object',
148
+ properties: {
149
+ id: { type: 'number', description: 'Tag ID' },
150
+ },
151
+ required: ['id'],
152
+ },
153
+ }),
154
+ __metadata("design:type", Function),
155
+ __metadata("design:paramtypes", [Object, Object]),
156
+ __metadata("design:returntype", Promise)
157
+ ], TagMcpTools.prototype, "delete", null);
158
+ exports.TagMcpTools = TagMcpTools = __decorate([
159
+ (0, common_1.Injectable)(),
160
+ __metadata("design:paramtypes", [tag_service_1.TagService])
161
+ ], TagMcpTools);
162
+ //# sourceMappingURL=tag.mcp-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag.mcp-tools.js","sourceRoot":"","sources":["../../src/mcp-tools/tag.mcp-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAoD;AACpD,2CAA4C;AAC5C,gDAA4C;AAGrC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAejD,AAAN,KAAK,CAAC,IAAI,CAAC,IAAyB,EAAE,QAAoB;;QACxD,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,IAAI,mCAAI,CAAC,CAAC;QAC5B,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,QAAQ,mCAAI,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAC1B,IAAI,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ;YAC3B,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;IAQK,AAAN,KAAK,CAAC,KAAK,CAAC,KAA0B,EAAE,QAAoB;QAC1D,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;IAcK,AAAN,KAAK,CAAC,GAAG,CAAC,IAAyB,EAAE,OAAmB;QACtD,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,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E,WAAW,EAAE,qBAAqB,EAAE;gBAC7D,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE;aACpF;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;KACF,CAAC;;;;yCAID;AAaK;IAXL,IAAA,cAAO,EAAC;QACP,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,sBAAsB;QACnC,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE;aAC9C;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;KACF,CAAC;;;;yCAGD;sBArGU,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAE8B,wBAAU;GADxC,WAAW,CAsGvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"tag.module.d.ts","sourceRoot":"","sources":["../src/tag.module.ts"],"names":[],"mappings":"AAIA,qBAMa,SAAS;CAAG"}
1
+ {"version":3,"file":"tag.module.d.ts","sourceRoot":"","sources":["../src/tag.module.ts"],"names":[],"mappings":"AAKA,qBAMa,SAAS;CAAG"}
@@ -10,6 +10,7 @@ exports.TagModule = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
11
  const tag_controller_1 = require("./tag.controller");
12
12
  const tag_service_1 = require("./tag.service");
13
+ const tag_mcp_tools_1 = require("./mcp-tools/tag.mcp-tools");
13
14
  let TagModule = class TagModule {
14
15
  };
15
16
  exports.TagModule = TagModule;
@@ -17,7 +18,7 @@ exports.TagModule = TagModule = __decorate([
17
18
  (0, common_1.Module)({
18
19
  imports: [],
19
20
  controllers: [tag_controller_1.TagController],
20
- providers: [tag_service_1.TagService],
21
+ providers: [tag_service_1.TagService, tag_mcp_tools_1.TagMcpTools],
21
22
  exports: [tag_service_1.TagService],
22
23
  })
23
24
  ], TagModule);
@@ -1 +1 @@
1
- {"version":3,"file":"tag.module.js","sourceRoot":"","sources":["../src/tag.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,+CAA2C;AAQpC,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IANrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,CAAC;QACvB,OAAO,EAAE,CAAC,wBAAU,CAAC;KACtB,CAAC;GACW,SAAS,CAAG"}
1
+ {"version":3,"file":"tag.module.js","sourceRoot":"","sources":["../src/tag.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,+CAA2C;AAC3C,6DAAwD;AAQjD,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IANrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,EAAE,2BAAW,CAAC;QACpC,OAAO,EAAE,CAAC,wBAAU,CAAC;KACtB,CAAC;GACW,SAAS,CAAG"}
@@ -45,4 +45,58 @@
45
45
  - where:
46
46
  slug: admin
47
47
  - where:
48
- slug: admin-tag
48
+ slug: admin-tag
49
+
50
+ - tool_name: tag.list
51
+ type: MCP
52
+ name: Tag List
53
+ relations:
54
+ role:
55
+ - where:
56
+ slug: admin
57
+ - where:
58
+ slug: admin-tag
59
+
60
+ - tool_name: tag.stats
61
+ type: MCP
62
+ name: Tag Stats
63
+ relations:
64
+ role:
65
+ - where:
66
+ slug: admin
67
+ - where:
68
+ slug: admin-tag
69
+
70
+ - tool_name: tag.get
71
+ type: MCP
72
+ name: Tag Get
73
+ relations:
74
+ role:
75
+ - where:
76
+ slug: admin
77
+ - where:
78
+ slug: admin-tag
79
+
80
+ - tool_name: tag.create
81
+ type: MCP
82
+ name: Tag Create
83
+ relations:
84
+ role:
85
+ - where:
86
+ slug: admin
87
+
88
+ - tool_name: tag.update
89
+ type: MCP
90
+ name: Tag Update
91
+ relations:
92
+ role:
93
+ - where:
94
+ slug: admin
95
+
96
+ - tool_name: tag.delete
97
+ type: MCP
98
+ name: Tag Delete
99
+ relations:
100
+ role:
101
+ - where:
102
+ slug: admin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/tag",
3
- "version": "0.0.350",
3
+ "version": "0.0.351",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -10,10 +10,10 @@
10
10
  "@nestjs/jwt": "^11",
11
11
  "@nestjs/mapped-types": "*",
12
12
  "@hed-hog/api-prisma": "0.0.6",
13
+ "@hed-hog/api-locale": "0.0.14",
13
14
  "@hed-hog/api-pagination": "0.0.7",
14
- "@hed-hog/core": "0.0.350",
15
15
  "@hed-hog/api": "0.0.8",
16
- "@hed-hog/api-locale": "0.0.14"
16
+ "@hed-hog/core": "0.0.351"
17
17
  },
18
18
  "exports": {
19
19
  ".": {
@@ -0,0 +1,108 @@
1
+ import { McpContext, McpTool } from '@hed-hog/core';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { TagService } from '../tag.service';
4
+
5
+ @Injectable()
6
+ export class TagMcpTools {
7
+ constructor(private readonly tagService: TagService) {}
8
+
9
+ @McpTool({
10
+ name: 'tag.list',
11
+ description: 'Lists tags with pagination and optional search.',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ page: { type: 'number', description: 'Page number (default: 1)' },
16
+ pageSize: { type: 'number', description: 'Items per page (default: 20)' },
17
+ search: { type: 'string', description: 'Search term (matches slug)' },
18
+ },
19
+ },
20
+ readOnly: true,
21
+ })
22
+ async list(args: Record<string, any>, _context: McpContext): Promise<any> {
23
+ const page = args.page ?? 1;
24
+ const pageSize = args.pageSize ?? 20;
25
+ return this.tagService.list({
26
+ skip: (page - 1) * pageSize,
27
+ take: pageSize,
28
+ search: args.search ?? '',
29
+ });
30
+ }
31
+
32
+ @McpTool({
33
+ name: 'tag.stats',
34
+ description: 'Returns tag counts: total, active, inactive.',
35
+ inputSchema: { type: 'object', properties: {} },
36
+ readOnly: true,
37
+ })
38
+ async stats(_args: Record<string, any>, _context: McpContext): Promise<any> {
39
+ return this.tagService.getStats();
40
+ }
41
+
42
+ @McpTool({
43
+ name: 'tag.get',
44
+ description: 'Returns a single tag by ID.',
45
+ inputSchema: {
46
+ type: 'object',
47
+ properties: {
48
+ id: { type: 'number', description: 'Tag ID' },
49
+ },
50
+ required: ['id'],
51
+ },
52
+ readOnly: true,
53
+ })
54
+ async get(args: Record<string, any>, context: McpContext): Promise<any> {
55
+ return this.tagService.getById(args.id, context.locale);
56
+ }
57
+
58
+ @McpTool({
59
+ name: 'tag.create',
60
+ description: 'Creates a new tag.',
61
+ inputSchema: {
62
+ type: 'object',
63
+ properties: {
64
+ slug: { type: 'string', description: 'Unique slug identifier' },
65
+ color: { type: 'string', description: 'Color in hex format (e.g. #ff0000 or #f00)' },
66
+ status: { type: 'string', enum: ['active', 'inactive'], description: 'Tag status (default: active)' },
67
+ },
68
+ required: ['slug', 'color'],
69
+ },
70
+ })
71
+ async create(args: Record<string, any>, context: McpContext): Promise<any> {
72
+ return this.tagService.create(context.locale, args as any);
73
+ }
74
+
75
+ @McpTool({
76
+ name: 'tag.update',
77
+ description: 'Updates an existing tag by ID.',
78
+ inputSchema: {
79
+ type: 'object',
80
+ properties: {
81
+ id: { type: 'number', description: 'Tag ID' },
82
+ slug: { type: 'string', description: 'Unique slug identifier' },
83
+ color: { type: 'string', description: 'Color in hex format' },
84
+ status: { type: 'string', enum: ['active', 'inactive'], description: 'Tag status' },
85
+ },
86
+ required: ['id'],
87
+ },
88
+ })
89
+ async update(args: Record<string, any>, context: McpContext): Promise<any> {
90
+ const { id, ...data } = args;
91
+ return this.tagService.update(id, data as any, context.locale);
92
+ }
93
+
94
+ @McpTool({
95
+ name: 'tag.delete',
96
+ description: 'Deletes a tag by ID.',
97
+ inputSchema: {
98
+ type: 'object',
99
+ properties: {
100
+ id: { type: 'number', description: 'Tag ID' },
101
+ },
102
+ required: ['id'],
103
+ },
104
+ })
105
+ async delete(args: Record<string, any>, context: McpContext): Promise<any> {
106
+ return this.tagService.delete(args.id, context.locale);
107
+ }
108
+ }
package/src/tag.module.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { Module } from '@nestjs/common';
2
2
  import { TagController } from './tag.controller';
3
3
  import { TagService } from './tag.service';
4
+ import { TagMcpTools } from './mcp-tools/tag.mcp-tools';
4
5
 
5
6
  @Module({
6
7
  imports: [],
7
8
  controllers: [TagController],
8
- providers: [TagService],
9
+ providers: [TagService, TagMcpTools],
9
10
  exports: [TagService],
10
11
  })
11
12
  export class TagModule {}