hearthis-mcp 0.1.0 → 0.2.0
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.
- package/CHANGELOG.md +7 -0
- package/dist/tools.js +16 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
- `get_group` and `join_group` take `invite`: the share link of a private group (or just its secret). hearthis.at now
|
|
6
|
+
answers a private group only to its owner, its members and holders of that link, and lets nobody else join.
|
|
7
|
+
- `edit_group` takes `allowed_genres`: the genres members may add to the group (an empty list accepts every genre
|
|
8
|
+
again). `get_group` names them in `info`, and `group_track` says why a sound of another genre is refused.
|
|
9
|
+
|
|
3
10
|
## 0.1.0
|
|
4
11
|
|
|
5
12
|
First release.
|
package/dist/tools.js
CHANGED
|
@@ -8,6 +8,10 @@ const flag = z.boolean().optional();
|
|
|
8
8
|
const iso = z.string().optional().describe('ISO 8601 with UTC offset, e.g. 2026-07-01T20:00:00+02:00');
|
|
9
9
|
const trackPath = (a, t, action = '') => `/${authorSegment(a)}/${segment(t)}/${action ? action + '/' : ''}`;
|
|
10
10
|
const bit = (value) => (value === undefined ? undefined : value ? 1 : 0);
|
|
11
|
+
const invite = z.string().optional()
|
|
12
|
+
.describe('Invitation of a private group: its share link https://hearthis.at/group/{id}/{name}/{secret}/ or just the secret');
|
|
13
|
+
/** The secret of an invitation link, or the secret itself. */
|
|
14
|
+
const inviteSecret = (value) => (value ? value.replace(/[?#].*$/, '').split('/').filter(Boolean).pop() : undefined);
|
|
11
15
|
const ANNOTATIONS = {
|
|
12
16
|
read: { readOnlyHint: true, openWorldHint: true },
|
|
13
17
|
add: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
@@ -528,10 +532,10 @@ export function registerTools(server, api) {
|
|
|
528
532
|
});
|
|
529
533
|
tool('get_group', {
|
|
530
534
|
title: 'Group',
|
|
531
|
-
description: 'A group: info (metadata and
|
|
532
|
-
input: { group_id: z.number().int(), part: z.enum(['info', 'tracks', 'members']).default('info'), page, count: count(50, 20) },
|
|
535
|
+
description: 'A group: info (metadata, own permissions and allowed_genres - the genre slugs members may add, empty for every genre), tracks (paged), members (owner first). A private group answers only its owner, its members and holders of its invitation link.',
|
|
536
|
+
input: { group_id: z.number().int(), part: z.enum(['info', 'tracks', 'members']).default('info'), page, count: count(50, 20), invite },
|
|
533
537
|
kind: 'read',
|
|
534
|
-
run: ({ group_id, part, ...rest }) => api.get(`/group/${segment(group_id)}/${part === 'tracks' ? '' : part + '/'}`, part === 'info' ? {} : rest),
|
|
538
|
+
run: ({ group_id, part, invite: link, ...rest }) => api.get(`/group/${segment(group_id)}/${part === 'tracks' ? '' : part + '/'}`, { ...(part === 'info' ? {} : rest), s: inviteSecret(link) }),
|
|
535
539
|
});
|
|
536
540
|
tool('create_group', {
|
|
537
541
|
title: 'Create group',
|
|
@@ -549,7 +553,8 @@ export function registerTools(server, api) {
|
|
|
549
553
|
tool('edit_group', {
|
|
550
554
|
title: 'Edit group',
|
|
551
555
|
description: 'Changes a group by the rules of its edit page - only the fields given change. Owner and editors; private only the owner. ' +
|
|
552
|
-
'member_notify=true mails the members about every new sound - only switch it on when the user asked.'
|
|
556
|
+
'member_notify=true mails the members about every new sound - only switch it on when the user asked. ' +
|
|
557
|
+
'allowed_genres limits what members may add; owner and editors can still add any sound, and sounds already in the group stay.',
|
|
553
558
|
input: {
|
|
554
559
|
group_id: z.number().int(),
|
|
555
560
|
name: z.string().min(1).max(120).optional(),
|
|
@@ -563,9 +568,10 @@ export function registerTools(server, api) {
|
|
|
563
568
|
member_notify: flag.describe('Mail the members about new sounds'),
|
|
564
569
|
sort: z.enum(['manual', 'alpha', 'random', 'plays']).optional(),
|
|
565
570
|
editors: z.array(z.number().int()).optional().describe('User ids of the editors - replaces the list; owner only'),
|
|
571
|
+
allowed_genres: z.array(z.string().min(1)).optional().describe('Genre slugs (list_genres) members may add - replaces the list; [] accepts every genre again'),
|
|
566
572
|
},
|
|
567
573
|
kind: 'write',
|
|
568
|
-
run: ({ group_id, permalink, genre, private: priv, open, approve, notify, member_notify, sort, editors, ...rest }) => api.post(`/group/${segment(group_id)}/edit/`, {
|
|
574
|
+
run: ({ group_id, permalink, genre, private: priv, open, approve, notify, member_notify, sort, editors, allowed_genres, ...rest }) => api.post(`/group/${segment(group_id)}/edit/`, {
|
|
569
575
|
...rest,
|
|
570
576
|
name_url: permalink,
|
|
571
577
|
category: genre,
|
|
@@ -576,18 +582,19 @@ export function registerTools(server, api) {
|
|
|
576
582
|
member_notify: bit(member_notify),
|
|
577
583
|
sort_config: sort ? { manual: 1, alpha: 2, random: 3, plays: 4 }[sort] : undefined,
|
|
578
584
|
editors: editors ? editors.join(',') : undefined,
|
|
585
|
+
allowed_genres: allowed_genres ? allowed_genres.join(',') : undefined,
|
|
579
586
|
}),
|
|
580
587
|
});
|
|
581
588
|
tool('join_group', {
|
|
582
589
|
title: 'Join / leave group',
|
|
583
|
-
description: 'Joins a group (join=true) or leaves it (join=false). The owner cannot leave.',
|
|
584
|
-
input: { group_id: z.number().int(), join: z.boolean() },
|
|
590
|
+
description: 'Joins a group (join=true) or leaves it (join=false). The owner cannot leave. A private group can only be joined with its invitation link.',
|
|
591
|
+
input: { group_id: z.number().int(), join: z.boolean(), invite },
|
|
585
592
|
kind: 'write',
|
|
586
|
-
run: ({ group_id, join }) => api.post(`/group/${segment(group_id)}/${join ? 'join' : 'leave'}
|
|
593
|
+
run: ({ group_id, join, invite: link }) => api.post(`/group/${segment(group_id)}/${join ? 'join' : 'leave'}/`, { s: join ? inviteSecret(link) : undefined }),
|
|
587
594
|
});
|
|
588
595
|
tool('group_track', {
|
|
589
596
|
title: 'Add / remove group track',
|
|
590
|
-
description: 'Adds a track to a group (add=true) or removes it (add=false). Owner, editors and the sound\'s author are published at once; others wait while the group asks for approval. Adding notifies the members and may mail the owner.',
|
|
597
|
+
description: 'Adds a track to a group (add=true) or removes it (add=false). Owner, editors and the sound\'s author are published at once; others wait while the group asks for approval. A group limited to genres refuses a member\'s sound of another genre (403, the answer names allowed_genres). Adding notifies the members and may mail the owner.',
|
|
591
598
|
input: { group_id: z.number().int(), track_id: z.number().int(), add: z.boolean() },
|
|
592
599
|
kind: 'write',
|
|
593
600
|
run: ({ group_id, track_id, add }) => api.post(`/group/${segment(group_id)}/${add ? 'add' : 'remove'}/`, { track_id }),
|