rewind-mcp-server 0.1.0 → 0.3.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.
Files changed (54) hide show
  1. package/README.md +77 -90
  2. package/dist/__tests__/helpers.test.d.ts +1 -0
  3. package/dist/__tests__/helpers.test.js +131 -0
  4. package/dist/__tests__/helpers.test.js.map +1 -0
  5. package/dist/__tests__/image-block.live.d.ts +1 -0
  6. package/dist/__tests__/image-block.live.js +41 -0
  7. package/dist/__tests__/image-block.live.js.map +1 -0
  8. package/dist/__tests__/server.test.d.ts +1 -0
  9. package/dist/__tests__/server.test.js +1308 -0
  10. package/dist/__tests__/server.test.js.map +1 -0
  11. package/dist/__tests__/stdio-e2e.live.d.ts +1 -0
  12. package/dist/__tests__/stdio-e2e.live.js +60 -0
  13. package/dist/__tests__/stdio-e2e.live.js.map +1 -0
  14. package/dist/__tests__/ui-resource.live.d.ts +1 -0
  15. package/dist/__tests__/ui-resource.live.js +71 -0
  16. package/dist/__tests__/ui-resource.live.js.map +1 -0
  17. package/dist/client.d.ts +9 -0
  18. package/dist/client.js +15 -0
  19. package/dist/client.js.map +1 -1
  20. package/dist/index.js +0 -0
  21. package/dist/prompts.js +101 -0
  22. package/dist/prompts.js.map +1 -1
  23. package/dist/resources/ui.d.ts +33 -0
  24. package/dist/resources/ui.js +14 -0
  25. package/dist/resources/ui.js.map +1 -0
  26. package/dist/resources.js +128 -0
  27. package/dist/resources.js.map +1 -1
  28. package/dist/server.js +55 -1
  29. package/dist/server.js.map +1 -1
  30. package/dist/tools/collecting.js +116 -14
  31. package/dist/tools/collecting.js.map +1 -1
  32. package/dist/tools/cross-domain.js +74 -17
  33. package/dist/tools/cross-domain.js.map +1 -1
  34. package/dist/tools/debug.d.ts +6 -0
  35. package/dist/tools/debug.js +26 -0
  36. package/dist/tools/debug.js.map +1 -0
  37. package/dist/tools/helpers.d.ts +81 -5
  38. package/dist/tools/helpers.js +138 -4
  39. package/dist/tools/helpers.js.map +1 -1
  40. package/dist/tools/listening.js +223 -52
  41. package/dist/tools/listening.js.map +1 -1
  42. package/dist/tools/reading.js +74 -22
  43. package/dist/tools/reading.js.map +1 -1
  44. package/dist/tools/running.js +87 -43
  45. package/dist/tools/running.js.map +1 -1
  46. package/dist/tools/watching.js +199 -32
  47. package/dist/tools/watching.js.map +1 -1
  48. package/dist/ui-bundles.d.ts +3 -0
  49. package/dist/ui-bundles.js +8 -0
  50. package/dist/ui-bundles.js.map +1 -0
  51. package/dist/worker.d.ts +2 -1
  52. package/dist/worker.js +55 -30
  53. package/dist/worker.js.map +1 -1
  54. package/package.json +18 -3
@@ -1,32 +1,108 @@
1
1
  import { z } from 'zod';
2
2
  import type { RewindClient } from '../client.js';
