@pdpp/mcp-server 0.5.0 → 0.6.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/tools.js +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdpp/mcp-server",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Local stdio MCP adapter for grant-scoped PDPP reads and event-subscription management.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/tools.js CHANGED
@@ -495,7 +495,7 @@ export function buildTools({ rs, providerUrl }) {
495
495
  name: 'aggregate',
496
496
  title: 'Aggregate PDPP records',
497
497
  description:
498
- 'Compute a single-stream aggregation via `GET /v1/streams/{stream}/aggregate`. Prefer over `query_records` when you only need a count, sum, min/max, distinct count, or grouped/time-bucketed rollup — returns small bucket rows, never record bodies. Metrics: `count`, `sum`, `min`, `max`, `count_distinct` (`field` required for all but `count`). Group with one dimension: `group_by` XOR `group_by_time` (requires `granularity`). Groupable fields are advertised by `GET /v1/schema`. Forwards args verbatim. ' +
498
+ 'Compute a single-stream aggregation via `GET /v1/streams/{stream}/aggregate`. Prefer over `query_records` when you only need a count, sum, min/max, distinct count, or grouped/time-bucketed rollup — returns small bucket rows, never record bodies. Metrics: `count`, `sum`, `min`, `max`, `count_distinct` (`field` required for all but `count`). Group with one dimension: `group_by` XOR `group_by_time` (requires `granularity`). Grouped responses include `other_count` (records in groups beyond `limit`) so you can detect top-N truncation without a second call. Groupable fields are advertised by `GET /v1/schema`. Forwards args verbatim. ' +
499
499
  CANONICAL_SCHEMA_HINT +
500
500
  ' Read-only.',
501
501
  annotations: READ_ONLY_ANNOTATIONS,
@@ -1085,7 +1085,8 @@ function summarizeAggregate(body, stream) {
1085
1085
  return `${formatScalar(key)}=${count == null ? '?' : count}`;
1086
1086
  });
1087
1087
  const more = groups.length > AGGREGATE_GROUP_PREVIEW_LIMIT ? ` more_groups=${groups.length - AGGREGATE_GROUP_PREVIEW_LIMIT};` : '';
1088
- return `${head} ${dimension}: ${groups.length} group(s) [${shown.join(', ')}]${more} canonical envelope in structuredContent.data`;
1088
+ const otherCount = typeof agg.other_count === 'number' ? ` other_count=${agg.other_count};` : '';
1089
+ return `${head} ${dimension}: ${groups.length} group(s) [${shown.join(', ')}]${more}${otherCount} canonical envelope in structuredContent.data`;
1089
1090
  }
1090
1091
 
1091
1092
  // Ungrouped: the scalar answer lives in `value`. Fall back to
@@ -1660,13 +1661,14 @@ function summarizeSearch(body, results) {
1660
1661
  const hasMore = envelopeField(body, 'has_more') === true ? ' has_more=true.' : '';
1661
1662
  const nextCursor = envelopeStringField(body, 'next_cursor');
1662
1663
  const cursorText = nextCursor ? ` next_cursor=${formatScalar(nextCursor)}.` : '';
1664
+ const firstFetchText = results[0]?.id ? ` first_fetch_id=${formatInlineValue(results[0].id)}` : '';
1663
1665
  const sourceMixText = formatSearchSourceMix(body);
1664
1666
  const previews = results.slice(0, SEARCH_TEXT_PREVIEW_LIMIT).map(formatSearchPreviewLine);
1665
1667
  const previewText = previews.length > 0 ? ` Top results:\n${previews.join('\n')}` : '';
1666
1668
  const fetchHint = previews.length > 0
1667
1669
  ? '\nFetch a hit with `fetch` using the shown id as-is; ids are self-contained. Pass connection_id only when shown separately.'
1668
1670
  : '';
1669
- return `search: ${results.length} hit(s).${hasMore}${cursorText}${sourceMixText}${previewText}${fetchHint} Search envelope metadata: structuredContent.data; flattened results: structuredContent.results.`;
1671
+ return `search: ${results.length} hit(s).${hasMore}${cursorText}${firstFetchText}${sourceMixText}${previewText}${fetchHint} Search envelope metadata: structuredContent.data; flattened results: structuredContent.results.`;
1670
1672
  }
1671
1673
 
1672
1674
  function formatSearchSourceMix(body) {