c64-debug-mcp 1.0.8 → 1.0.10

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/dist/http.cjs CHANGED
@@ -153,15 +153,6 @@ var import_zod3 = require("zod");
153
153
  var import_zod2 = require("zod");
154
154
  var warningSchema = warningItemSchema;
155
155
  function parseAddress16(input) {
156
- if (input === void 0) {
157
- throw new import_zod2.z.ZodError([
158
- {
159
- code: "custom",
160
- message: "Address is required",
161
- path: []
162
- }
163
- ]);
164
- }
165
156
  if (typeof input === "number") {
166
157
  if (!Number.isInteger(input) || input < 0 || input > 65535) {
167
158
  throw new import_zod2.z.ZodError([
@@ -224,15 +215,6 @@ function parseAddress16(input) {
224
215
  }
225
216
  var address16Schema = import_zod2.z.preprocess(parseAddress16, import_zod2.z.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
226
217
  function parseByte(input) {
227
- if (input === void 0) {
228
- throw new import_zod2.z.ZodError([
229
- {
230
- code: "custom",
231
- message: "Byte value is required",
232
- path: []
233
- }
234
- ]);
235
- }
236
218
  if (typeof input === "number") {
237
219
  if (!Number.isInteger(input) || input < 0 || input > 255) {
238
220
  throw new import_zod2.z.ZodError([
@@ -3664,30 +3646,33 @@ var readMemoryTool = createViceTool({
3664
3646
  start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3665
3647
  end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
3666
3648
  })
3667
- ]).transform((input) => {
3668
- if ("start" in input && "end" in input) {
3669
- if (input.end < input.start) {
3670
- throw new Error("End address must be greater than or equal to start address");
3671
- }
3672
- return {
3673
- address: input.start,
3674
- length: input.end - input.start + 1
3675
- };
3676
- }
3677
- return input;
3678
- }).refine((input) => input.address + input.length <= 65536, {
3679
- message: "address + length must stay within the 64K address space",
3680
- path: ["length"]
3681
- }),
3649
+ ]),
3682
3650
  dataSchema: import_zod4.z.object({
3683
3651
  address: address16Schema.describe("Start address of the returned memory chunk"),
3684
3652
  length: import_zod4.z.number().int().min(0).describe("Number of bytes returned"),
3685
3653
  data: byteArraySchema.describe("Raw bytes returned from memory")
3686
3654
  }),
3687
3655
  execute: async (input) => {
3688
- const result = await c64Session.readMemory(input.address, input.address + input.length - 1);
3656
+ let address;
3657
+ let length;
3658
+ if ("start" in input && "end" in input) {
3659
+ if (input.end < input.start) {
3660
+ throw new Error("End address must be greater than or equal to start address");
3661
+ }
3662
+ address = input.start;
3663
+ length = input.end - input.start + 1;
3664
+ } else if ("address" in input && "length" in input) {
3665
+ address = input.address;
3666
+ length = input.length;
3667
+ } else {
3668
+ throw new Error("Invalid input: must provide either (address, length) or (start, end)");
3669
+ }
3670
+ if (address + length > 65536) {
3671
+ throw new Error("address + length must stay within the 64K address space");
3672
+ }
3673
+ const result = await c64Session.readMemory(address, address + length - 1);
3689
3674
  return {
3690
- address: input.address,
3675
+ address,
3691
3676
  length: result.length,
3692
3677
  data: result.data
3693
3678
  };
@@ -3755,36 +3740,26 @@ var listBreakpointsTool = createViceTool({
3755
3740
  var breakpointSetTool = createViceTool({
3756
3741
  id: "breakpoint_set",
3757
3742
  description: "Creates an execution breakpoint or read/write watchpoint. Use either (address, length) or (start, end) format. Addresses can be decimal (53248) or hex string with prefix ($D000, 0xD000).",
3758
- inputSchema: import_zod4.z.object({
3759
- kind: breakpointKindSchema,
3760
- condition: import_zod4.z.string().optional(),
3761
- label: import_zod4.z.string().optional(),
3762
- temporary: import_zod4.z.boolean().default(false),
3763
- enabled: import_zod4.z.boolean().default(true)
3764
- }).and(
3765
- import_zod4.z.union([
3766
- import_zod4.z.object({
3767
- address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3768
- length: import_zod4.z.number().int().positive().default(1).describe("Size of the breakpoint range in bytes")
3769
- }),
3770
- import_zod4.z.object({
3771
- start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3772
- end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
3773
- })
3774
- ])
3775
- ).transform((input) => {
3776
- if ("start" in input && "end" in input) {
3777
- if (input.end < input.start) {
3778
- throw new Error("End address must be greater than or equal to start address");
3779
- }
3780
- return {
3781
- ...input,
3782
- address: input.start,
3783
- length: input.end - input.start + 1
3784
- };
3785
- }
3786
- return input;
3787
- }),
3743
+ inputSchema: import_zod4.z.union([
3744
+ import_zod4.z.object({
3745
+ kind: breakpointKindSchema,
3746
+ address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3747
+ length: import_zod4.z.number().int().positive().default(1).describe("Size of the breakpoint range in bytes"),
3748
+ condition: import_zod4.z.string().optional(),
3749
+ label: import_zod4.z.string().optional(),
3750
+ temporary: import_zod4.z.boolean().default(false),
3751
+ enabled: import_zod4.z.boolean().default(true)
3752
+ }),
3753
+ import_zod4.z.object({
3754
+ kind: breakpointKindSchema,
3755
+ start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3756
+ end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3757
+ condition: import_zod4.z.string().optional(),
3758
+ label: import_zod4.z.string().optional(),
3759
+ temporary: import_zod4.z.boolean().default(false),
3760
+ enabled: import_zod4.z.boolean().default(true)
3761
+ })
3762
+ ]),
3788
3763
  dataSchema: import_zod4.z.object({
3789
3764
  breakpoint: breakpointSchema,
3790
3765
  executionState: executionStateSchema,
@@ -3793,7 +3768,34 @@ var breakpointSetTool = createViceTool({
3793
3768
  registers: c64PartialRegisterValueSchema.nullable()
3794
3769
  }),
3795
3770
  execute: async (input) => {
3796
- const result = await c64Session.breakpointSet(input);
3771
+ let normalizedInput;
3772
+ if ("start" in input && "end" in input) {
3773
+ if (input.end < input.start) {
3774
+ throw new Error("End address must be greater than or equal to start address");
3775
+ }
3776
+ normalizedInput = {
3777
+ kind: input.kind,
3778
+ address: input.start,
3779
+ length: input.end - input.start + 1,
3780
+ condition: input.condition,
3781
+ label: input.label,
3782
+ temporary: input.temporary,
3783
+ enabled: input.enabled
3784
+ };
3785
+ } else if ("address" in input && "length" in input) {
3786
+ normalizedInput = {
3787
+ kind: input.kind,
3788
+ address: input.address,
3789
+ length: input.length,
3790
+ condition: input.condition,
3791
+ label: input.label,
3792
+ temporary: input.temporary,
3793
+ enabled: input.enabled
3794
+ };
3795
+ } else {
3796
+ throw new Error("Invalid input: must provide either (address, length) or (start, end)");
3797
+ }
3798
+ const result = await c64Session.breakpointSet(normalizedInput);
3797
3799
  return {
3798
3800
  breakpoint: normalizeBreakpoint(result.breakpoint),
3799
3801
  executionState: result.executionState,
package/dist/http.js CHANGED
@@ -130,15 +130,6 @@ import { ZodError } from "zod";
130
130
  import { z as z2 } from "zod";
131
131
  var warningSchema = warningItemSchema;
132
132
  function parseAddress16(input) {
133
- if (input === void 0) {
134
- throw new z2.ZodError([
135
- {
136
- code: "custom",
137
- message: "Address is required",
138
- path: []
139
- }
140
- ]);
141
- }
142
133
  if (typeof input === "number") {
143
134
  if (!Number.isInteger(input) || input < 0 || input > 65535) {
144
135
  throw new z2.ZodError([
@@ -201,15 +192,6 @@ function parseAddress16(input) {
201
192
  }
202
193
  var address16Schema = z2.preprocess(parseAddress16, z2.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
203
194
  function parseByte(input) {
204
- if (input === void 0) {
205
- throw new z2.ZodError([
206
- {
207
- code: "custom",
208
- message: "Byte value is required",
209
- path: []
210
- }
211
- ]);
212
- }
213
195
  if (typeof input === "number") {
214
196
  if (!Number.isInteger(input) || input < 0 || input > 255) {
215
197
  throw new z2.ZodError([
@@ -3641,30 +3623,33 @@ var readMemoryTool = createViceTool({
3641
3623
  start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3642
3624
  end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
3643
3625
  })
3644
- ]).transform((input) => {
3645
- if ("start" in input && "end" in input) {
3646
- if (input.end < input.start) {
3647
- throw new Error("End address must be greater than or equal to start address");
3648
- }
3649
- return {
3650
- address: input.start,
3651
- length: input.end - input.start + 1
3652
- };
3653
- }
3654
- return input;
3655
- }).refine((input) => input.address + input.length <= 65536, {
3656
- message: "address + length must stay within the 64K address space",
3657
- path: ["length"]
3658
- }),
3626
+ ]),
3659
3627
  dataSchema: z3.object({
3660
3628
  address: address16Schema.describe("Start address of the returned memory chunk"),
3661
3629
  length: z3.number().int().min(0).describe("Number of bytes returned"),
3662
3630
  data: byteArraySchema.describe("Raw bytes returned from memory")
3663
3631
  }),
3664
3632
  execute: async (input) => {
3665
- const result = await c64Session.readMemory(input.address, input.address + input.length - 1);
3633
+ let address;
3634
+ let length;
3635
+ if ("start" in input && "end" in input) {
3636
+ if (input.end < input.start) {
3637
+ throw new Error("End address must be greater than or equal to start address");
3638
+ }
3639
+ address = input.start;
3640
+ length = input.end - input.start + 1;
3641
+ } else if ("address" in input && "length" in input) {
3642
+ address = input.address;
3643
+ length = input.length;
3644
+ } else {
3645
+ throw new Error("Invalid input: must provide either (address, length) or (start, end)");
3646
+ }
3647
+ if (address + length > 65536) {
3648
+ throw new Error("address + length must stay within the 64K address space");
3649
+ }
3650
+ const result = await c64Session.readMemory(address, address + length - 1);
3666
3651
  return {
3667
- address: input.address,
3652
+ address,
3668
3653
  length: result.length,
3669
3654
  data: result.data
3670
3655
  };
@@ -3732,36 +3717,26 @@ var listBreakpointsTool = createViceTool({
3732
3717
  var breakpointSetTool = createViceTool({
3733
3718
  id: "breakpoint_set",
3734
3719
  description: "Creates an execution breakpoint or read/write watchpoint. Use either (address, length) or (start, end) format. Addresses can be decimal (53248) or hex string with prefix ($D000, 0xD000).",
3735
- inputSchema: z3.object({
3736
- kind: breakpointKindSchema,
3737
- condition: z3.string().optional(),
3738
- label: z3.string().optional(),
3739
- temporary: z3.boolean().default(false),
3740
- enabled: z3.boolean().default(true)
3741
- }).and(
3742
- z3.union([
3743
- z3.object({
3744
- address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3745
- length: z3.number().int().positive().default(1).describe("Size of the breakpoint range in bytes")
3746
- }),
3747
- z3.object({
3748
- start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3749
- end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
3750
- })
3751
- ])
3752
- ).transform((input) => {
3753
- if ("start" in input && "end" in input) {
3754
- if (input.end < input.start) {
3755
- throw new Error("End address must be greater than or equal to start address");
3756
- }
3757
- return {
3758
- ...input,
3759
- address: input.start,
3760
- length: input.end - input.start + 1
3761
- };
3762
- }
3763
- return input;
3764
- }),
3720
+ inputSchema: z3.union([
3721
+ z3.object({
3722
+ kind: breakpointKindSchema,
3723
+ address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3724
+ length: z3.number().int().positive().default(1).describe("Size of the breakpoint range in bytes"),
3725
+ condition: z3.string().optional(),
3726
+ label: z3.string().optional(),
3727
+ temporary: z3.boolean().default(false),
3728
+ enabled: z3.boolean().default(true)
3729
+ }),
3730
+ z3.object({
3731
+ kind: breakpointKindSchema,
3732
+ start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3733
+ end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3734
+ condition: z3.string().optional(),
3735
+ label: z3.string().optional(),
3736
+ temporary: z3.boolean().default(false),
3737
+ enabled: z3.boolean().default(true)
3738
+ })
3739
+ ]),
3765
3740
  dataSchema: z3.object({
3766
3741
  breakpoint: breakpointSchema,
3767
3742
  executionState: executionStateSchema,
@@ -3770,7 +3745,34 @@ var breakpointSetTool = createViceTool({
3770
3745
  registers: c64PartialRegisterValueSchema.nullable()
3771
3746
  }),
3772
3747
  execute: async (input) => {
3773
- const result = await c64Session.breakpointSet(input);
3748
+ let normalizedInput;
3749
+ if ("start" in input && "end" in input) {
3750
+ if (input.end < input.start) {
3751
+ throw new Error("End address must be greater than or equal to start address");
3752
+ }
3753
+ normalizedInput = {
3754
+ kind: input.kind,
3755
+ address: input.start,
3756
+ length: input.end - input.start + 1,
3757
+ condition: input.condition,
3758
+ label: input.label,
3759
+ temporary: input.temporary,
3760
+ enabled: input.enabled
3761
+ };
3762
+ } else if ("address" in input && "length" in input) {
3763
+ normalizedInput = {
3764
+ kind: input.kind,
3765
+ address: input.address,
3766
+ length: input.length,
3767
+ condition: input.condition,
3768
+ label: input.label,
3769
+ temporary: input.temporary,
3770
+ enabled: input.enabled
3771
+ };
3772
+ } else {
3773
+ throw new Error("Invalid input: must provide either (address, length) or (start, end)");
3774
+ }
3775
+ const result = await c64Session.breakpointSet(normalizedInput);
3774
3776
  return {
3775
3777
  breakpoint: normalizeBreakpoint(result.breakpoint),
3776
3778
  executionState: result.executionState,
package/dist/stdio.cjs CHANGED
@@ -150,15 +150,6 @@ var import_zod3 = require("zod");
150
150
  var import_zod2 = require("zod");
151
151
  var warningSchema = warningItemSchema;
152
152
  function parseAddress16(input) {
153
- if (input === void 0) {
154
- throw new import_zod2.z.ZodError([
155
- {
156
- code: "custom",
157
- message: "Address is required",
158
- path: []
159
- }
160
- ]);
161
- }
162
153
  if (typeof input === "number") {
163
154
  if (!Number.isInteger(input) || input < 0 || input > 65535) {
164
155
  throw new import_zod2.z.ZodError([
@@ -221,15 +212,6 @@ function parseAddress16(input) {
221
212
  }
222
213
  var address16Schema = import_zod2.z.preprocess(parseAddress16, import_zod2.z.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
223
214
  function parseByte(input) {
224
- if (input === void 0) {
225
- throw new import_zod2.z.ZodError([
226
- {
227
- code: "custom",
228
- message: "Byte value is required",
229
- path: []
230
- }
231
- ]);
232
- }
233
215
  if (typeof input === "number") {
234
216
  if (!Number.isInteger(input) || input < 0 || input > 255) {
235
217
  throw new import_zod2.z.ZodError([
@@ -3661,30 +3643,33 @@ var readMemoryTool = createViceTool({
3661
3643
  start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3662
3644
  end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
3663
3645
  })
3664
- ]).transform((input) => {
3665
- if ("start" in input && "end" in input) {
3666
- if (input.end < input.start) {
3667
- throw new Error("End address must be greater than or equal to start address");
3668
- }
3669
- return {
3670
- address: input.start,
3671
- length: input.end - input.start + 1
3672
- };
3673
- }
3674
- return input;
3675
- }).refine((input) => input.address + input.length <= 65536, {
3676
- message: "address + length must stay within the 64K address space",
3677
- path: ["length"]
3678
- }),
3646
+ ]),
3679
3647
  dataSchema: import_zod4.z.object({
3680
3648
  address: address16Schema.describe("Start address of the returned memory chunk"),
3681
3649
  length: import_zod4.z.number().int().min(0).describe("Number of bytes returned"),
3682
3650
  data: byteArraySchema.describe("Raw bytes returned from memory")
3683
3651
  }),
3684
3652
  execute: async (input) => {
3685
- const result = await c64Session.readMemory(input.address, input.address + input.length - 1);
3653
+ let address;
3654
+ let length;
3655
+ if ("start" in input && "end" in input) {
3656
+ if (input.end < input.start) {
3657
+ throw new Error("End address must be greater than or equal to start address");
3658
+ }
3659
+ address = input.start;
3660
+ length = input.end - input.start + 1;
3661
+ } else if ("address" in input && "length" in input) {
3662
+ address = input.address;
3663
+ length = input.length;
3664
+ } else {
3665
+ throw new Error("Invalid input: must provide either (address, length) or (start, end)");
3666
+ }
3667
+ if (address + length > 65536) {
3668
+ throw new Error("address + length must stay within the 64K address space");
3669
+ }
3670
+ const result = await c64Session.readMemory(address, address + length - 1);
3686
3671
  return {
3687
- address: input.address,
3672
+ address,
3688
3673
  length: result.length,
3689
3674
  data: result.data
3690
3675
  };
@@ -3752,36 +3737,26 @@ var listBreakpointsTool = createViceTool({
3752
3737
  var breakpointSetTool = createViceTool({
3753
3738
  id: "breakpoint_set",
3754
3739
  description: "Creates an execution breakpoint or read/write watchpoint. Use either (address, length) or (start, end) format. Addresses can be decimal (53248) or hex string with prefix ($D000, 0xD000).",
3755
- inputSchema: import_zod4.z.object({
3756
- kind: breakpointKindSchema,
3757
- condition: import_zod4.z.string().optional(),
3758
- label: import_zod4.z.string().optional(),
3759
- temporary: import_zod4.z.boolean().default(false),
3760
- enabled: import_zod4.z.boolean().default(true)
3761
- }).and(
3762
- import_zod4.z.union([
3763
- import_zod4.z.object({
3764
- address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3765
- length: import_zod4.z.number().int().positive().default(1).describe("Size of the breakpoint range in bytes")
3766
- }),
3767
- import_zod4.z.object({
3768
- start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3769
- end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
3770
- })
3771
- ])
3772
- ).transform((input) => {
3773
- if ("start" in input && "end" in input) {
3774
- if (input.end < input.start) {
3775
- throw new Error("End address must be greater than or equal to start address");
3776
- }
3777
- return {
3778
- ...input,
3779
- address: input.start,
3780
- length: input.end - input.start + 1
3781
- };
3782
- }
3783
- return input;
3784
- }),
3740
+ inputSchema: import_zod4.z.union([
3741
+ import_zod4.z.object({
3742
+ kind: breakpointKindSchema,
3743
+ address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3744
+ length: import_zod4.z.number().int().positive().default(1).describe("Size of the breakpoint range in bytes"),
3745
+ condition: import_zod4.z.string().optional(),
3746
+ label: import_zod4.z.string().optional(),
3747
+ temporary: import_zod4.z.boolean().default(false),
3748
+ enabled: import_zod4.z.boolean().default(true)
3749
+ }),
3750
+ import_zod4.z.object({
3751
+ kind: breakpointKindSchema,
3752
+ start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3753
+ end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3754
+ condition: import_zod4.z.string().optional(),
3755
+ label: import_zod4.z.string().optional(),
3756
+ temporary: import_zod4.z.boolean().default(false),
3757
+ enabled: import_zod4.z.boolean().default(true)
3758
+ })
3759
+ ]),
3785
3760
  dataSchema: import_zod4.z.object({
3786
3761
  breakpoint: breakpointSchema,
3787
3762
  executionState: executionStateSchema,
@@ -3790,7 +3765,34 @@ var breakpointSetTool = createViceTool({
3790
3765
  registers: c64PartialRegisterValueSchema.nullable()
3791
3766
  }),
3792
3767
  execute: async (input) => {
3793
- const result = await c64Session.breakpointSet(input);
3768
+ let normalizedInput;
3769
+ if ("start" in input && "end" in input) {
3770
+ if (input.end < input.start) {
3771
+ throw new Error("End address must be greater than or equal to start address");
3772
+ }
3773
+ normalizedInput = {
3774
+ kind: input.kind,
3775
+ address: input.start,
3776
+ length: input.end - input.start + 1,
3777
+ condition: input.condition,
3778
+ label: input.label,
3779
+ temporary: input.temporary,
3780
+ enabled: input.enabled
3781
+ };
3782
+ } else if ("address" in input && "length" in input) {
3783
+ normalizedInput = {
3784
+ kind: input.kind,
3785
+ address: input.address,
3786
+ length: input.length,
3787
+ condition: input.condition,
3788
+ label: input.label,
3789
+ temporary: input.temporary,
3790
+ enabled: input.enabled
3791
+ };
3792
+ } else {
3793
+ throw new Error("Invalid input: must provide either (address, length) or (start, end)");
3794
+ }
3795
+ const result = await c64Session.breakpointSet(normalizedInput);
3794
3796
  return {
3795
3797
  breakpoint: normalizeBreakpoint(result.breakpoint),
3796
3798
  executionState: result.executionState,
package/dist/stdio.js CHANGED
@@ -127,15 +127,6 @@ import { ZodError } from "zod";
127
127
  import { z as z2 } from "zod";
128
128
  var warningSchema = warningItemSchema;
129
129
  function parseAddress16(input) {
130
- if (input === void 0) {
131
- throw new z2.ZodError([
132
- {
133
- code: "custom",
134
- message: "Address is required",
135
- path: []
136
- }
137
- ]);
138
- }
139
130
  if (typeof input === "number") {
140
131
  if (!Number.isInteger(input) || input < 0 || input > 65535) {
141
132
  throw new z2.ZodError([
@@ -198,15 +189,6 @@ function parseAddress16(input) {
198
189
  }
199
190
  var address16Schema = z2.preprocess(parseAddress16, z2.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
200
191
  function parseByte(input) {
201
- if (input === void 0) {
202
- throw new z2.ZodError([
203
- {
204
- code: "custom",
205
- message: "Byte value is required",
206
- path: []
207
- }
208
- ]);
209
- }
210
192
  if (typeof input === "number") {
211
193
  if (!Number.isInteger(input) || input < 0 || input > 255) {
212
194
  throw new z2.ZodError([
@@ -3638,30 +3620,33 @@ var readMemoryTool = createViceTool({
3638
3620
  start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3639
3621
  end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
3640
3622
  })
3641
- ]).transform((input) => {
3642
- if ("start" in input && "end" in input) {
3643
- if (input.end < input.start) {
3644
- throw new Error("End address must be greater than or equal to start address");
3645
- }
3646
- return {
3647
- address: input.start,
3648
- length: input.end - input.start + 1
3649
- };
3650
- }
3651
- return input;
3652
- }).refine((input) => input.address + input.length <= 65536, {
3653
- message: "address + length must stay within the 64K address space",
3654
- path: ["length"]
3655
- }),
3623
+ ]),
3656
3624
  dataSchema: z3.object({
3657
3625
  address: address16Schema.describe("Start address of the returned memory chunk"),
3658
3626
  length: z3.number().int().min(0).describe("Number of bytes returned"),
3659
3627
  data: byteArraySchema.describe("Raw bytes returned from memory")
3660
3628
  }),
3661
3629
  execute: async (input) => {
3662
- const result = await c64Session.readMemory(input.address, input.address + input.length - 1);
3630
+ let address;
3631
+ let length;
3632
+ if ("start" in input && "end" in input) {
3633
+ if (input.end < input.start) {
3634
+ throw new Error("End address must be greater than or equal to start address");
3635
+ }
3636
+ address = input.start;
3637
+ length = input.end - input.start + 1;
3638
+ } else if ("address" in input && "length" in input) {
3639
+ address = input.address;
3640
+ length = input.length;
3641
+ } else {
3642
+ throw new Error("Invalid input: must provide either (address, length) or (start, end)");
3643
+ }
3644
+ if (address + length > 65536) {
3645
+ throw new Error("address + length must stay within the 64K address space");
3646
+ }
3647
+ const result = await c64Session.readMemory(address, address + length - 1);
3663
3648
  return {
3664
- address: input.address,
3649
+ address,
3665
3650
  length: result.length,
3666
3651
  data: result.data
3667
3652
  };
@@ -3729,36 +3714,26 @@ var listBreakpointsTool = createViceTool({
3729
3714
  var breakpointSetTool = createViceTool({
3730
3715
  id: "breakpoint_set",
3731
3716
  description: "Creates an execution breakpoint or read/write watchpoint. Use either (address, length) or (start, end) format. Addresses can be decimal (53248) or hex string with prefix ($D000, 0xD000).",
3732
- inputSchema: z3.object({
3733
- kind: breakpointKindSchema,
3734
- condition: z3.string().optional(),
3735
- label: z3.string().optional(),
3736
- temporary: z3.boolean().default(false),
3737
- enabled: z3.boolean().default(true)
3738
- }).and(
3739
- z3.union([
3740
- z3.object({
3741
- address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3742
- length: z3.number().int().positive().default(1).describe("Size of the breakpoint range in bytes")
3743
- }),
3744
- z3.object({
3745
- start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3746
- end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
3747
- })
3748
- ])
3749
- ).transform((input) => {
3750
- if ("start" in input && "end" in input) {
3751
- if (input.end < input.start) {
3752
- throw new Error("End address must be greater than or equal to start address");
3753
- }
3754
- return {
3755
- ...input,
3756
- address: input.start,
3757
- length: input.end - input.start + 1
3758
- };
3759
- }
3760
- return input;
3761
- }),
3717
+ inputSchema: z3.union([
3718
+ z3.object({
3719
+ kind: breakpointKindSchema,
3720
+ address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3721
+ length: z3.number().int().positive().default(1).describe("Size of the breakpoint range in bytes"),
3722
+ condition: z3.string().optional(),
3723
+ label: z3.string().optional(),
3724
+ temporary: z3.boolean().default(false),
3725
+ enabled: z3.boolean().default(true)
3726
+ }),
3727
+ z3.object({
3728
+ kind: breakpointKindSchema,
3729
+ start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3730
+ end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
3731
+ condition: z3.string().optional(),
3732
+ label: z3.string().optional(),
3733
+ temporary: z3.boolean().default(false),
3734
+ enabled: z3.boolean().default(true)
3735
+ })
3736
+ ]),
3762
3737
  dataSchema: z3.object({
3763
3738
  breakpoint: breakpointSchema,
3764
3739
  executionState: executionStateSchema,
@@ -3767,7 +3742,34 @@ var breakpointSetTool = createViceTool({
3767
3742
  registers: c64PartialRegisterValueSchema.nullable()
3768
3743
  }),
3769
3744
  execute: async (input) => {
3770
- const result = await c64Session.breakpointSet(input);
3745
+ let normalizedInput;
3746
+ if ("start" in input && "end" in input) {
3747
+ if (input.end < input.start) {
3748
+ throw new Error("End address must be greater than or equal to start address");
3749
+ }
3750
+ normalizedInput = {
3751
+ kind: input.kind,
3752
+ address: input.start,
3753
+ length: input.end - input.start + 1,
3754
+ condition: input.condition,
3755
+ label: input.label,
3756
+ temporary: input.temporary,
3757
+ enabled: input.enabled
3758
+ };
3759
+ } else if ("address" in input && "length" in input) {
3760
+ normalizedInput = {
3761
+ kind: input.kind,
3762
+ address: input.address,
3763
+ length: input.length,
3764
+ condition: input.condition,
3765
+ label: input.label,
3766
+ temporary: input.temporary,
3767
+ enabled: input.enabled
3768
+ };
3769
+ } else {
3770
+ throw new Error("Invalid input: must provide either (address, length) or (start, end)");
3771
+ }
3772
+ const result = await c64Session.breakpointSet(normalizedInput);
3771
3773
  return {
3772
3774
  breakpoint: normalizeBreakpoint(result.breakpoint),
3773
3775
  executionState: result.executionState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c64-debug-mcp",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Model Context Protocol server for C64 debugging via VICE emulator",
5
5
  "type": "module",
6
6
  "keywords": [