improve response structure of image tool (#52)

Tool now more closely resembles the documented response shape of the image API endpoint. This tool also no longer preemptively loads base64-encoded image data. The images tool now uses a structured content response. Following the suggestion in https://modelcontextprotocol.io/specification/2025-06-18/server/tools#output-schema, we also provide an Output Schema, enabling clients to validate the response. As a result of this work, the Images tool requires a slightly different registration approach. For this reason, registration can now be handled via a local "register" method in each tool module. When tools were registered externally in a for-loop, the type system was unable to infer the shape of each tool due to the overloaded union (resulting from only the Image tool having an OutputSchema export).
This commit is contained in:
Sampson authored and GitHub committed 2025-09-06 10:35:08 -05:00
1 parent 398e88ffb8
commit 4fb81fb605
12 files changed
+234 -42

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
import type { QueryParams as WebQueryParams } from '../tools/web/params.js';
import type { QueryParams as ImageQueryParams } from '../tools/images/params.js';
import type { QueryParams as ImageQueryParams } from '../tools/images/schemas/input.js';
import type { QueryParams as VideoQueryParams } from '../tools/videos/params.js';
import type { QueryParams as NewsQueryParams } from '../tools/news/params.js';
import type { LocalPoisParams, LocalDescriptionsParams } from '../tools/local/params.js';