3
+ export type TextBlock = {
4
+ type: 'text';
5
+ text: string;
6
+ };
7
+ export type ImageBlock = {
8
+ type: 'image';
9
+ data: string;
10
+ mimeType: string;
11
+ };
12
+ export type ResourceLinkBlock = {
13
+ type: 'resource_link';
14
+ uri: string;
15
+ name: string;
16
+ mimeType?: string;
17
+ description?: string;
18
+ };
19
+ export type ContentBlock = TextBlock | ImageBlock | ResourceLinkBlock;
20
+ export type ToolResult<S = unknown> = {
21
+ content: ContentBlock[];
22
+ structuredContent?: S;
23
+ isError?: boolean;
24
+ };
25
+ /** Build a text content block. */
26
+ export declare function text(value: string): TextBlock;
27
+ /**
28
+ * Build a resource_link content block.
29
+ * Returns null if the URI is missing/empty so callers can `.filter(Boolean)`.
30
+ */
31
+ export declare function resourceLink(uri: string | null | undefined, name: string, opts?: {
32
+ mimeType?: string;
33
+ description?: string;
34
+ }): ResourceLinkBlock | null;
35
+ /**
36
+ * An image attachment as returned by Rewind entity responses.
37
+ * Accepts both `cdn_url` (live API) and `url` (OpenAPI-schema-example field).
38
+ */
39
+ export type ImageAttachment = {
40
+ cdn_url?: string | null;
41
+ url?: string | null;
42
+ thumbhash?: string | null;
43
+ dominant_color?: string | null;
44
+ accent_color?: string | null;
45
+ } | null | undefined;
46
+ /**
47
+ * Build an image content block from an entity's image attachment by fetching
48
+ * the public CDN URL directly. Returns null on any failure or missing URL --
49
+ * never throws. Image blocks are best-effort; we always want to return
50
+ * text/data even if the image fetch breaks.
51
+ *
52
+ * Pass `targetPx` to request a smaller transform -- overrides the `width` and
53
+ * `height` query params on the CDN URL. Useful for list tools that must stay
54
+ * under the client's per-response size budget. Omit for full-size (typically
55
+ * 300x300) detail-tool posters.
56
+ */
57
+ export declare function imageBlock(client: RewindClient, image: ImageAttachment, targetPx?: number): Promise<ImageBlock | null>;
58
+ /** Target pixel size for list-tool image blocks. Keeps responses under ~250KB. */
59
+ export declare const LIST_IMAGE_PX = 150;
3
60
  /**
4
- * Wrap a tool handler with standard error handling.
61
+ * Wrap a tool handler that returns only text.
5
62
  * Returns { content, isError: true } on failure.
6
63
  */
7
64
  export declare function withErrorHandling(fn: () => Promise<string>): Promise<{
8
- content: {
9
- type: 'text';
10
- text: string;
11
- }[];
65
+ content: TextBlock[];
12
66
  isError?: boolean;
13
67
  }>;
68
+ /**
69
+ * Wrap a tool handler that returns a rich response (text + images + resource_links + structuredContent).
70
+ * Returns a well-formed error ToolResult on failure.
71
+ *
72
+ * Callers should construct content arrays via the builders above and filter nulls:
73
+ * return {
74
+ * content: [text(summary), ...blocks.filter(Boolean)],
75
+ * structuredContent: data,
76
+ * };
77
+ */
78
+ export declare function withRichResponse<S = unknown>(fn: () => Promise<ToolResult<S>>): Promise<ToolResult<S>>;
14
79
  /** Format a date string as "Jan 15, 2025" */
15
80
  export declare function formatDate(iso: string | null | undefined): string;
16
81
  /** Format a date string as relative time like "2h ago" */
17
82
  export declare function timeAgo(iso: string): string;
18
83
  /** Format a number with commas */
19
84
  export declare function fmt(n: number | null | undefined): string;
85
+ /**
86
+ * Format a Letterboxd-style 0-5 star user rating. The Rewind API stores
87
+ * these in the 0-5 half-star range (e.g. 4.5 = four and a half stars).
88
+ * Renders as "4.5★" or "4★" -- never "4/10", which is a different scale.
89
+ */
90
+ export declare function formatStars(r: number | null | undefined): string;
20
91
  /** Common date filter params reused across tools. */
21
92
  export declare const dateFilterParams: {
22
93
  date: z.ZodOptional<z.ZodString>;
23
94
  from: z.ZodOptional<z.ZodString>;
24
95
  to: z.ZodOptional<z.ZodString>;
25
96
  };
97
+ /** Shared optional input for tools that return image content blocks. */
98
+ export declare const includeImagesParam: {
99
+ include_images: z.ZodDefault<z.ZodBoolean>;
100
+ };
26
101
  /** Standard annotations for all Rewind tools (read-only, open-world). */
