Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ for (const tool of allTools) {
// const jsonSchema = zodToJsonSchema(z.object(tool.inputSchema.properties as z.ZodRawShape));
// const parsedSchema = z.any().optional().parse(jsonSchema);

const zodSchema = z.object(tool.inputSchema.properties as z.ZodRawShape);
server.tool(tool.name, zodSchema.shape, wrappedHandler)
const rawShape = tool.inputSchema.properties as z.ZodRawShape;
// Cast bypasses TS2589: server.tool's generic resolves ShapeOutput<Args>
// against the SDK's z3|z4 union schema type, exploding instantiation depth.
(server.tool as (name: string, schema: z.ZodRawShape, cb: typeof wrappedHandler) => unknown)(tool.name, rawShape, wrappedHandler);

}

Expand Down
3 changes: 2 additions & 1 deletion src/tools/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ async function loadUploadFromUrl(sourceUrl: string, explicitTitle?: string): Pro
}

const response = await axios.get<ArrayBuffer>(sourceUrl, { responseType: 'arraybuffer' });
const mimeType = normalizeMimeType(response.headers['content-type']);
const contentTypeHeader = response.headers['content-type'];
const mimeType = normalizeMimeType(typeof contentTypeHeader === 'string' ? contentTypeHeader : undefined);
const originalFilename = deriveFilenameFromUrl(sourceUrl, mimeType);
const filename = buildUploadFilename(originalFilename, explicitTitle);

Expand Down