@h-ear/mcp-server 1.0.10 → 1.1.0-dev.202604171007
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/schemas/index.d.ts +129 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +269 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/classify-audio.d.ts.map +1 -1
- package/dist/tools/classify-audio.js +66 -36
- package/dist/tools/classify-audio.js.map +1 -1
- package/dist/tools/classify-batch.d.ts.map +1 -1
- package/dist/tools/classify-batch.js +2 -22
- package/dist/tools/classify-batch.js.map +1 -1
- package/dist/tools/create-webhook.d.ts.map +1 -1
- package/dist/tools/create-webhook.js +2 -15
- package/dist/tools/create-webhook.js.map +1 -1
- package/dist/tools/delete-webhook.d.ts.map +1 -1
- package/dist/tools/delete-webhook.js +2 -5
- package/dist/tools/delete-webhook.js.map +1 -1
- package/dist/tools/get-job-audio.d.ts.map +1 -1
- package/dist/tools/get-job-audio.js +2 -10
- package/dist/tools/get-job-audio.js.map +1 -1
- package/dist/tools/get-job-events.d.ts.map +1 -1
- package/dist/tools/get-job-events.js +2 -34
- package/dist/tools/get-job-events.js.map +1 -1
- package/dist/tools/get-job-report.d.ts +4 -0
- package/dist/tools/get-job-report.d.ts.map +1 -0
- package/dist/tools/get-job-report.js +16 -0
- package/dist/tools/get-job-report.js.map +1 -0
- package/dist/tools/get-job-waveform.d.ts.map +1 -1
- package/dist/tools/get-job-waveform.js +2 -14
- package/dist/tools/get-job-waveform.js.map +1 -1
- package/dist/tools/get-job.d.ts.map +1 -1
- package/dist/tools/get-job.js +2 -5
- package/dist/tools/get-job.js.map +1 -1
- package/dist/tools/get-upload-status.d.ts +3 -0
- package/dist/tools/get-upload-status.d.ts.map +1 -0
- package/dist/tools/get-upload-status.js +18 -0
- package/dist/tools/get-upload-status.js.map +1 -0
- package/dist/tools/get-webhook.d.ts.map +1 -1
- package/dist/tools/get-webhook.js +2 -5
- package/dist/tools/get-webhook.js.map +1 -1
- package/dist/tools/health-check.d.ts.map +1 -1
- package/dist/tools/health-check.js +2 -1
- package/dist/tools/health-check.js.map +1 -1
- package/dist/tools/list-classes.d.ts.map +1 -1
- package/dist/tools/list-classes.js +2 -15
- package/dist/tools/list-classes.js.map +1 -1
- package/dist/tools/list-jobs.d.ts.map +1 -1
- package/dist/tools/list-jobs.js +2 -15
- package/dist/tools/list-jobs.js.map +1 -1
- package/dist/tools/list-webhook-deliveries.d.ts.map +1 -1
- package/dist/tools/list-webhook-deliveries.js +2 -7
- package/dist/tools/list-webhook-deliveries.js.map +1 -1
- package/dist/tools/list-webhooks.d.ts.map +1 -1
- package/dist/tools/list-webhooks.js +2 -1
- package/dist/tools/list-webhooks.js.map +1 -1
- package/dist/tools/ping-webhook.d.ts.map +1 -1
- package/dist/tools/ping-webhook.js +2 -5
- package/dist/tools/ping-webhook.js.map +1 -1
- package/dist/tools/update-webhook.d.ts.map +1 -1
- package/dist/tools/update-webhook.js +2 -19
- package/dist/tools/update-webhook.js.map +1 -1
- package/dist/tools/usage.d.ts.map +1 -1
- package/dist/tools/usage.js +2 -1
- package/dist/tools/usage.js.map +1 -1
- package/dist/upload-tracker.d.ts +31 -0
- package/dist/upload-tracker.d.ts.map +1 -0
- package/dist/upload-tracker.js +34 -0
- package/dist/upload-tracker.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for H-ear MCP tool inputSchemas and descriptions.
|
|
3
|
+
*
|
|
4
|
+
* Why this file exists: stdio and https transports must advertise identical
|
|
5
|
+
* tool contracts to clients. Stdio uses the Zod shapes directly in
|
|
6
|
+
* `server.tool(name, desc, shape, ...)`. The APIM REST-as-MCP passthrough
|
|
7
|
+
* (api-version 2025-03-01-preview) auto-generates tool schemas from APIM
|
|
8
|
+
* operations but DROPS query/header parameters, so filters like
|
|
9
|
+
* `listClasses(category: "Animal")` silently vanish on the https transport
|
|
10
|
+
* unless we patch explicit inputSchemas into `mcpTools[]`.
|
|
11
|
+
*
|
|
12
|
+
* Flow: Zod SHAPE → zod-to-json-schema → toolSchemas / toolDescriptions →
|
|
13
|
+
* consumed by stdio tool files AND by scripts/userMcp.root-status.mjs
|
|
14
|
+
* when PATCHing APIM.
|
|
15
|
+
*/
|
|
16
|
+
import { z, type ZodRawShape } from 'zod';
|
|
17
|
+
export declare const HEALTH_CHECK_SHAPE: {};
|
|
18
|
+
export declare const USAGE_SHAPE: {};
|
|
19
|
+
export declare const LIST_WEBHOOKS_SHAPE: {};
|
|
20
|
+
export declare const LIST_CLASSES_SHAPE: {
|
|
21
|
+
taxonomy: z.ZodOptional<z.ZodEnum<["audioset-yamnet-521", "audioset-panns-527", "species"]>>;
|
|
22
|
+
category: z.ZodOptional<z.ZodString>;
|
|
23
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
};
|
|
26
|
+
export declare const LIST_JOBS_SHAPE: {
|
|
27
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
28
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
status: z.ZodOptional<z.ZodEnum<["processing", "completed", "failed"]>>;
|
|
30
|
+
batchId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
32
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
33
|
+
};
|
|
34
|
+
export declare const GET_JOB_SHAPE: {
|
|
35
|
+
jobId: z.ZodString;
|
|
36
|
+
};
|
|
37
|
+
export declare const GET_JOB_EVENTS_SHAPE: {
|
|
38
|
+
jobId: z.ZodString;
|
|
39
|
+
taxonomy: z.ZodOptional<z.ZodString>;
|
|
40
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
category: z.ZodOptional<z.ZodString>;
|
|
42
|
+
tier2: z.ZodOptional<z.ZodString>;
|
|
43
|
+
tier3: z.ZodOptional<z.ZodString>;
|
|
44
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
47
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
48
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
49
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
50
|
+
};
|
|
51
|
+
export declare const GET_JOB_AUDIO_SHAPE: {
|
|
52
|
+
jobId: z.ZodString;
|
|
53
|
+
};
|
|
54
|
+
export declare const GET_JOB_WAVEFORM_SHAPE: {
|
|
55
|
+
jobId: z.ZodString;
|
|
56
|
+
zoom: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<256>, z.ZodLiteral<1024>, z.ZodLiteral<4096>]>>;
|
|
57
|
+
};
|
|
58
|
+
export declare const GET_UPLOAD_STATUS_SHAPE: {
|
|
59
|
+
uploadSessionId: z.ZodString;
|
|
60
|
+
};
|
|
61
|
+
export declare const CLASSIFY_AUDIO_SHAPE: {
|
|
62
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
63
|
+
url: z.ZodOptional<z.ZodString>;
|
|
64
|
+
threshold: z.ZodDefault<z.ZodNumber>;
|
|
65
|
+
filterMinDurationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
waitForResult: z.ZodDefault<z.ZodAny>;
|
|
67
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
68
|
+
callbackSecret: z.ZodOptional<z.ZodString>;
|
|
69
|
+
latitude: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
longitude: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
};
|
|
72
|
+
export declare const CLASSIFY_BATCH_SHAPE: {
|
|
73
|
+
filePaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
74
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
url: z.ZodString;
|
|
76
|
+
id: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
url: string;
|
|
79
|
+
id?: string | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
url: string;
|
|
82
|
+
id?: string | undefined;
|
|
83
|
+
}>, "many">>;
|
|
84
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
85
|
+
callbackSecret: z.ZodOptional<z.ZodString>;
|
|
86
|
+
threshold: z.ZodDefault<z.ZodNumber>;
|
|
87
|
+
filterMinDurationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
latitude: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
longitude: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
};
|
|
91
|
+
export declare const CREATE_WEBHOOK_SHAPE: {
|
|
92
|
+
url: z.ZodString;
|
|
93
|
+
events: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
94
|
+
description: z.ZodOptional<z.ZodString>;
|
|
95
|
+
taxonomyFilter: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
96
|
+
notificationTierDepth: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
notificationTierValues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
98
|
+
};
|
|
99
|
+
export declare const UPDATE_WEBHOOK_SHAPE: {
|
|
100
|
+
webhookId: z.ZodString;
|
|
101
|
+
url: z.ZodOptional<z.ZodString>;
|
|
102
|
+
events: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
103
|
+
status: z.ZodOptional<z.ZodEnum<["active", "paused"]>>;
|
|
104
|
+
description: z.ZodOptional<z.ZodString>;
|
|
105
|
+
taxonomyFilter: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
106
|
+
notificationTierDepth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
107
|
+
notificationTierValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
108
|
+
};
|
|
109
|
+
export declare const GET_WEBHOOK_SHAPE: {
|
|
110
|
+
webhookId: z.ZodString;
|
|
111
|
+
};
|
|
112
|
+
export declare const DELETE_WEBHOOK_SHAPE: {
|
|
113
|
+
webhookId: z.ZodString;
|
|
114
|
+
};
|
|
115
|
+
export declare const PING_WEBHOOK_SHAPE: {
|
|
116
|
+
webhookId: z.ZodString;
|
|
117
|
+
};
|
|
118
|
+
export declare const LIST_WEBHOOK_DELIVERIES_SHAPE: {
|
|
119
|
+
webhookId: z.ZodString;
|
|
120
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
121
|
+
};
|
|
122
|
+
export declare const GET_JOB_REPORT_SHAPE: {
|
|
123
|
+
jobId: z.ZodString;
|
|
124
|
+
};
|
|
125
|
+
export declare const toolDescriptions: Record<string, string>;
|
|
126
|
+
export declare const toolShapes: Readonly<Record<string, ZodRawShape>>;
|
|
127
|
+
export declare const toolSchemas: Readonly<Record<string, unknown>>;
|
|
128
|
+
export declare const toolNames: readonly string[];
|
|
129
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAM1C,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,eAAO,MAAM,kBAAkB;;;;;CAS9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;CAa3B,CAAC;AAEF,eAAO,MAAM,aAAa;;CAGzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;CAyBhC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;CAG/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;CAKlC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;CAGnC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;CAmBhC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;CAoBhC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;CAahC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAiBhC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAG7B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAGhC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;CAG9B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;CAKzC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAGhC,CAAC;AAOF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+CnD,CAAC;AA0BF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAyB,CAAC;AAcvF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzD,CAAC;AAIF,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAAuC,CAAC"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for H-ear MCP tool inputSchemas and descriptions.
|
|
3
|
+
*
|
|
4
|
+
* Why this file exists: stdio and https transports must advertise identical
|
|
5
|
+
* tool contracts to clients. Stdio uses the Zod shapes directly in
|
|
6
|
+
* `server.tool(name, desc, shape, ...)`. The APIM REST-as-MCP passthrough
|
|
7
|
+
* (api-version 2025-03-01-preview) auto-generates tool schemas from APIM
|
|
8
|
+
* operations but DROPS query/header parameters, so filters like
|
|
9
|
+
* `listClasses(category: "Animal")` silently vanish on the https transport
|
|
10
|
+
* unless we patch explicit inputSchemas into `mcpTools[]`.
|
|
11
|
+
*
|
|
12
|
+
* Flow: Zod SHAPE → zod-to-json-schema → toolSchemas / toolDescriptions →
|
|
13
|
+
* consumed by stdio tool files AND by scripts/userMcp.root-status.mjs
|
|
14
|
+
* when PATCHing APIM.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
18
|
+
import { HEAR_API } from '@h-ear/core';
|
|
19
|
+
// ─── Shapes (authoritative) ──────────────────────────────────────────────────
|
|
20
|
+
export const HEALTH_CHECK_SHAPE = {};
|
|
21
|
+
export const USAGE_SHAPE = {};
|
|
22
|
+
export const LIST_WEBHOOKS_SHAPE = {};
|
|
23
|
+
export const LIST_CLASSES_SHAPE = {
|
|
24
|
+
taxonomy: z.enum(['audioset-yamnet-521', 'audioset-panns-527', 'species']).optional()
|
|
25
|
+
.describe('Taxonomy to query. Defaults to audioset-yamnet-521.'),
|
|
26
|
+
category: z.string().optional()
|
|
27
|
+
.describe('Filter by category name (case-insensitive partial match). E.g. "Animal", "Human sounds", "Music".'),
|
|
28
|
+
limit: z.number().int().positive().optional()
|
|
29
|
+
.describe('Max classes to return (pagination).'),
|
|
30
|
+
offset: z.number().int().min(0).optional()
|
|
31
|
+
.describe('Number of classes to skip (pagination).'),
|
|
32
|
+
};
|
|
33
|
+
export const LIST_JOBS_SHAPE = {
|
|
34
|
+
limit: z.number().int().positive().max(100).default(10)
|
|
35
|
+
.describe('Max jobs to return (1-100, default 10).'),
|
|
36
|
+
offset: z.number().int().min(0).default(0)
|
|
37
|
+
.describe('Number of jobs to skip (pagination).'),
|
|
38
|
+
status: z.enum(['processing', 'completed', 'failed']).optional()
|
|
39
|
+
.describe('Filter by job status.'),
|
|
40
|
+
batchId: z.string().optional()
|
|
41
|
+
.describe('Filter by batch ID (from classifyBatch).'),
|
|
42
|
+
startDate: z.string().optional()
|
|
43
|
+
.describe('ISO8601 date range start — jobs created on or after this date (e.g. "2026-01-01T00:00:00Z").'),
|
|
44
|
+
endDate: z.string().optional()
|
|
45
|
+
.describe('ISO8601 date range end — jobs created on or before this date (e.g. "2026-04-04T23:59:59Z").'),
|
|
46
|
+
};
|
|
47
|
+
export const GET_JOB_SHAPE = {
|
|
48
|
+
jobId: z.string().min(1)
|
|
49
|
+
.describe('The job ID returned from classifyAudio or classifyBatch.'),
|
|
50
|
+
};
|
|
51
|
+
export const GET_JOB_EVENTS_SHAPE = {
|
|
52
|
+
jobId: z.string().min(1)
|
|
53
|
+
.describe('Job ID from classifyAudio, classifyBatch, or listJobs.'),
|
|
54
|
+
taxonomy: z.string().optional()
|
|
55
|
+
.describe('Filter by taxonomy: audioset-yamnet-521, audioset-panns-527, or species.'),
|
|
56
|
+
minConfidence: z.number().min(0).max(1).optional()
|
|
57
|
+
.describe('Minimum confidence threshold (0.0–1.0). e.g. 0.7 returns only events ≥70% confidence.'),
|
|
58
|
+
category: z.string().optional()
|
|
59
|
+
.describe('Filter by tier1 category (e.g. "Animal", "Music", "Vehicle", "Nature").'),
|
|
60
|
+
tier2: z.string().optional()
|
|
61
|
+
.describe('Filter by tier2 subcategory (e.g. "Domestic animals, pets", "Wild animals"). Narrows within a tier1 category.'),
|
|
62
|
+
tier3: z.string().optional()
|
|
63
|
+
.describe('Filter by tier3 class (e.g. "Dog", "Cat", "Bird"). Finest supported filter depth — tiers 4-5 exist in the taxonomy but are not filterable.'),
|
|
64
|
+
startTime: z.number().min(0).optional()
|
|
65
|
+
.describe('Only return events starting at or after this time in seconds.'),
|
|
66
|
+
endTime: z.number().min(0).optional()
|
|
67
|
+
.describe('Only return events ending at or before this time in seconds.'),
|
|
68
|
+
sourceId: z.string().optional()
|
|
69
|
+
.describe('Filter by noise source cluster ID.'),
|
|
70
|
+
sort: z.string().optional()
|
|
71
|
+
.describe('Sort field:direction — e.g. "startTime:asc", "confidence:desc", "decibelLevel:desc".'),
|
|
72
|
+
limit: z.number().int().positive().max(5000).default(50)
|
|
73
|
+
.describe('Max events per page (1–5000, default 50). Start small — a 12h recording can have 10,000+ events. Use filters to narrow before increasing.'),
|
|
74
|
+
offset: z.number().int().min(0).default(0)
|
|
75
|
+
.describe('Pagination offset.'),
|
|
76
|
+
};
|
|
77
|
+
export const GET_JOB_AUDIO_SHAPE = {
|
|
78
|
+
jobId: z.string().min(1)
|
|
79
|
+
.describe('Job ID from classifyAudio, classifyBatch, or listJobs.'),
|
|
80
|
+
};
|
|
81
|
+
export const GET_JOB_WAVEFORM_SHAPE = {
|
|
82
|
+
jobId: z.string().min(1)
|
|
83
|
+
.describe('Job ID from classifyAudio, classifyBatch, or listJobs.'),
|
|
84
|
+
zoom: z.union([z.literal(256), z.literal(1024), z.literal(4096)]).default(1024)
|
|
85
|
+
.describe('Waveform resolution in samples-per-pixel: 256 (high detail), 1024 (default), 4096 (overview).'),
|
|
86
|
+
};
|
|
87
|
+
export const GET_UPLOAD_STATUS_SHAPE = {
|
|
88
|
+
uploadSessionId: z.string().min(1)
|
|
89
|
+
.describe('The uploadSessionId returned by classifyAudio for large files.'),
|
|
90
|
+
};
|
|
91
|
+
export const CLASSIFY_AUDIO_SHAPE = {
|
|
92
|
+
filePath: z.string().optional()
|
|
93
|
+
.describe('Path to a local audio file (Desktop/CLI only — requires local filesystem access). The server reads and encodes it automatically. Large files are split into chunks. Use url for web/mobile clients.'),
|
|
94
|
+
url: z.string().url().optional()
|
|
95
|
+
.describe('Public URL to audio file.'),
|
|
96
|
+
threshold: z.number().min(0).max(1).default(0.3)
|
|
97
|
+
.describe('Confidence threshold (0.0-1.0). Only classes above this score are returned.'),
|
|
98
|
+
filterMinDurationSeconds: z.number().min(0.1).max(595).optional()
|
|
99
|
+
.describe('Minimum event duration filter in seconds.'),
|
|
100
|
+
waitForResult: z.any().default(false)
|
|
101
|
+
.describe('If true, polls until classification completes (up to 5 min). Default false — returns immediately with job ID for later retrieval via getJob.'),
|
|
102
|
+
callbackUrl: z.string().url().optional()
|
|
103
|
+
.describe('Webhook URL (HTTPS) for async result delivery. When provided, the server POSTs classification results to this URL on completion — no polling needed. Use getJob to check status manually.'),
|
|
104
|
+
callbackSecret: z.string().optional()
|
|
105
|
+
.describe('HMAC-SHA256 secret for webhook signature verification. Only used with callbackUrl.'),
|
|
106
|
+
latitude: z.number().min(-90).max(90).optional()
|
|
107
|
+
.describe('GPS latitude (decimal degrees, -90 to 90). Tag the recording location. Must be paired with longitude.'),
|
|
108
|
+
longitude: z.number().min(-180).max(180).optional()
|
|
109
|
+
.describe('GPS longitude (decimal degrees, -180 to 180). Tag the recording location. Must be paired with latitude.'),
|
|
110
|
+
};
|
|
111
|
+
export const CLASSIFY_BATCH_SHAPE = {
|
|
112
|
+
filePaths: z.array(z.string()).min(1).max(HEAR_API.MAX_BATCH_FILES).optional()
|
|
113
|
+
.describe('Array of local audio file paths to classify (Desktop/CLI only — requires local filesystem access). Use files with URLs for web/mobile clients.'),
|
|
114
|
+
files: z.array(z.object({
|
|
115
|
+
url: z.string().url().describe('Public URL to audio file.'),
|
|
116
|
+
id: z.string().optional().describe('Client-provided tracking ID.'),
|
|
117
|
+
})).min(1).max(HEAR_API.MAX_BATCH_FILES).optional()
|
|
118
|
+
.describe('Array of public audio URLs (alternative to filePaths). Requires callbackUrl.'),
|
|
119
|
+
callbackUrl: z.string().url().optional()
|
|
120
|
+
.describe('Webhook URL (HTTPS) for async result delivery. Required for URL-based files. Optional for local files — when provided, skips polling and delivers results via webhook instead.'),
|
|
121
|
+
callbackSecret: z.string().optional()
|
|
122
|
+
.describe('HMAC-SHA256 secret for webhook signature verification.'),
|
|
123
|
+
threshold: z.number().min(0).max(1).default(0.3)
|
|
124
|
+
.describe('Confidence threshold for all files.'),
|
|
125
|
+
filterMinDurationSeconds: z.number().min(0.1).max(595).optional()
|
|
126
|
+
.describe('Minimum event duration filter in seconds.'),
|
|
127
|
+
latitude: z.number().min(-90).max(90).optional()
|
|
128
|
+
.describe('GPS latitude (decimal degrees, -90 to 90). Applied to all files in the batch. Must be paired with longitude.'),
|
|
129
|
+
longitude: z.number().min(-180).max(180).optional()
|
|
130
|
+
.describe('GPS longitude (decimal degrees, -180 to 180). Applied to all files in the batch. Must be paired with latitude.'),
|
|
131
|
+
};
|
|
132
|
+
export const CREATE_WEBHOOK_SHAPE = {
|
|
133
|
+
url: z.string().url()
|
|
134
|
+
.describe('HTTPS webhook URL where events will be POSTed.'),
|
|
135
|
+
events: z.array(z.string()).optional()
|
|
136
|
+
.describe('Event types to subscribe to (e.g. job.completed, job.failed). Defaults to all events if omitted.'),
|
|
137
|
+
description: z.string().max(200).optional()
|
|
138
|
+
.describe('Human-readable description for this webhook.'),
|
|
139
|
+
taxonomyFilter: z.array(z.string()).optional()
|
|
140
|
+
.describe('Scope notifications to specific taxonomies (e.g. audioset-yamnet-521, species).'),
|
|
141
|
+
notificationTierDepth: z.number().int().min(1).max(3).optional()
|
|
142
|
+
.describe('AudioSet tier depth for filtering: 1=coarse (Animal), 2=mid (Domestic animals, pets), 3=fine (Dog). Max depth is 3 — the taxonomy has tiers 4-5 but webhook filtering does not extend beyond tier 3. Must pair with notificationTierValues.'),
|
|
143
|
+
notificationTierValues: z.array(z.string()).optional()
|
|
144
|
+
.describe('Tier labels to match at the specified depth (e.g. ["Animal", "Music"]). Must pair with notificationTierDepth.'),
|
|
145
|
+
};
|
|
146
|
+
export const UPDATE_WEBHOOK_SHAPE = {
|
|
147
|
+
webhookId: z.string().min(1)
|
|
148
|
+
.describe('The webhook ID to update.'),
|
|
149
|
+
url: z.string().url().optional()
|
|
150
|
+
.describe('New HTTPS webhook URL.'),
|
|
151
|
+
events: z.array(z.string()).optional()
|
|
152
|
+
.describe('New event types to subscribe to.'),
|
|
153
|
+
status: z.enum(['active', 'paused']).optional()
|
|
154
|
+
.describe('Set to "paused" to disable or "active" to re-enable.'),
|
|
155
|
+
description: z.string().max(200).optional()
|
|
156
|
+
.describe('Updated description.'),
|
|
157
|
+
taxonomyFilter: z.array(z.string()).nullable().optional()
|
|
158
|
+
.describe('Scope to taxonomies. Pass null to clear filter.'),
|
|
159
|
+
notificationTierDepth: z.number().int().min(1).max(3).nullable().optional()
|
|
160
|
+
.describe('AudioSet tier depth (1=coarse, 2=mid, 3=fine). Max depth is 3 — tiers 4-5 exist in the taxonomy but are not supported for webhook filtering. Pass null to clear. Must pair with notificationTierValues.'),
|
|
161
|
+
notificationTierValues: z.array(z.string()).nullable().optional()
|
|
162
|
+
.describe('Tier labels to match. Pass null to clear. Must pair with notificationTierDepth.'),
|
|
163
|
+
};
|
|
164
|
+
export const GET_WEBHOOK_SHAPE = {
|
|
165
|
+
webhookId: z.string().min(1)
|
|
166
|
+
.describe('The webhook ID to retrieve.'),
|
|
167
|
+
};
|
|
168
|
+
export const DELETE_WEBHOOK_SHAPE = {
|
|
169
|
+
webhookId: z.string().min(1)
|
|
170
|
+
.describe('The webhook ID to delete.'),
|
|
171
|
+
};
|
|
172
|
+
export const PING_WEBHOOK_SHAPE = {
|
|
173
|
+
webhookId: z.string().min(1)
|
|
174
|
+
.describe('The webhook ID to ping.'),
|
|
175
|
+
};
|
|
176
|
+
export const LIST_WEBHOOK_DELIVERIES_SHAPE = {
|
|
177
|
+
webhookId: z.string().min(1)
|
|
178
|
+
.describe('The webhook ID to get deliveries for.'),
|
|
179
|
+
limit: z.number().int().positive().max(100).default(20)
|
|
180
|
+
.describe('Max deliveries to return (1-100, default 20).'),
|
|
181
|
+
};
|
|
182
|
+
export const GET_JOB_REPORT_SHAPE = {
|
|
183
|
+
jobId: z.string().min(1)
|
|
184
|
+
.describe('Job ID from classifyAudio, classifyBatch, or listJobs.'),
|
|
185
|
+
};
|
|
186
|
+
// ─── Descriptions (authoritative) ────────────────────────────────────────────
|
|
187
|
+
const formats = HEAR_API.SUPPORTED_FORMATS.join(', ');
|
|
188
|
+
const maxMB = HEAR_API.MAX_FILE_SIZE_BYTES / (1024 * 1024);
|
|
189
|
+
export const toolDescriptions = {
|
|
190
|
+
healthCheck: 'Check H-ear API health and liveness. No authentication required. Returns API status/version, deployment timestamp, and the loaded @h-ear/mcp-server package version (mcpServerVersion) for --pull verification.',
|
|
191
|
+
usage: 'Get H-ear API usage statistics: minutes used, calls today, quota remaining, active keys. Requires API key (HEAR_API_KEY).',
|
|
192
|
+
listClasses: 'List supported audio classification classes. Default taxonomy: audioset-yamnet-521 (521 classes across 7 categories). Also available: audioset-panns-527 (527 classes), species (6522 bird species). ' +
|
|
193
|
+
'Each class has a tierDepth (1–5) indicating its position in the AudioSet hierarchy, but filtering in getJobEvents and webhook notifications is supported up to tier 3 only. ' +
|
|
194
|
+
'Response fields: total and totalFiltered both reflect the post-filter count; totalAvailable is the unfiltered class count for the entire taxonomy. ' +
|
|
195
|
+
'Some AudioSet indices are retired and absent (e.g. 79, 83, 87) — this is normal, do not treat index gaps as errors. ' +
|
|
196
|
+
'No authentication required.',
|
|
197
|
+
listJobs: 'List recent classification jobs with status, file name, event count, and timestamps. Supports pagination. Requires API key (HEAR_API_KEY).',
|
|
198
|
+
getJob: 'Get detailed results for a specific classification job, including all detected sound events and classifications. Requires API key (HEAR_API_KEY).',
|
|
199
|
+
getJobEvents: 'Get paginated and filtered noise events for a completed classification job. ' +
|
|
200
|
+
'Use minConfidence to filter by confidence threshold (e.g. 0.7 for ≥70%). ' +
|
|
201
|
+
'Use category/tier2/tier3 to filter by sound class hierarchy up to 3 tiers deep (e.g. "Animal" > "Domestic animals, pets" > "Dog"). ' +
|
|
202
|
+
'Use startTime/endTime to get events within a time window in seconds. ' +
|
|
203
|
+
'Returns startTime, endTime, tier1 class, confidence, decibelLevel, and realTimeStart for each event. ' +
|
|
204
|
+
'IMPORTANT: Long recordings can produce thousands of events. Always start with a small limit (10–50) and use filters (category, minConfidence, startTime/endTime) to narrow results before increasing. ' +
|
|
205
|
+
'For bulk export use getJobAudio to download the source file instead. ' +
|
|
206
|
+
'Requires API key.',
|
|
207
|
+
getJobAudio: 'Get a time-limited SAS URL for streaming the source audio of a classification job. ' +
|
|
208
|
+
'Returns a 1-hour URL for direct audio playback via HTML5 <audio> element or fetch. ' +
|
|
209
|
+
'The URL supports HTTP Range requests — browsers can seek without downloading the full file. ' +
|
|
210
|
+
'For event-specific playback, append a Media Fragment time range to the URL: audioUrl + "#t=1.92,5.76". ' +
|
|
211
|
+
'Only available for jobs submitted via file upload (not URL-submitted jobs). ' +
|
|
212
|
+
'Requires API key.',
|
|
213
|
+
getJobWaveform: 'Get pre-computed waveform data and audio URL for a completed classification job. ' +
|
|
214
|
+
'Returns waveformUrl (peaks.js-compatible .dat binary) and audioUrl for synchronized playback. ' +
|
|
215
|
+
'Initialize peaks.js with: Peaks.init({ dataUri: { arraybuffer: waveformUrl }, mediaElement: audioEl }). ' +
|
|
216
|
+
'If waveformUrl is null, use wavesurfer.js with audioUrl instead (decodes via Web Audio API). ' +
|
|
217
|
+
'Zoom controls resolution: 256=high detail, 1024=standard (default), 4096=overview. ' +
|
|
218
|
+
'Both URLs expire in 1 hour. ' +
|
|
219
|
+
'For event navigation, combine with getJobEvents to get startTime values for seeking. ' +
|
|
220
|
+
'Requires API key.',
|
|
221
|
+
getUploadStatus: 'Check the status of an in-flight byte-slice upload started by classifyAudio in fire-and-return mode. Returns slice progress, and once status is "complete", a requestId you can pass to getJob. State lives in the MCP server process — if the process restarted since the upload started, the session will not be found.',
|
|
222
|
+
getJobReport: 'Get a 7-day SAS URL to download the Excel analysis report for a completed classification job. Returns `{ jobId, reportUrl, expiresIn }`. Returns 409 if the job is still processing, 404 if the report blob is missing. Requires API key.',
|
|
223
|
+
classifyAudio: `Classify a local audio file or public URL for noise/sound detection. Provide filePath (recommended) or url. Returns detected sound classes with confidence scores. Formats: ${formats}. Files over ${maxMB}MB are automatically uploaded via byte-slice chunking (no ffmpeg required). Requires API key (HEAR_API_KEY). For large files, may take several minutes to upload. Returns job ID for later retrieval via getJob.`,
|
|
224
|
+
classifyBatch: `Classify multiple audio files. Provide filePaths for local files (recommended) or files with URLs. Local files: submits all then polls each sequentially (may take several minutes), or provide callbackUrl to skip polling and receive results via webhook. URL files: returns immediately with batch ID (results via webhook). Max ${HEAR_API.MAX_BATCH_FILES} files. Requires API key (HEAR_API_KEY).`,
|
|
225
|
+
createWebhook: 'Create an enterprise webhook registration for async event delivery (job.completed, job.failed, etc.). Returns webhook details and a signing secret shown ONCE — save it immediately. Supports taxonomy and tier-based notification filtering. Requires Bearer token (enterprise subscription).',
|
|
226
|
+
updateWebhook: 'Update an enterprise webhook registration. Change events, URL, status (active/paused), or notification filters. Set status to "paused" to temporarily disable without deleting. Requires Bearer token (enterprise subscription).',
|
|
227
|
+
listWebhooks: 'List all enterprise webhook registrations. Shows URL, subscribed events, status, failure count, and notification filter config. Requires Bearer token (enterprise subscription).',
|
|
228
|
+
getWebhook: 'Get detailed information about a specific enterprise webhook, including delivery stats, notification filters, and status. Requires Bearer token (enterprise subscription).',
|
|
229
|
+
deleteWebhook: 'Permanently delete an enterprise webhook registration. This action cannot be undone. Requires Bearer token (enterprise subscription).',
|
|
230
|
+
pingWebhook: 'Send a test ping event to an enterprise webhook to verify connectivity. Returns delivery result with response status and timing. Requires Bearer token (enterprise subscription).',
|
|
231
|
+
listWebhookDeliveries: 'List recent delivery attempts for an enterprise webhook. Shows event type, HTTP response status, success/failure, timing, and attempt count for audit trail. Requires Bearer token (enterprise subscription).',
|
|
232
|
+
};
|
|
233
|
+
// ─── Shape map ───────────────────────────────────────────────────────────────
|
|
234
|
+
const shapes = {
|
|
235
|
+
healthCheck: HEALTH_CHECK_SHAPE,
|
|
236
|
+
usage: USAGE_SHAPE,
|
|
237
|
+
listClasses: LIST_CLASSES_SHAPE,
|
|
238
|
+
listJobs: LIST_JOBS_SHAPE,
|
|
239
|
+
getJob: GET_JOB_SHAPE,
|
|
240
|
+
getJobEvents: GET_JOB_EVENTS_SHAPE,
|
|
241
|
+
getJobAudio: GET_JOB_AUDIO_SHAPE,
|
|
242
|
+
getJobWaveform: GET_JOB_WAVEFORM_SHAPE,
|
|
243
|
+
getJobReport: GET_JOB_REPORT_SHAPE,
|
|
244
|
+
getUploadStatus: GET_UPLOAD_STATUS_SHAPE,
|
|
245
|
+
classifyAudio: CLASSIFY_AUDIO_SHAPE,
|
|
246
|
+
classifyBatch: CLASSIFY_BATCH_SHAPE,
|
|
247
|
+
createWebhook: CREATE_WEBHOOK_SHAPE,
|
|
248
|
+
updateWebhook: UPDATE_WEBHOOK_SHAPE,
|
|
249
|
+
listWebhooks: LIST_WEBHOOKS_SHAPE,
|
|
250
|
+
getWebhook: GET_WEBHOOK_SHAPE,
|
|
251
|
+
deleteWebhook: DELETE_WEBHOOK_SHAPE,
|
|
252
|
+
pingWebhook: PING_WEBHOOK_SHAPE,
|
|
253
|
+
listWebhookDeliveries: LIST_WEBHOOK_DELIVERIES_SHAPE,
|
|
254
|
+
};
|
|
255
|
+
export const toolShapes = Object.freeze(shapes);
|
|
256
|
+
// ─── JSON Schemas (derived from shapes) ──────────────────────────────────────
|
|
257
|
+
function shapeToJsonSchema(shape) {
|
|
258
|
+
// zod-to-json-schema expects a ZodObject; wrap the raw shape.
|
|
259
|
+
const obj = z.object(shape);
|
|
260
|
+
const full = zodToJsonSchema(obj, { $refStrategy: 'none' });
|
|
261
|
+
// Strip the top-level $schema keyword for a compact inputSchema payload; APIM
|
|
262
|
+
// accepts JSON Schema draft-07 style without it.
|
|
263
|
+
delete full.$schema;
|
|
264
|
+
return full;
|
|
265
|
+
}
|
|
266
|
+
export const toolSchemas = Object.freeze(Object.fromEntries(Object.entries(shapes).map(([name, shape]) => [name, shapeToJsonSchema(shape)])));
|
|
267
|
+
// ─── Tool name catalogue ─────────────────────────────────────────────────────
|
|
268
|
+
export const toolNames = Object.freeze(Object.keys(shapes));
|
|
269
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE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ourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAuB/D,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAoC/F"}
|
package/dist/server.js
CHANGED
|
@@ -17,6 +17,7 @@ import { registerGetJob } from './tools/get-job.js';
|
|
|
17
17
|
import { registerGetJobEvents } from './tools/get-job-events.js';
|
|
18
18
|
import { registerGetJobAudio } from './tools/get-job-audio.js';
|
|
19
19
|
import { registerGetJobWaveform } from './tools/get-job-waveform.js';
|
|
20
|
+
import { registerGetJobReport } from './tools/get-job-report.js';
|
|
20
21
|
import { registerCreateWebhook } from './tools/create-webhook.js';
|
|
21
22
|
import { registerListWebhooks } from './tools/list-webhooks.js';
|
|
22
23
|
import { registerGetWebhook } from './tools/get-webhook.js';
|
|
@@ -24,6 +25,7 @@ import { registerUpdateWebhook } from './tools/update-webhook.js';
|
|
|
24
25
|
import { registerDeleteWebhook } from './tools/delete-webhook.js';
|
|
25
26
|
import { registerPingWebhook } from './tools/ping-webhook.js';
|
|
26
27
|
import { registerListWebhookDeliveries } from './tools/list-webhook-deliveries.js';
|
|
28
|
+
import { registerGetUploadStatus } from './tools/get-upload-status.js';
|
|
27
29
|
import { registerApiStatus } from './resources/api-status.js';
|
|
28
30
|
import { registerClassifyAudioPrompt } from './prompts/classify-audio.js';
|
|
29
31
|
export function createServer(config) {
|
|
@@ -40,6 +42,7 @@ export function createServer(config) {
|
|
|
40
42
|
registerGetJobEvents(server, client);
|
|
41
43
|
registerGetJobAudio(server, client);
|
|
42
44
|
registerGetJobWaveform(server, client);
|
|
45
|
+
registerGetJobReport(server, client);
|
|
43
46
|
registerCreateWebhook(server, client);
|
|
44
47
|
registerListWebhooks(server, client);
|
|
45
48
|
registerGetWebhook(server, client);
|
|
@@ -47,6 +50,7 @@ export function createServer(config) {
|
|
|
47
50
|
registerDeleteWebhook(server, client);
|
|
48
51
|
registerPingWebhook(server, client);
|
|
49
52
|
registerListWebhookDeliveries(server, client);
|
|
53
|
+
registerGetUploadStatus(server);
|
|
50
54
|
// Resources
|
|
51
55
|
registerApiStatus(server, client, config);
|
|
52
56
|
// Prompts
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD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B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,6BAA6B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAEhC,YAAY;IACZ,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C,UAAU;IACV,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify-audio.d.ts","sourceRoot":"","sources":["../../src/tools/classify-audio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"classify-audio.d.ts","sourceRoot":"","sources":["../../src/tools/classify-audio.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EACH,KAAK,aAAa,EAErB,MAAM,aAAa,CAAC;AA0CrB,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAmMpF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { createReadStream, readFileSync, existsSync, statSync } from 'fs';
|
|
3
2
|
import { basename, extname } from 'path';
|
|
4
3
|
import { createHash } from 'crypto';
|
|
5
4
|
import { pipeline } from 'stream/promises';
|
|
6
5
|
import { HearApiError, HEAR_API, getAudioDuration, } from '@h-ear/core';
|
|
7
6
|
import { createProgressReporter } from '../progress.js';
|
|
7
|
+
import { trackerStart, trackerUpdate } from '../upload-tracker.js';
|
|
8
|
+
import { CLASSIFY_AUDIO_SHAPE, toolDescriptions } from '../schemas/index.js';
|
|
8
9
|
async function hashFile(filePath) {
|
|
9
10
|
const hash = createHash('sha256');
|
|
10
11
|
await pipeline(createReadStream(filePath, { highWaterMark: 1024 * 1024 }), hash);
|
|
@@ -40,28 +41,8 @@ async function buildClientMetadata(filePath, fileStat) {
|
|
|
40
41
|
return out;
|
|
41
42
|
}
|
|
42
43
|
const formats = HEAR_API.SUPPORTED_FORMATS.join(', ');
|
|
43
|
-
const maxMB = HEAR_API.MAX_FILE_SIZE_BYTES / (1024 * 1024);
|
|
44
44
|
export function registerClassifyAudio(server, client) {
|
|
45
|
-
server.tool('classifyAudio',
|
|
46
|
-
filePath: z.string().optional()
|
|
47
|
-
.describe('Path to a local audio file (Desktop/CLI only — requires local filesystem access). The server reads and encodes it automatically. Large files are split into chunks. Use url for web/mobile clients.'),
|
|
48
|
-
url: z.string().url().optional()
|
|
49
|
-
.describe('Public URL to audio file.'),
|
|
50
|
-
threshold: z.number().min(0).max(1).default(0.3)
|
|
51
|
-
.describe('Confidence threshold (0.0-1.0). Only classes above this score are returned.'),
|
|
52
|
-
filterMinDurationSeconds: z.number().min(0.1).max(595).optional()
|
|
53
|
-
.describe('Minimum event duration filter in seconds.'),
|
|
54
|
-
waitForResult: z.any().default(false)
|
|
55
|
-
.describe('If true, polls until classification completes (up to 5 min). Default false — returns immediately with job ID for later retrieval via getJob.'),
|
|
56
|
-
callbackUrl: z.string().url().optional()
|
|
57
|
-
.describe('Webhook URL (HTTPS) for async result delivery. When provided, the server POSTs classification results to this URL on completion — no polling needed. Use getJob to check status manually.'),
|
|
58
|
-
callbackSecret: z.string().optional()
|
|
59
|
-
.describe('HMAC-SHA256 secret for webhook signature verification. Only used with callbackUrl.'),
|
|
60
|
-
latitude: z.number().min(-90).max(90).optional()
|
|
61
|
-
.describe('GPS latitude (decimal degrees, -90 to 90). Tag the recording location. Must be paired with longitude.'),
|
|
62
|
-
longitude: z.number().min(-180).max(180).optional()
|
|
63
|
-
.describe('GPS longitude (decimal degrees, -180 to 180). Tag the recording location. Must be paired with latitude.'),
|
|
64
|
-
}, { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }, async (params, extra) => {
|
|
45
|
+
server.tool('classifyAudio', toolDescriptions.classifyAudio, CLASSIFY_AUDIO_SHAPE, { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }, async (params, extra) => {
|
|
65
46
|
try {
|
|
66
47
|
const { onProgress } = createProgressReporter(extra);
|
|
67
48
|
// Desktop sends booleans as strings — coerce here to keep schema simple
|
|
@@ -126,18 +107,20 @@ export function registerClassifyAudio(server, client) {
|
|
|
126
107
|
const result = await client.pollJob(accepted.requestId, onProgress);
|
|
127
108
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
128
109
|
}
|
|
129
|
-
// Large file: byte-slice upload.
|
|
110
|
+
// Large file: byte-slice upload. Head returns fast; tail runs in background to fit
|
|
111
|
+
// the MCP client tool-call wall budget. AI agent polls getUploadStatus(uploadSessionId)
|
|
112
|
+
// until status='complete', then uses the returned requestId with getJob.
|
|
130
113
|
const fileSize = stat.size;
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
onProgress(`Large file (${fileSizeMB.toFixed(1)}MB) — uploading in ${
|
|
114
|
+
const sliceSize = HEAR_API.MAX_FILE_SIZE_BYTES;
|
|
115
|
+
const totalSlices = Math.ceil(fileSize / sliceSize);
|
|
116
|
+
onProgress(`Large file (${fileSizeMB.toFixed(1)}MB) — uploading in ${totalSlices} byte slices`);
|
|
134
117
|
const chunks = [];
|
|
135
|
-
for (let i = 0; i <
|
|
136
|
-
const offset = i *
|
|
137
|
-
const length = Math.min(
|
|
118
|
+
for (let i = 0; i < totalSlices; i++) {
|
|
119
|
+
const offset = i * sliceSize;
|
|
120
|
+
const length = Math.min(sliceSize, fileSize - offset);
|
|
138
121
|
chunks.push({ filePath: params.filePath, offset, length, index: i });
|
|
139
122
|
}
|
|
140
|
-
const
|
|
123
|
+
const sliceOptions = {
|
|
141
124
|
threshold: params.threshold,
|
|
142
125
|
filterMinDurationSeconds: params.filterMinDurationSeconds,
|
|
143
126
|
callbackUrl: params.callbackUrl,
|
|
@@ -145,13 +128,60 @@ export function registerClassifyAudio(server, client) {
|
|
|
145
128
|
latitude: params.latitude,
|
|
146
129
|
longitude: params.longitude,
|
|
147
130
|
...clientMetadata,
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
131
|
+
};
|
|
132
|
+
// Wait-for-result: caller explicitly opts into the long blocking call (rare on stdio).
|
|
133
|
+
if (waitForResult) {
|
|
134
|
+
const accepted = await client.submitClassifyChunked(chunks, basename(params.filePath), sliceOptions, onProgress);
|
|
135
|
+
onProgress(`Polling job ${accepted.requestId}`);
|
|
136
|
+
const result = await client.pollJob(accepted.requestId, onProgress);
|
|
137
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
138
|
+
}
|
|
139
|
+
// Fire-and-return: head sync (one HTTP RTT), tail in background.
|
|
140
|
+
const head = await client.submitChunkUploadHead(chunks[0], basename(params.filePath), sliceOptions,
|
|
141
|
+
/*isFinal*/ totalSlices === 1, totalSlices, onProgress);
|
|
142
|
+
// Single-slice case: head was also final, requestId already returned.
|
|
143
|
+
if (totalSlices === 1) {
|
|
144
|
+
return { content: [{ type: 'text', text: JSON.stringify(head, null, 2) }] };
|
|
151
145
|
}
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
146
|
+
const headResult = head;
|
|
147
|
+
const startedAt = new Date().toISOString();
|
|
148
|
+
trackerStart({
|
|
149
|
+
uploadSessionId: headResult.uploadSessionId,
|
|
150
|
+
fileName: basename(params.filePath),
|
|
151
|
+
totalSlices,
|
|
152
|
+
slicesUploaded: headResult.chunksReceived,
|
|
153
|
+
totalBytes: headResult.totalBytes,
|
|
154
|
+
startedAt,
|
|
155
|
+
status: 'uploading',
|
|
156
|
+
});
|
|
157
|
+
// Background: upload remaining slices. Process stays alive between MCP tool calls.
|
|
158
|
+
void client.submitChunkUploadTail(headResult.uploadSessionId, chunks.slice(1), basename(params.filePath), headResult.chunksReceived, totalSlices, (msg) => {
|
|
159
|
+
// Best-effort: bump slicesUploaded each time the tail logs a slice ack.
|
|
160
|
+
const m = /server confirmed (\d+) slices/.exec(msg);
|
|
161
|
+
if (m) {
|
|
162
|
+
trackerUpdate(headResult.uploadSessionId, { slicesUploaded: parseInt(m[1], 10) });
|
|
163
|
+
}
|
|
164
|
+
process.stderr.write(`[h-ear-mcp] ${msg}\n`);
|
|
165
|
+
}).then((accepted) => {
|
|
166
|
+
trackerUpdate(headResult.uploadSessionId, {
|
|
167
|
+
status: 'complete',
|
|
168
|
+
slicesUploaded: totalSlices,
|
|
169
|
+
requestId: accepted.requestId,
|
|
170
|
+
});
|
|
171
|
+
}).catch((err) => {
|
|
172
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
173
|
+
trackerUpdate(headResult.uploadSessionId, { status: 'failed', error: msg });
|
|
174
|
+
process.stderr.write(`[h-ear-mcp] background upload failed for session ${headResult.uploadSessionId}: ${msg}\n`);
|
|
175
|
+
});
|
|
176
|
+
return { content: [{ type: 'text', text: JSON.stringify({
|
|
177
|
+
status: 'uploading',
|
|
178
|
+
uploadSessionId: headResult.uploadSessionId,
|
|
179
|
+
totalSlices,
|
|
180
|
+
slicesUploaded: headResult.chunksReceived,
|
|
181
|
+
totalBytes: headResult.totalBytes,
|
|
182
|
+
fileName: basename(params.filePath),
|
|
183
|
+
message: `Upload started in background. Poll getUploadStatus('${headResult.uploadSessionId}') until status='complete', then use the returned requestId with getJob.`,
|
|
184
|
+
}, null, 2) }] };
|
|
155
185
|
}
|
|
156
186
|
catch (error) {
|
|
157
187
|
// POLL_TIMEOUT: job is still processing server-side (large file / chunk-by-requeue).
|