27
102
  export declare const READ_ONLY_ANNOTATIONS: {
28
103
  readOnlyHint: true;
29
104
  destructiveHint: false;
105
+ idempotentHint: true;
30
106
  openWorldHint: true;
31
107
  };
32
108
  export type { RewindClient };
@@ -1,21 +1,136 @@
1
1
  import { z } from 'zod';
2
+ // ─── Content block builders ──────────────────────────────────────────
3
+ /** Build a text content block. */
4
+ export function text(value) {
5
+ return { type: 'text', text: value };
6
+ }
7
+ /**
8
+ * Build a resource_link content block.
9
+ * Returns null if the URI is missing/empty so callers can `.filter(Boolean)`.
10
+ */
11
+ export function resourceLink(uri, name, opts) {
12
+ if (!uri)
13
+ return null;
14
+ const block = { type: 'resource_link', uri, name };
15
+ if (opts?.mimeType)
16
+ block.mimeType = opts.mimeType;
17
+ if (opts?.description)
18
+ block.description = opts.description;
19
+ return block;
20
+ }
21
+ /**
22
+ * Build an image content block from an entity's image attachment by fetching
23
+ * the public CDN URL directly. Returns null on any failure or missing URL --
24
+ * never throws. Image blocks are best-effort; we always want to return
25
+ * text/data even if the image fetch breaks.
26
+ *
27
+ * Pass `targetPx` to request a smaller transform -- overrides the `width` and
28
+ * `height` query params on the CDN URL. Useful for list tools that must stay
29
+ * under the client's per-response size budget. Omit for full-size (typically
30
+ * 300x300) detail-tool posters.
31
+ */
32
+ export async function imageBlock(client, image, targetPx) {
33
+ if (!image)
34
+ return null;
35
+ let url = image.cdn_url ?? image.url ?? null;
36
+ if (!url)
37
+ return null;
38
+ if (targetPx)
39
+ url = resizeCdnUrl(url, targetPx);
40
+ try {
41
+ const { bytes, mimeType } = await client.getBinaryFromUrl(url);
42
+ return {
43
+ type: 'image',
44
+ data: bytesToBase64(bytes),
45
+ mimeType,
46
+ };
47
+ }
48
+ catch {
49
+ return null;
50
+ }
51
+ }
52
+ /**
53
+ * Rewrite a Rewind CDN URL to use the Cloudflare Images transform path
54
+ * (`/cdn-cgi/image/<opts>/<asset>`) at the requested pixel size. The raw
55
+ * `cdn_url` field returned by the API points at the original (full-res) R2
56
+ * object and does not honor width/height query params. Transform URLs do.
57
+ *
58
+ * Input: https://cdn.rewind.rest/watching/movies/707/original.jpg?width=300&height=300&...&v=1
59
+ * Output: https://cdn.rewind.rest/cdn-cgi/image/width=150,height=150,fit=cover,format=auto,quality=85/watching/movies/707/original.jpg?v=1
60
+ *
61
+ * Returns the input unchanged if it is not a valid URL or is already a
62
+ * transform URL.
63
+ */
64
+ function resizeCdnUrl(url, targetPx) {
65
+ try {
66
+ const u = new URL(url);
67
+ if (u.pathname.startsWith('/cdn-cgi/image/'))
68
+ return url;
69
+ const opts = `width=${targetPx},height=${targetPx},fit=cover,format=auto,quality=85`;
70
+ const version = u.searchParams.get('v');
71
+ const versionSuffix = version ? `?v=${version}` : '';
72
+ return `${u.origin}/cdn-cgi/image/${opts}${u.pathname}${versionSuffix}`;
73
+ }
74
+ catch {
75
+ return url;
76
+ }
77
+ }
78
+ /** Target pixel size for list-tool image blocks. Keeps responses under ~250KB. */
79
+ export const LIST_IMAGE_PX = 150;
2
80
  /**
3
- * Wrap a tool handler with standard error handling.
81
+ * Convert bytes to base64. Uses globalThis.Buffer when available (Node / Workers),
82
+ * falls back to a manual encoding that works in any JS runtime.
83
+ */
84
+ function bytesToBase64(bytes) {
85
+ const g = globalThis;
86
+ if (g.Buffer)
87
+ return g.Buffer.from(bytes).toString('base64');
88
+ let binary = '';
89
+ for (let i = 0; i < bytes.length; i++)
90
+ binary += String.fromCharCode(bytes[i]);
91
+ return btoa(binary);
92
+ }
93
+ // ─── Response wrappers ───────────────────────────────────────────────
94
+ /**
95
+ * Wrap a tool handler that returns only text.
4
96
  * Returns { content, isError: true } on failure.
5
97
  */
