ofw-mcp 2.3.1 → 2.4.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.
@@ -1,12 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import { jsonResponse } from './_shared.js';
3
+ import { getWriteMode } from '../config.js';
3
4
  export function registerJournalTools(server, client) {
5
+ // Journal writes land on the court-visible record — OFW_WRITE_MODE 'all' only.
6
+ const allowWrites = getWriteMode() === 'all';
4
7
  server.registerTool('ofw_list_journal_entries', {
5
8
  description: 'List OurFamilyWizard journal entries',
6
9
  annotations: { readOnlyHint: true },
7
10
  inputSchema: {
8
- start: z.number().describe('Start offset (default 1)').optional(),
9
- max: z.number().describe('Max results (default 10)').optional(),
11
+ start: z.number().int().min(1).describe('Start offset (default 1)').optional(),
12
+ max: z.number().int().min(1).describe('Max results (default 10)').optional(),
10
13
  },
11
14
  }, async (args) => {
12
15
  // Journal API uses 1-based offset (unlike expenses which start at 0)
@@ -15,15 +18,16 @@ export function registerJournalTools(server, client) {
15
18
  const data = await client.request('GET', `/pub/v1/journals?start=${start}&max=${max}`);
16
19
  return jsonResponse(data);
17
20
  });
18
- server.registerTool('ofw_create_journal_entry', {
19
- description: 'Create a new journal entry in OurFamilyWizard',
20
- annotations: { destructiveHint: false },
21
- inputSchema: {
22
- title: z.string().describe('Entry title'),
23
- body: z.string().describe('Entry text content'),
24
- },
25
- }, async (args) => {
26
- const data = await client.request('POST', '/pub/v1/journals', args);
27
- return jsonResponse(data);
28
- });
21
+ if (allowWrites)
22
+ server.registerTool('ofw_create_journal_entry', {
23
+ description: 'Create a new journal entry in OurFamilyWizard',
24
+ annotations: { destructiveHint: false },
25
+ inputSchema: {
26
+ title: z.string().describe('Entry title'),
27
+ body: z.string().describe('Entry text content'),
28
+ },
29
+ }, async (args) => {
30
+ const data = await client.request('POST', '/pub/v1/journals', args);
31
+ return jsonResponse(data);
32
+ });
29
33
  }