feat: add public camera and radio tools

Add find_cctv_cameras, get_cctv_snapshot and find_radio_stations. A
snapshot returns the camera's current frame as image content with its
credit. Tool results may now carry base64 images, which the MCP adapter
sends as image content.
This commit is contained in:
Sameh Khamis committed 2026-10-01 12:11:00 -07:00
1 parent d65402eae3
commit 85fee59da1
10 files changed
+468 -4

No files matched your search

+12 -1
View File
@@ -61,7 +61,8 @@ export function fromSourceError(error) {
* Validate and freeze a tool definition.
*
* `run(args, { services, signal })` resolves to `{ summary, data }`: a short
* sentence for people and a structured object for programs.
* sentence for people and a structured object for programs. It may add
* `images`, each `{ mimeType, data }` with base64 data.
*/
export function defineTool({
name,
@@ -146,6 +147,16 @@ export function composeCatalog({
}
if (!result || typeof result.summary !== 'string' || !result.data)
throw new TypeError(`${tool.name} returned no summary or data`);
if (
result.images !== undefined &&
(!Array.isArray(result.images) ||
!result.images.every(
(item) =>
typeof item?.mimeType === 'string' &&
typeof item?.data === 'string',
))
)
throw new TypeError(`${tool.name} returned malformed images`);
return result;
};
const chain = interceptors.reduceRight(