Skip to content

Commit 5dfc0e2

Browse files
committed
Fix ESLint: use optional chaining for mime type checks
1 parent dffabb0 commit 5dfc0e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/services/tools/file_read.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const createFileReadTool: ToolFactory = (config: ToolConfiguration) => {
1818
inputSchema: TOOL_DEFINITIONS.file_read.schema,
1919
toModelOutput: (output: FileReadToolResult) => {
2020
// If this is an image file with a mime type, return it as media content
21-
if (output.success && output.mime_type && output.mime_type.startsWith("image/")) {
21+
if (output.success && output.mime_type?.startsWith("image/")) {
2222
return {
2323
type: "content",
2424
value: [
@@ -78,7 +78,7 @@ export const createFileReadTool: ToolFactory = (config: ToolConfiguration) => {
7878
const mimeType = mime.lookup(resolvedPath) || undefined;
7979

8080
// Check if this is a binary image file
81-
if (mimeType && mimeType.startsWith("image/")) {
81+
if (mimeType?.startsWith("image/")) {
8282
// Read as binary and encode as base64 for images
8383
const buffer = await fs.readFile(resolvedPath);
8484
const base64Content = buffer.toString("base64");

0 commit comments

Comments
 (0)