6
98
  export async function withErrorHandling(fn) {
7
99
  try {
8
- const text = await fn();
9
- return { content: [{ type: 'text', text }] };
100
+ const textValue = await fn();
101
+ return { content: [text(textValue)] };
102
+ }
103
+ catch (error) {
104
+ const message = error instanceof Error ? error.message : String(error);
105
+ return {
106
+ content: [text(`Error: ${message}`)],
107
+ isError: true,
108
+ };
109
+ }
110
+ }
111
+ /**
112
+ * Wrap a tool handler that returns a rich response (text + images + resource_links + structuredContent).
113
+ * Returns a well-formed error ToolResult on failure.
114
+ *
115
+ * Callers should construct content arrays via the builders above and filter nulls:
116
+ * return {
117
+ * content: [text(summary), ...blocks.filter(Boolean)],
118
+ * structuredContent: data,
119
+ * };
120
+ */
121
+ export async function withRichResponse(fn) {
122
+ try {
123
+ return await fn();
10
124
  }
11
125
  catch (error) {
12
126
  const message = error instanceof Error ? error.message : String(error);
13
127
  return {
14
- content: [{ type: 'text', text: `Error: ${message}` }],
128
+ content: [text(`Error: ${message}`)],
15
129
  isError: true,
16
130
  };
17
131
  }
18
132
  }
133
+ // ─── Existing utilities (unchanged) ──────────────────────────────────
19
134
  /** Format a date string as "Jan 15, 2025" */
20
135
  export function formatDate(iso) {
21
136
  if (!iso)
@@ -48,6 +163,17 @@ export function fmt(n) {
48
163
  return '0';
49
164
  return n.toLocaleString('en-US');
50
165
  }
166
+ /**
167
+ * Format a Letterboxd-style 0-5 star user rating. The Rewind API stores
168
+ * these in the 0-5 half-star range (e.g. 4.5 = four and a half stars).
169
+ * Renders as "4.5★" or "4★" -- never "4/10", which is a different scale.
170
+ */
171
+ export function formatStars(r) {
172
+ if (r === null || r === undefined)
173
+ return '';
174
+ const display = r % 1 === 0 ? r.toFixed(0) : r.toFixed(1);
175
+ return `${display}★`;
176
+ }
51
177
  /** Common date filter params reused across tools. */
52
178
  export const dateFilterParams = {
53
179
  date: z
@@ -60,10 +186,18 @@ export const dateFilterParams = {
60
186
  .describe('Optional: start of date range (ISO 8601)'),
61
187
  to: z.string().optional().describe('Optional: end of date range (ISO 8601)'),
62
188
  };
189
+ /** Shared optional input for tools that return image content blocks. */
190
+ export const includeImagesParam = {
191
+ include_images: z
192
+ .boolean()
193
+ .default(true)
194
+ .describe('Include artwork/poster image content blocks in the response. Default true. Set false to keep responses small.'),
195
+ };
63
196
  /** Standard annotations for all Rewind tools (read-only, open-world). */
64
197
  export const READ_ONLY_ANNOTATIONS = {
65
198
  readOnlyHint: true,
66
199
  destructiveHint: false,
200
+ idempotentHint: true,
67
201
  openWorldHint: true,
68
202
  };
69
203
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/tools/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,EAAyB;IAEzB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,EAAE,CAAC;QACxB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC;YACtD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,UAAU,CAAC,GAA8B;IACvD,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,OAA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