ccusage 15.0.0 → 15.0.1

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/README.md CHANGED
@@ -589,7 +589,6 @@ some projects use `ccusage` internally and provide additional features:
589
589
 
590
590
  - [claude-usage-tracker-for-mac](https://github.com/penicillin0/claude-usage-tracker-for-mac) – macOS menu bar app to visualize Claude Code usage costs by [@penicillin0](https://github.com/penicillin0).
591
591
  - [ccusage Raycast Extension](https://www.raycast.com/nyatinte/ccusage) – Raycast extension to view Claude Code usage reports in Raycast by [@nyatinte](https://github.com/nyatinte).
592
- - [claude-code-usage-monitor](https://github.com/Maciek-roboblog/Claude-Code-Usage-Monitor) – A real-time terminal-based tool for monitoring Claude Code token usage. It displays live token consumption, burn rate, and depletion predictions, with session-aware analytics, visual progress bars, and support for multiple subscription plans by [@Maciek-roboblog](https://github.com/Maciek-roboblog).
593
592
  - [ClaudeCode_Dashboard](https://github.com/m-sigepon/ClaudeCode_Dashboard) – Web dashboard to visualize Claude Code usage with charts and USD/JPY conversion by [@m-sigepon](https://github.com/m-sigepon).
594
593
 
595
594
  ## Acknowledgments
@@ -600,7 +599,7 @@ Thanks to [@milliondev](https://note.com/milliondev) for the original concept an
600
599
 
601
600
  <p align="center">
602
601
  <a href="https://github.com/sponsors/ryoppippi">
603
- <img src="https://cdn.jsdelivr.net/gh/ryoppippi/sponsors/sponsors.svg">
602
+ <img src="https://cdn.jsdelivr.net/gh/ryoppippi/sponsors@main/sponsors.svg">
604
603
  </a>
605
604
  </p>
606
605
 
@@ -1,6 +1,6 @@
1
- import { CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_RECENT_DAYS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, __commonJSMin, __require, __toESM, require_usingCtx } from "./pricing-fetcher-CMyU5JUX.js";
1
+ import { CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_RECENT_DAYS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, __commonJSMin, __require, __toESM, require_usingCtx } from "./pricing-fetcher-DBzWmU38.js";
2
2
  import { activityDateSchema, arrayType, createDailyDate, createMonthlyDate, createProjectPath, createSessionId, dailyDateSchema, isoTimestampSchema, messageIdSchema, modelNameSchema, monthlyDateSchema, numberType, objectType, projectPathSchema, requestIdSchema, sessionIdSchema, versionSchema } from "./_types-Cr2YEzKm.js";
3
- import { logger } from "./logger-6I_KKR-u.js";
3
+ import { logger } from "./logger-r_DhIB_J.js";
4
4
  import a, { readFile } from "node:fs/promises";
5
5
  import F, { homedir } from "node:os";
6
6
  import path, { posix } from "node:path";
@@ -3065,6 +3065,16 @@ async function glob(patternsOrOptions, options) {
3065
3065
  */
3066
3066
  const DEFAULT_SESSION_DURATION_HOURS = 5;
3067
3067
  /**
3068
+ * Floors a timestamp to the beginning of the hour in UTC
3069
+ * @param timestamp - The timestamp to floor
3070
+ * @returns New Date object floored to the UTC hour
3071
+ */
3072
+ function floorToHour(timestamp) {
3073
+ const floored = new Date(timestamp);
3074
+ floored.setUTCMinutes(0, 0, 0);
3075
+ return floored;
3076
+ }
3077
+ /**
3068
3078
  * Identifies and creates session blocks from usage entries
3069
3079
  * Groups entries into time-based blocks (typically 5-hour periods) with gap detection
3070
3080
  * @param entries - Array of usage entries to process
@@ -3082,7 +3092,7 @@ function identifySessionBlocks(entries, sessionDurationHours = DEFAULT_SESSION_D
3082
3092
  for (const entry of sortedEntries) {
3083
3093
  const entryTime = entry.timestamp;
3084
3094
  if (currentBlockStart == null) {
3085
- currentBlockStart = entryTime;
3095
+ currentBlockStart = floorToHour(entryTime);
3086
3096
  currentBlockEntries = [entry];
3087
3097
  } else {
3088
3098
  const timeSinceBlockStart = entryTime.getTime() - currentBlockStart.getTime();
@@ -3097,7 +3107,7 @@ function identifySessionBlocks(entries, sessionDurationHours = DEFAULT_SESSION_D
3097
3107
  const gapBlock = createGapBlock(lastEntryTime, entryTime, sessionDurationMs);
3098
3108
  if (gapBlock != null) blocks.push(gapBlock);
3099
3109
  }
3100
- currentBlockStart = entryTime;
3110
+ currentBlockStart = floorToHour(entryTime);
3101
3111
  currentBlockEntries = [entry];
3102
3112
  } else currentBlockEntries.push(entry);
3103
3113
  }
@@ -1,5 +1,5 @@
1
- import "./pricing-fetcher-CMyU5JUX.js";
1
+ import "./pricing-fetcher-DBzWmU38.js";
2
2
  import "./_types-Cr2YEzKm.js";
3
- import { calculateCostForEntry, createUniqueHash, dailyUsageSchema, formatDate, formatDateCompact, getClaudePaths, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, usageDataSchema } from "./data-loader-B_ymgjWR.js";
4
- import "./logger-6I_KKR-u.js";
3
+ import { calculateCostForEntry, createUniqueHash, dailyUsageSchema, formatDate, formatDateCompact, getClaudePaths, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, usageDataSchema } from "./data-loader-DQftfBz9.js";
4
+ import "./logger-r_DhIB_J.js";
5
5
  export { calculateCostForEntry, createUniqueHash, dailyUsageSchema, formatDate, formatDateCompact, getClaudePaths, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, usageDataSchema };
@@ -1,6 +1,6 @@
1
- import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT, PricingFetcher, USAGE_DATA_GLOB_PATTERN, __toESM, require_usingCtx } from "./pricing-fetcher-CMyU5JUX.js";
2
- import { getDefaultClaudePath, glob, usageDataSchema } from "./data-loader-B_ymgjWR.js";
3
- import { logger } from "./logger-6I_KKR-u.js";
1
+ import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT, PricingFetcher, USAGE_DATA_GLOB_PATTERN, __toESM, require_usingCtx } from "./pricing-fetcher-DBzWmU38.js";
2
+ import { getDefaultClaudePath, glob, usageDataSchema } from "./data-loader-DQftfBz9.js";
3
+ import { logger } from "./logger-r_DhIB_J.js";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import path from "node:path";
6
6
  var import_usingCtx = __toESM(require_usingCtx(), 1);
package/dist/debug.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./pricing-fetcher-CMyU5JUX.js";
1
+ import "./pricing-fetcher-DBzWmU38.js";
2
2
  import "./_types-Cr2YEzKm.js";
3
- import "./data-loader-B_ymgjWR.js";
4
- import "./logger-6I_KKR-u.js";
5
- import { detectMismatches, printMismatchReport } from "./debug-2jwq04IT.js";
3
+ import "./data-loader-DQftfBz9.js";
4
+ import "./logger-r_DhIB_J.js";
5
+ import { detectMismatches, printMismatchReport } from "./debug-CXtWvV0a.js";
6
6
  export { detectMismatches, printMismatchReport };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, CLAUDE_PROJECTS_DIR_NAME, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS, MCP_DEFAULT_PORT, MIN_REFRESH_INTERVAL_SECONDS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, __commonJSMin, __require, __toESM, require_usingCtx } from "./pricing-fetcher-CMyU5JUX.js";
2
+ import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, CLAUDE_PROJECTS_DIR_NAME, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS, MCP_DEFAULT_PORT, MIN_REFRESH_INTERVAL_SECONDS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, __commonJSMin, __require, __toESM, require_usingCtx } from "./pricing-fetcher-DBzWmU38.js";
3
3
  import { CostModes, SortOrders, dateSchema } from "./_types-Cr2YEzKm.js";
4
4
  import { calculateTotals, createTotalsObject, getTotalTokens } from "./calculate-cost-CoS7we68.js";
5
- import { DEFAULT_SESSION_DURATION_HOURS, calculateBurnRate, calculateCostForEntry, createUniqueHash, filterRecentBlocks, formatDateCompact, getDefaultClaudePath, getEarliestTimestamp, glob, identifySessionBlocks, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, projectBlockUsage, sortFilesByTimestamp, uniq, usageDataSchema } from "./data-loader-B_ymgjWR.js";
6
- import { description, log, logger, name, version } from "./logger-6I_KKR-u.js";
7
- import { detectMismatches, printMismatchReport } from "./debug-2jwq04IT.js";
8
- import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-COnbPauf.js";
5
+ import { DEFAULT_SESSION_DURATION_HOURS, calculateBurnRate, calculateCostForEntry, createUniqueHash, filterRecentBlocks, formatDateCompact, getDefaultClaudePath, getEarliestTimestamp, glob, identifySessionBlocks, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, projectBlockUsage, sortFilesByTimestamp, uniq, usageDataSchema } from "./data-loader-DQftfBz9.js";
6
+ import { description, log, logger, name, version } from "./logger-r_DhIB_J.js";
7
+ import { detectMismatches, printMismatchReport } from "./debug-CXtWvV0a.js";
8
+ import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-C-EN2PDc.js";
9
9
  import { readFile } from "node:fs/promises";
10
10
  import path from "node:path";
11
11
  import process$1 from "node:process";
@@ -3777,7 +3777,7 @@ function renderLiveDisplay(terminal, block, config) {
3777
3777
  }) : `[${import_picocolors$4.default.green("█".repeat(Math.floor(barWidth * .1)))}${import_picocolors$4.default.gray("░".repeat(barWidth - Math.floor(barWidth * .1)))}]`;
3778
3778
  const burnRate = calculateBurnRate(block);
3779
3779
  const rateIndicator = burnRate != null ? burnRate.tokensPerMinute > 1e3 ? import_picocolors$4.default.red("⚡ HIGH") : burnRate.tokensPerMinute > 500 ? import_picocolors$4.default.yellow("⚡ MODERATE") : import_picocolors$4.default.green("✓ NORMAL") : "";
3780
- const rateDisplay = burnRate != null ? `${import_picocolors$4.default.bold("Burn Rate:")} ${Math.round(burnRate.tokensPerMinute)} per min ${rateIndicator}` : `${import_picocolors$4.default.bold("Burn Rate:")} N/A`;
3780
+ const rateDisplay = burnRate != null ? `${import_picocolors$4.default.bold("Burn Rate:")} ${Math.round(burnRate.tokensPerMinute)} token/min ${rateIndicator}` : `${import_picocolors$4.default.bold("Burn Rate:")} N/A`;
3781
3781
  const usageLabel = import_picocolors$4.default.bold("🔥 USAGE");
3782
3782
  const usageLabelWidth = stringWidth(usageLabel);
3783
3783
  if (config.tokenLimit != null && config.tokenLimit > 0) {
@@ -951,7 +951,7 @@ function _getDefaultLogLevel() {
951
951
  }
952
952
  const consola = createConsola$1();
953
953
  var name = "ccusage";
954
- var version = "15.0.0";
954
+ var version = "15.0.1";
955
955
  var description = "Usage analysis tool for Claude Code";
956
956
  /**
957
957
  * Application logger instance with package name tag
package/dist/logger.js CHANGED
@@ -1,2 +1,2 @@
1
- import { log, logger } from "./logger-6I_KKR-u.js";
1
+ import { log, logger } from "./logger-r_DhIB_J.js";
2
2
  export { log, logger };
@@ -1,11 +1,12 @@
1
- import { __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-CMyU5JUX.js";
1
+ import { __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-DBzWmU38.js";
2
2
  import { ZodFirstPartyTypeKind, ZodOptional, ZodType, arrayType, booleanType, dateSchema, discriminatedUnionType, enumType, literalType, numberType, objectType, optionalType, recordType, stringType, unionType, unknownType } from "./_types-Cr2YEzKm.js";
3
- import { getDefaultClaudePath, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-B_ymgjWR.js";
4
- import { name, version } from "./logger-6I_KKR-u.js";
3
+ import { getDefaultClaudePath, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-DQftfBz9.js";
4
+ import { name, version } from "./logger-r_DhIB_J.js";
5
5
  import process from "node:process";
6
- const LATEST_PROTOCOL_VERSION = "2025-03-26";
6
+ const LATEST_PROTOCOL_VERSION = "2025-06-18";
7
7
  const SUPPORTED_PROTOCOL_VERSIONS = [
8
8
  LATEST_PROTOCOL_VERSION,
9
+ "2025-03-26",
9
10
  "2024-11-05",
10
11
  "2024-10-07"
11
12
  ];
@@ -109,18 +110,23 @@ const CancelledNotificationSchema = NotificationSchema.extend({
109
110
  })
110
111
  });
111
112
  /**
112
- * Describes the name and version of an MCP implementation.
113
+ * Base metadata interface for common properties across resources, tools, prompts, and implementations.
113
114
  */
114
- const ImplementationSchema = objectType({
115
+ const BaseMetadataSchema = objectType({
115
116
  name: stringType(),
116
- version: stringType()
117
+ title: optionalType(stringType())
117
118
  }).passthrough();
118
119
  /**
120
+ * Describes the name and version of an MCP implementation.
121
+ */
122
+ const ImplementationSchema = BaseMetadataSchema.extend({ version: stringType() });
123
+ /**
119
124
  * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
120
125
  */
121
126
  const ClientCapabilitiesSchema = objectType({
122
127
  experimental: optionalType(objectType({}).passthrough()),
123
128
  sampling: optionalType(objectType({}).passthrough()),
129
+ elicitation: optionalType(objectType({}).passthrough()),
124
130
  roots: optionalType(objectType({ listChanged: optionalType(booleanType()) }).passthrough())
125
131
  }).passthrough();
126
132
  /**
@@ -185,28 +191,29 @@ const PaginatedResultSchema = ResultSchema.extend({ nextCursor: optionalType(Cur
185
191
  */
186
192
  const ResourceContentsSchema = objectType({
187
193
  uri: stringType(),
188
- mimeType: optionalType(stringType())
194
+ mimeType: optionalType(stringType()),
195
+ _meta: optionalType(objectType({}).passthrough())
189
196
  }).passthrough();
190
197
  const TextResourceContentsSchema = ResourceContentsSchema.extend({ text: stringType() });
191
198
  const BlobResourceContentsSchema = ResourceContentsSchema.extend({ blob: stringType().base64() });
192
199
  /**
193
200
  * A known resource that the server is capable of reading.
194
201
  */
195
- const ResourceSchema = objectType({
202
+ const ResourceSchema = BaseMetadataSchema.extend({
196
203
  uri: stringType(),
197
- name: stringType(),
198
204
  description: optionalType(stringType()),
199
- mimeType: optionalType(stringType())
200
- }).passthrough();
205
+ mimeType: optionalType(stringType()),
206
+ _meta: optionalType(objectType({}).passthrough())
207
+ });
201
208
  /**
202
209
  * A template description for resources available on the server.
203
210
  */
204
- const ResourceTemplateSchema = objectType({
211
+ const ResourceTemplateSchema = BaseMetadataSchema.extend({
205
212
  uriTemplate: stringType(),
206
- name: stringType(),
207
213
  description: optionalType(stringType()),
208
- mimeType: optionalType(stringType())
209
- }).passthrough();
214
+ mimeType: optionalType(stringType()),
215
+ _meta: optionalType(objectType({}).passthrough())
216
+ });
210
217
  /**
211
218
  * Sent from the client to request a list of resources the server has.
212
219
  */
@@ -270,11 +277,11 @@ const PromptArgumentSchema = objectType({
270
277
  /**
271
278
  * A prompt or prompt template that the server offers.
272
279
  */
273
- const PromptSchema = objectType({
274
- name: stringType(),
280
+ const PromptSchema = BaseMetadataSchema.extend({
275
281
  description: optionalType(stringType()),
276
- arguments: optionalType(arrayType(PromptArgumentSchema))
277
- }).passthrough();
282
+ arguments: optionalType(arrayType(PromptArgumentSchema)),
283
+ _meta: optionalType(objectType({}).passthrough())
284
+ });
278
285
  /**
279
286
  * Sent from the client to request a list of prompts and prompt templates the server has.
280
287
  */
@@ -298,7 +305,8 @@ const GetPromptRequestSchema = RequestSchema.extend({
298
305
  */
299
306
  const TextContentSchema = objectType({
300
307
  type: literalType("text"),
301
- text: stringType()
308
+ text: stringType(),
309
+ _meta: optionalType(objectType({}).passthrough())
302
310
  }).passthrough();
303
311
  /**
304
312
  * An image provided to or from an LLM.
@@ -306,7 +314,8 @@ const TextContentSchema = objectType({
306
314
  const ImageContentSchema = objectType({
307
315
  type: literalType("image"),
308
316
  data: stringType().base64(),
309
- mimeType: stringType()
317
+ mimeType: stringType(),
318
+ _meta: optionalType(objectType({}).passthrough())
310
319
  }).passthrough();
311
320
  /**
312
321
  * An Audio provided to or from an LLM.
@@ -314,26 +323,39 @@ const ImageContentSchema = objectType({
314
323
  const AudioContentSchema = objectType({
315
324
  type: literalType("audio"),
316
325
  data: stringType().base64(),
317
- mimeType: stringType()
326
+ mimeType: stringType(),
327
+ _meta: optionalType(objectType({}).passthrough())
318
328
  }).passthrough();
319
329
  /**
320
330
  * The contents of a resource, embedded into a prompt or tool call result.
321
331
  */
322
332
  const EmbeddedResourceSchema = objectType({
323
333
  type: literalType("resource"),
324
- resource: unionType([TextResourceContentsSchema, BlobResourceContentsSchema])
334
+ resource: unionType([TextResourceContentsSchema, BlobResourceContentsSchema]),
335
+ _meta: optionalType(objectType({}).passthrough())
325
336
  }).passthrough();
326
337
  /**
338
+ * A resource that the server is capable of reading, included in a prompt or tool call result.
339
+ *
340
+ * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
341
+ */
342
+ const ResourceLinkSchema = ResourceSchema.extend({ type: literalType("resource_link") });
343
+ /**
344
+ * A content block that can be used in prompts and tool results.
345
+ */
346
+ const ContentBlockSchema = unionType([
347
+ TextContentSchema,
348
+ ImageContentSchema,
349
+ AudioContentSchema,
350
+ ResourceLinkSchema,
351
+ EmbeddedResourceSchema
352
+ ]);
353
+ /**
327
354
  * Describes a message returned as part of a prompt.
328
355
  */
329
356
  const PromptMessageSchema = objectType({
330
357
  role: enumType(["user", "assistant"]),
331
- content: unionType([
332
- TextContentSchema,
333
- ImageContentSchema,
334
- AudioContentSchema,
335
- EmbeddedResourceSchema
336
- ])
358
+ content: ContentBlockSchema
337
359
  }).passthrough();
338
360
  /**
339
361
  * The server's response to a prompts/get request from the client.
@@ -366,8 +388,7 @@ const ToolAnnotationsSchema = objectType({
366
388
  /**
367
389
  * Definition for a tool the client can call.
368
390
  */
369
- const ToolSchema = objectType({
370
- name: stringType(),
391
+ const ToolSchema = BaseMetadataSchema.extend({
371
392
  description: optionalType(stringType()),
372
393
  inputSchema: objectType({
373
394
  type: literalType("object"),
@@ -379,8 +400,9 @@ const ToolSchema = objectType({
379
400
  properties: optionalType(objectType({}).passthrough()),
380
401
  required: optionalType(arrayType(stringType()))
381
402
  }).passthrough()),
382
- annotations: optionalType(ToolAnnotationsSchema)
383
- }).passthrough();
403
+ annotations: optionalType(ToolAnnotationsSchema),
404
+ _meta: optionalType(objectType({}).passthrough())
405
+ });
384
406
  /**
385
407
  * Sent from the client to request a list of tools the server has.
386
408
  */
@@ -393,12 +415,7 @@ const ListToolsResultSchema = PaginatedResultSchema.extend({ tools: arrayType(To
393
415
  * The server's response to a tool call.
394
416
  */
395
417
  const CallToolResultSchema = ResultSchema.extend({
396
- content: arrayType(unionType([
397
- TextContentSchema,
398
- ImageContentSchema,
399
- AudioContentSchema,
400
- EmbeddedResourceSchema
401
- ])).default([]),
418
+ content: arrayType(ContentBlockSchema).default([]),
402
419
  structuredContent: objectType({}).passthrough().optional(),
403
420
  isError: optionalType(booleanType())
404
421
  });
@@ -513,9 +530,89 @@ const CreateMessageResultSchema = ResultSchema.extend({
513
530
  ])
514
531
  });
515
532
  /**
533
+ * Primitive schema definition for boolean fields.
534
+ */
535
+ const BooleanSchemaSchema = objectType({
536
+ type: literalType("boolean"),
537
+ title: optionalType(stringType()),
538
+ description: optionalType(stringType()),
539
+ default: optionalType(booleanType())
540
+ }).passthrough();
541
+ /**
542
+ * Primitive schema definition for string fields.
543
+ */
544
+ const StringSchemaSchema = objectType({
545
+ type: literalType("string"),
546
+ title: optionalType(stringType()),
547
+ description: optionalType(stringType()),
548
+ minLength: optionalType(numberType()),
549
+ maxLength: optionalType(numberType()),
550
+ format: optionalType(enumType([
551
+ "email",
552
+ "uri",
553
+ "date",
554
+ "date-time"
555
+ ]))
556
+ }).passthrough();
557
+ /**
558
+ * Primitive schema definition for number fields.
559
+ */
560
+ const NumberSchemaSchema = objectType({
561
+ type: enumType(["number", "integer"]),
562
+ title: optionalType(stringType()),
563
+ description: optionalType(stringType()),
564
+ minimum: optionalType(numberType()),
565
+ maximum: optionalType(numberType())
566
+ }).passthrough();
567
+ /**
568
+ * Primitive schema definition for enum fields.
569
+ */
570
+ const EnumSchemaSchema = objectType({
571
+ type: literalType("string"),
572
+ title: optionalType(stringType()),
573
+ description: optionalType(stringType()),
574
+ enum: arrayType(stringType()),
575
+ enumNames: optionalType(arrayType(stringType()))
576
+ }).passthrough();
577
+ /**
578
+ * Union of all primitive schema definitions.
579
+ */
580
+ const PrimitiveSchemaDefinitionSchema = unionType([
581
+ BooleanSchemaSchema,
582
+ StringSchemaSchema,
583
+ NumberSchemaSchema,
584
+ EnumSchemaSchema
585
+ ]);
586
+ /**
587
+ * A request from the server to elicit user input via the client.
588
+ * The client should present the message and form fields to the user.
589
+ */
590
+ const ElicitRequestSchema = RequestSchema.extend({
591
+ method: literalType("elicitation/create"),
592
+ params: BaseRequestParamsSchema.extend({
593
+ message: stringType(),
594
+ requestedSchema: objectType({
595
+ type: literalType("object"),
596
+ properties: recordType(stringType(), PrimitiveSchemaDefinitionSchema),
597
+ required: optionalType(arrayType(stringType()))
598
+ }).passthrough()
599
+ })
600
+ });
601
+ /**
602
+ * The client's response to an elicitation/create request from the server.
603
+ */
604
+ const ElicitResultSchema = ResultSchema.extend({
605
+ action: enumType([
606
+ "accept",
607
+ "reject",
608
+ "cancel"
609
+ ]),
610
+ content: optionalType(recordType(stringType(), unknownType()))
611
+ });
612
+ /**
516
613
  * A reference to a resource or resource template definition.
517
614
  */
518
- const ResourceReferenceSchema = objectType({
615
+ const ResourceTemplateReferenceSchema = objectType({
519
616
  type: literalType("ref/resource"),
520
617
  uri: stringType()
521
618
  }).passthrough();
@@ -532,11 +629,12 @@ const PromptReferenceSchema = objectType({
532
629
  const CompleteRequestSchema = RequestSchema.extend({
533
630
  method: literalType("completion/complete"),
534
631
  params: BaseRequestParamsSchema.extend({
535
- ref: unionType([PromptReferenceSchema, ResourceReferenceSchema]),
632
+ ref: unionType([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
536
633
  argument: objectType({
537
634
  name: stringType(),
538
635
  value: stringType()
539
- }).passthrough()
636
+ }).passthrough(),
637
+ context: optionalType(objectType({ arguments: optionalType(recordType(stringType(), stringType())) }))
540
638
  })
541
639
  });
542
640
  /**
@@ -552,7 +650,8 @@ const CompleteResultSchema = ResultSchema.extend({ completion: objectType({
552
650
  */
553
651
  const RootSchema = objectType({
554
652
  uri: stringType().startsWith("file://"),
555
- name: optionalType(stringType())
653
+ name: optionalType(stringType()),
654
+ _meta: optionalType(objectType({}).passthrough())
556
655
  }).passthrough();
557
656
  /**
558
657
  * Sent from the server to request a list of root URIs from the client.
@@ -590,11 +689,13 @@ const ClientNotificationSchema = unionType([
590
689
  const ClientResultSchema = unionType([
591
690
  EmptyResultSchema,
592
691
  CreateMessageResultSchema,
692
+ ElicitResultSchema,
593
693
  ListRootsResultSchema
594
694
  ]);
595
695
  const ServerRequestSchema = unionType([
596
696
  PingRequestSchema,
597
697
  CreateMessageRequestSchema,
698
+ ElicitRequestSchema,
598
699
  ListRootsRequestSchema
599
700
  ]);
600
701
  const ServerNotificationSchema = unionType([
@@ -6607,28 +6708,28 @@ var require_data = __commonJSMin((exports, module) => {
6607
6708
  });
6608
6709
  var require_ajv = __commonJSMin((exports, module) => {
6609
6710
  var compileSchema = require_compile(), resolve = require_resolve(), Cache = require_cache(), SchemaObject = require_schema_obj(), stableStringify = require_fast_json_stable_stringify(), formats = require_formats(), rules = require_rules(), $dataMetaSchema = require_data$1(), util = require_util();
6610
- module.exports = Ajv$1;
6611
- Ajv$1.prototype.validate = validate;
6612
- Ajv$1.prototype.compile = compile;
6613
- Ajv$1.prototype.addSchema = addSchema;
6614
- Ajv$1.prototype.addMetaSchema = addMetaSchema;
6615
- Ajv$1.prototype.validateSchema = validateSchema;
6616
- Ajv$1.prototype.getSchema = getSchema;
6617
- Ajv$1.prototype.removeSchema = removeSchema;
6618
- Ajv$1.prototype.addFormat = addFormat$1;
6619
- Ajv$1.prototype.errorsText = errorsText;
6620
- Ajv$1.prototype._addSchema = _addSchema;
6621
- Ajv$1.prototype._compile = _compile;
6622
- Ajv$1.prototype.compileAsync = require_async();
6711
+ module.exports = Ajv$2;
6712
+ Ajv$2.prototype.validate = validate;
6713
+ Ajv$2.prototype.compile = compile;
6714
+ Ajv$2.prototype.addSchema = addSchema;
6715
+ Ajv$2.prototype.addMetaSchema = addMetaSchema;
6716
+ Ajv$2.prototype.validateSchema = validateSchema;
6717
+ Ajv$2.prototype.getSchema = getSchema;
6718
+ Ajv$2.prototype.removeSchema = removeSchema;
6719
+ Ajv$2.prototype.addFormat = addFormat$1;
6720
+ Ajv$2.prototype.errorsText = errorsText;
6721
+ Ajv$2.prototype._addSchema = _addSchema;
6722
+ Ajv$2.prototype._compile = _compile;
6723
+ Ajv$2.prototype.compileAsync = require_async();
6623
6724
  var customKeyword = require_keyword();
6624
- Ajv$1.prototype.addKeyword = customKeyword.add;
6625
- Ajv$1.prototype.getKeyword = customKeyword.get;
6626
- Ajv$1.prototype.removeKeyword = customKeyword.remove;
6627
- Ajv$1.prototype.validateKeyword = customKeyword.validate;
6725
+ Ajv$2.prototype.addKeyword = customKeyword.add;
6726
+ Ajv$2.prototype.getKeyword = customKeyword.get;
6727
+ Ajv$2.prototype.removeKeyword = customKeyword.remove;
6728
+ Ajv$2.prototype.validateKeyword = customKeyword.validate;
6628
6729
  var errorClasses = require_error_classes();
6629
- Ajv$1.ValidationError = errorClasses.Validation;
6630
- Ajv$1.MissingRefError = errorClasses.MissingRef;
6631
- Ajv$1.$dataMetaSchema = $dataMetaSchema;
6730
+ Ajv$2.ValidationError = errorClasses.Validation;
6731
+ Ajv$2.MissingRefError = errorClasses.MissingRef;
6732
+ Ajv$2.$dataMetaSchema = $dataMetaSchema;
6632
6733
  var META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
6633
6734
  var META_IGNORE_OPTIONS = [
6634
6735
  "removeAdditional",
@@ -6643,8 +6744,8 @@ var require_ajv = __commonJSMin((exports, module) => {
6643
6744
  * @param {Object} opts optional options
6644
6745
  * @return {Object} ajv instance
6645
6746
  */
6646
- function Ajv$1(opts) {
6647
- if (!(this instanceof Ajv$1)) return new Ajv$1(opts);
6747
+ function Ajv$2(opts) {
6748
+ if (!(this instanceof Ajv$2)) return new Ajv$2(opts);
6648
6749
  opts = this._opts = util.copy(opts) || {};
6649
6750
  setLogger(this);
6650
6751
  this._schemas = {};
@@ -7011,6 +7112,7 @@ var require_ajv = __commonJSMin((exports, module) => {
7011
7112
  }
7012
7113
  function noop() {}
7013
7114
  });
7115
+ var import_ajv$1 = __toESM(require_ajv(), 1);
7014
7116
  var import_ajv = __toESM(require_ajv(), 1);
7015
7117
  /**
7016
7118
  * An MCP server on top of a pluggable transport.
@@ -7063,13 +7165,16 @@ var Server = class extends Protocol {
7063
7165
  this._capabilities = mergeCapabilities(this._capabilities, capabilities);
7064
7166
  }
7065
7167
  assertCapabilityForMethod(method) {
7066
- var _a, _b;
7168
+ var _a, _b, _c;
7067
7169
  switch (method) {
7068
7170
  case "sampling/createMessage":
7069
7171
  if (!((_a = this._clientCapabilities) === null || _a === void 0 ? void 0 : _a.sampling)) throw new Error(`Client does not support sampling (required for ${method})`);
7070
7172
  break;
7173
+ case "elicitation/create":
7174
+ if (!((_b = this._clientCapabilities) === null || _b === void 0 ? void 0 : _b.elicitation)) throw new Error(`Client does not support elicitation (required for ${method})`);
7175
+ break;
7071
7176
  case "roots/list":
7072
- if (!((_b = this._clientCapabilities) === null || _b === void 0 ? void 0 : _b.roots)) throw new Error(`Client does not support listing roots (required for ${method})`);
7177
+ if (!((_c = this._clientCapabilities) === null || _c === void 0 ? void 0 : _c.roots)) throw new Error(`Client does not support listing roots (required for ${method})`);
7073
7178
  break;
7074
7179
  case "ping": break;
7075
7180
  }
@@ -7122,8 +7227,9 @@ var Server = class extends Protocol {
7122
7227
  const requestedVersion = request.params.protocolVersion;
7123
7228
  this._clientCapabilities = request.params.capabilities;
7124
7229
  this._clientVersion = request.params.clientInfo;
7230
+ const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION;
7125
7231
  return {
7126
- protocolVersion: SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION,
7232
+ protocolVersion,
7127
7233
  capabilities: this.getCapabilities(),
7128
7234
  serverInfo: this._serverInfo,
7129
7235
  ...this._instructions && { instructions: this._instructions }
@@ -7153,6 +7259,22 @@ var Server = class extends Protocol {
7153
7259
  params
7154
7260
  }, CreateMessageResultSchema, options);
7155
7261
  }
7262
+ async elicitInput(params, options) {
7263
+ const result = await this.request({
7264
+ method: "elicitation/create",
7265
+ params
7266
+ }, ElicitResultSchema, options);
7267
+ if (result.action === "accept" && result.content) try {
7268
+ const ajv = new import_ajv.default();
7269
+ const validate$1 = ajv.compile(params.requestedSchema);
7270
+ const isValid = validate$1(result.content);
7271
+ if (!isValid) throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${ajv.errorsText(validate$1.errors)}`);
7272
+ } catch (error) {
7273
+ if (error instanceof McpError) throw error;
7274
+ throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error}`);
7275
+ }
7276
+ return result;
7277
+ }
7156
7278
  async listRoots(params, options) {
7157
7279
  return this.request({
7158
7280
  method: "roots/list",
@@ -8246,6 +8368,7 @@ var McpServer = class {
8246
8368
  this.server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([name$1, tool]) => {
8247
8369
  const toolDefinition = {
8248
8370
  name: name$1,
8371
+ title: tool.title,
8249
8372
  description: tool.description,
8250
8373
  inputSchema: tool.inputSchema ? zodToJsonSchema(tool.inputSchema, { strictUnions: true }) : EMPTY_OBJECT_JSON_SCHEMA,
8251
8374
  annotations: tool.annotations
@@ -8318,7 +8441,7 @@ var McpServer = class {
8318
8441
  const field = prompt.argsSchema.shape[request.params.argument.name];
8319
8442
  if (!(field instanceof Completable)) return EMPTY_COMPLETION_RESULT;
8320
8443
  const def = field._def;
8321
- const suggestions = await def.complete(request.params.argument.value);
8444
+ const suggestions = await def.complete(request.params.argument.value, request.params.context);
8322
8445
  return createCompletionResult(suggestions);
8323
8446
  }
8324
8447
  async handleResourceCompletion(request, ref) {
@@ -8329,7 +8452,7 @@ var McpServer = class {
8329
8452
  }
8330
8453
  const completer = template.resourceTemplate.completeCallback(request.params.argument.name);
8331
8454
  if (!completer) return EMPTY_COMPLETION_RESULT;
8332
- const suggestions = await completer(request.params.argument.value);
8455
+ const suggestions = await completer(request.params.argument.value, request.params.context);
8333
8456
  return createCompletionResult(suggestions);
8334
8457
  }
8335
8458
  setResourceRequestHandlers() {
@@ -8387,6 +8510,7 @@ var McpServer = class {
8387
8510
  this.server.setRequestHandler(ListPromptsRequestSchema, () => ({ prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([name$1, prompt]) => {
8388
8511
  return {
8389
8512
  name: name$1,
8513
+ title: prompt.title,
8390
8514
  description: prompt.description,
8391
8515
  arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : void 0
8392
8516
  };
@@ -8415,60 +8539,118 @@ var McpServer = class {
8415
8539
  const readCallback = rest[0];
8416
8540
  if (typeof uriOrTemplate === "string") {
8417
8541
  if (this._registeredResources[uriOrTemplate]) throw new Error(`Resource ${uriOrTemplate} is already registered`);
8418
- const registeredResource = {
8419
- name: name$1,
8420
- metadata,
8421
- readCallback,
8422
- enabled: true,
8423
- disable: () => registeredResource.update({ enabled: false }),
8424
- enable: () => registeredResource.update({ enabled: true }),
8425
- remove: () => registeredResource.update({ uri: null }),
8426
- update: (updates) => {
8427
- if (typeof updates.uri !== "undefined" && updates.uri !== uriOrTemplate) {
8428
- delete this._registeredResources[uriOrTemplate];
8429
- if (updates.uri) this._registeredResources[updates.uri] = registeredResource;
8430
- }
8431
- if (typeof updates.name !== "undefined") registeredResource.name = updates.name;
8432
- if (typeof updates.metadata !== "undefined") registeredResource.metadata = updates.metadata;
8433
- if (typeof updates.callback !== "undefined") registeredResource.readCallback = updates.callback;
8434
- if (typeof updates.enabled !== "undefined") registeredResource.enabled = updates.enabled;
8435
- this.sendResourceListChanged();
8436
- }
8437
- };
8438
- this._registeredResources[uriOrTemplate] = registeredResource;
8542
+ const registeredResource = this._createRegisteredResource(name$1, void 0, uriOrTemplate, metadata, readCallback);
8439
8543
  this.setResourceRequestHandlers();
8440
8544
  this.sendResourceListChanged();
8441
8545
  return registeredResource;
8442
8546
  } else {
8443
8547
  if (this._registeredResourceTemplates[name$1]) throw new Error(`Resource template ${name$1} is already registered`);
8444
- const registeredResourceTemplate = {
8445
- resourceTemplate: uriOrTemplate,
8446
- metadata,
8447
- readCallback,
8448
- enabled: true,
8449
- disable: () => registeredResourceTemplate.update({ enabled: false }),
8450
- enable: () => registeredResourceTemplate.update({ enabled: true }),
8451
- remove: () => registeredResourceTemplate.update({ name: null }),
8452
- update: (updates) => {
8453
- if (typeof updates.name !== "undefined" && updates.name !== name$1) {
8454
- delete this._registeredResourceTemplates[name$1];
8455
- if (updates.name) this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
8456
- }
8457
- if (typeof updates.template !== "undefined") registeredResourceTemplate.resourceTemplate = updates.template;
8458
- if (typeof updates.metadata !== "undefined") registeredResourceTemplate.metadata = updates.metadata;
8459
- if (typeof updates.callback !== "undefined") registeredResourceTemplate.readCallback = updates.callback;
8460
- if (typeof updates.enabled !== "undefined") registeredResourceTemplate.enabled = updates.enabled;
8461
- this.sendResourceListChanged();
8462
- }
8463
- };
8464
- this._registeredResourceTemplates[name$1] = registeredResourceTemplate;
8548
+ const registeredResourceTemplate = this._createRegisteredResourceTemplate(name$1, void 0, uriOrTemplate, metadata, readCallback);
8465
8549
  this.setResourceRequestHandlers();
8466
8550
  this.sendResourceListChanged();
8467
8551
  return registeredResourceTemplate;
8468
8552
  }
8469
8553
  }
8470
- _createRegisteredTool(name$1, description, inputSchema, outputSchema, annotations, callback) {
8554
+ /**
8555
+ * Registers a resource with a config object and callback.
8556
+ * For static resources, use a URI string. For dynamic resources, use a ResourceTemplate.
8557
+ */
8558
+ registerResource(name$1, uriOrTemplate, config, readCallback) {
8559
+ if (typeof uriOrTemplate === "string") {
8560
+ if (this._registeredResources[uriOrTemplate]) throw new Error(`Resource ${uriOrTemplate} is already registered`);
8561
+ const registeredResource = this._createRegisteredResource(name$1, config.title, uriOrTemplate, config, readCallback);
8562
+ this.setResourceRequestHandlers();
8563
+ this.sendResourceListChanged();
8564
+ return registeredResource;
8565
+ } else {
8566
+ if (this._registeredResourceTemplates[name$1]) throw new Error(`Resource template ${name$1} is already registered`);
8567
+ const registeredResourceTemplate = this._createRegisteredResourceTemplate(name$1, config.title, uriOrTemplate, config, readCallback);
8568
+ this.setResourceRequestHandlers();
8569
+ this.sendResourceListChanged();
8570
+ return registeredResourceTemplate;
8571
+ }
8572
+ }
8573
+ _createRegisteredResource(name$1, title, uri$1, metadata, readCallback) {
8574
+ const registeredResource = {
8575
+ name: name$1,
8576
+ title,
8577
+ metadata,
8578
+ readCallback,
8579
+ enabled: true,
8580
+ disable: () => registeredResource.update({ enabled: false }),
8581
+ enable: () => registeredResource.update({ enabled: true }),
8582
+ remove: () => registeredResource.update({ uri: null }),
8583
+ update: (updates) => {
8584
+ if (typeof updates.uri !== "undefined" && updates.uri !== uri$1) {
8585
+ delete this._registeredResources[uri$1];
8586
+ if (updates.uri) this._registeredResources[updates.uri] = registeredResource;
8587
+ }
8588
+ if (typeof updates.name !== "undefined") registeredResource.name = updates.name;
8589
+ if (typeof updates.title !== "undefined") registeredResource.title = updates.title;
8590
+ if (typeof updates.metadata !== "undefined") registeredResource.metadata = updates.metadata;
8591
+ if (typeof updates.callback !== "undefined") registeredResource.readCallback = updates.callback;
8592
+ if (typeof updates.enabled !== "undefined") registeredResource.enabled = updates.enabled;
8593
+ this.sendResourceListChanged();
8594
+ }
8595
+ };
8596
+ this._registeredResources[uri$1] = registeredResource;
8597
+ return registeredResource;
8598
+ }
8599
+ _createRegisteredResourceTemplate(name$1, title, template, metadata, readCallback) {
8600
+ const registeredResourceTemplate = {
8601
+ resourceTemplate: template,
8602
+ title,
8603
+ metadata,
8604
+ readCallback,
8605
+ enabled: true,
8606
+ disable: () => registeredResourceTemplate.update({ enabled: false }),
8607
+ enable: () => registeredResourceTemplate.update({ enabled: true }),
8608
+ remove: () => registeredResourceTemplate.update({ name: null }),
8609
+ update: (updates) => {
8610
+ if (typeof updates.name !== "undefined" && updates.name !== name$1) {
8611
+ delete this._registeredResourceTemplates[name$1];
8612
+ if (updates.name) this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
8613
+ }
8614
+ if (typeof updates.title !== "undefined") registeredResourceTemplate.title = updates.title;
8615
+ if (typeof updates.template !== "undefined") registeredResourceTemplate.resourceTemplate = updates.template;
8616
+ if (typeof updates.metadata !== "undefined") registeredResourceTemplate.metadata = updates.metadata;
8617
+ if (typeof updates.callback !== "undefined") registeredResourceTemplate.readCallback = updates.callback;
8618
+ if (typeof updates.enabled !== "undefined") registeredResourceTemplate.enabled = updates.enabled;
8619
+ this.sendResourceListChanged();
8620
+ }
8621
+ };
8622
+ this._registeredResourceTemplates[name$1] = registeredResourceTemplate;
8623
+ return registeredResourceTemplate;
8624
+ }
8625
+ _createRegisteredPrompt(name$1, title, description, argsSchema, callback) {
8626
+ const registeredPrompt = {
8627
+ title,
8628
+ description,
8629
+ argsSchema: argsSchema === void 0 ? void 0 : objectType(argsSchema),
8630
+ callback,
8631
+ enabled: true,
8632
+ disable: () => registeredPrompt.update({ enabled: false }),
8633
+ enable: () => registeredPrompt.update({ enabled: true }),
8634
+ remove: () => registeredPrompt.update({ name: null }),
8635
+ update: (updates) => {
8636
+ if (typeof updates.name !== "undefined" && updates.name !== name$1) {
8637
+ delete this._registeredPrompts[name$1];
8638
+ if (updates.name) this._registeredPrompts[updates.name] = registeredPrompt;
8639
+ }
8640
+ if (typeof updates.title !== "undefined") registeredPrompt.title = updates.title;
8641
+ if (typeof updates.description !== "undefined") registeredPrompt.description = updates.description;
8642
+ if (typeof updates.argsSchema !== "undefined") registeredPrompt.argsSchema = objectType(updates.argsSchema);
8643
+ if (typeof updates.callback !== "undefined") registeredPrompt.callback = updates.callback;
8644
+ if (typeof updates.enabled !== "undefined") registeredPrompt.enabled = updates.enabled;
8645
+ this.sendPromptListChanged();
8646
+ }
8647
+ };
8648
+ this._registeredPrompts[name$1] = registeredPrompt;
8649
+ return registeredPrompt;
8650
+ }
8651
+ _createRegisteredTool(name$1, title, description, inputSchema, outputSchema, annotations, callback) {
8471
8652
  const registeredTool = {
8653
+ title,
8472
8654
  description,
8473
8655
  inputSchema: inputSchema === void 0 ? void 0 : objectType(inputSchema),
8474
8656
  outputSchema: outputSchema === void 0 ? void 0 : objectType(outputSchema),
@@ -8483,6 +8665,7 @@ var McpServer = class {
8483
8665
  delete this._registeredTools[name$1];
8484
8666
  if (updates.name) this._registeredTools[updates.name] = registeredTool;
8485
8667
  }
8668
+ if (typeof updates.title !== "undefined") registeredTool.title = updates.title;
8486
8669
  if (typeof updates.description !== "undefined") registeredTool.description = updates.description;
8487
8670
  if (typeof updates.paramsSchema !== "undefined") registeredTool.inputSchema = objectType(updates.paramsSchema);
8488
8671
  if (typeof updates.callback !== "undefined") registeredTool.callback = updates.callback;
@@ -8514,15 +8697,15 @@ var McpServer = class {
8514
8697
  } else if (typeof firstArg === "object" && firstArg !== null) annotations = rest.shift();
8515
8698
  }
8516
8699
  const callback = rest[0];
8517
- return this._createRegisteredTool(name$1, description, inputSchema, outputSchema, annotations, callback);
8700
+ return this._createRegisteredTool(name$1, void 0, description, inputSchema, outputSchema, annotations, callback);
8518
8701
  }
8519
8702
  /**
8520
8703
  * Registers a tool with a config object and callback.
8521
8704
  */
8522
8705
  registerTool(name$1, config, cb) {
8523
8706
  if (this._registeredTools[name$1]) throw new Error(`Tool ${name$1} is already registered`);
8524
- const { description, inputSchema, outputSchema, annotations } = config;
8525
- return this._createRegisteredTool(name$1, description, inputSchema, outputSchema, annotations, cb);
8707
+ const { title, description, inputSchema, outputSchema, annotations } = config;
8708
+ return this._createRegisteredTool(name$1, title, description, inputSchema, outputSchema, annotations, cb);
8526
8709
  }
8527
8710
  prompt(name$1, ...rest) {
8528
8711
  if (this._registeredPrompts[name$1]) throw new Error(`Prompt ${name$1} is already registered`);
@@ -8531,27 +8714,18 @@ var McpServer = class {
8531
8714
  let argsSchema;
8532
8715
  if (rest.length > 1) argsSchema = rest.shift();
8533
8716
  const cb = rest[0];
8534
- const registeredPrompt = {
8535
- description,
8536
- argsSchema: argsSchema === void 0 ? void 0 : objectType(argsSchema),
8537
- callback: cb,
8538
- enabled: true,
8539
- disable: () => registeredPrompt.update({ enabled: false }),
8540
- enable: () => registeredPrompt.update({ enabled: true }),
8541
- remove: () => registeredPrompt.update({ name: null }),
8542
- update: (updates) => {
8543
- if (typeof updates.name !== "undefined" && updates.name !== name$1) {
8544
- delete this._registeredPrompts[name$1];
8545
- if (updates.name) this._registeredPrompts[updates.name] = registeredPrompt;
8546
- }
8547
- if (typeof updates.description !== "undefined") registeredPrompt.description = updates.description;
8548
- if (typeof updates.argsSchema !== "undefined") registeredPrompt.argsSchema = objectType(updates.argsSchema);
8549
- if (typeof updates.callback !== "undefined") registeredPrompt.callback = updates.callback;
8550
- if (typeof updates.enabled !== "undefined") registeredPrompt.enabled = updates.enabled;
8551
- this.sendPromptListChanged();
8552
- }
8553
- };
8554
- this._registeredPrompts[name$1] = registeredPrompt;
8717
+ const registeredPrompt = this._createRegisteredPrompt(name$1, void 0, description, argsSchema, cb);
8718
+ this.setPromptRequestHandlers();
8719
+ this.sendPromptListChanged();
8720
+ return registeredPrompt;
8721
+ }
8722
+ /**
8723
+ * Registers a prompt with a config object and callback.
8724
+ */
8725
+ registerPrompt(name$1, config, cb) {
8726
+ if (this._registeredPrompts[name$1]) throw new Error(`Prompt ${name$1} is already registered`);
8727
+ const { title, description, argsSchema } = config;
8728
+ const registeredPrompt = this._createRegisteredPrompt(name$1, title, description, argsSchema, cb);
8555
8729
  this.setPromptRequestHandlers();
8556
8730
  this.sendPromptListChanged();
8557
8731
  return registeredPrompt;
package/dist/mcp.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./pricing-fetcher-CMyU5JUX.js";
1
+ import "./pricing-fetcher-DBzWmU38.js";
2
2
  import "./_types-Cr2YEzKm.js";
3
- import "./data-loader-B_ymgjWR.js";
4
- import "./logger-6I_KKR-u.js";
5
- import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-COnbPauf.js";
3
+ import "./data-loader-DQftfBz9.js";
4
+ import "./logger-r_DhIB_J.js";
5
+ import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-C-EN2PDc.js";
6
6
  export { createMcpHttpApp, createMcpServer, startMcpServerStdio };
@@ -1,5 +1,5 @@
1
1
  import { modelPricingSchema } from "./_types-Cr2YEzKm.js";
2
- import { logger } from "./logger-6I_KKR-u.js";
2
+ import { logger } from "./logger-r_DhIB_J.js";
3
3
  import { createRequire } from "node:module";
4
4
  import F, { homedir } from "node:os";
5
5
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- import { PricingFetcher } from "./pricing-fetcher-CMyU5JUX.js";
1
+ import { PricingFetcher } from "./pricing-fetcher-DBzWmU38.js";
2
2
  import "./_types-Cr2YEzKm.js";
3
- import "./logger-6I_KKR-u.js";
3
+ import "./logger-r_DhIB_J.js";
4
4
  export { PricingFetcher };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccusage",
3
3
  "type": "module",
4
- "version": "15.0.0",
4
+ "version": "15.0.1",
5
5
  "description": "Usage analysis tool for Claude Code",
6
6
  "author": "ryoppippi",
7
7
  "license": "MIT",