Description
get_screen fails for some screens with:
Failed to fetch screen data: Cannot read properties of undefined (reading 'name')
Other screens in the same project work when they have no annotations (or only annotations that include a full type). This points at annotation handling, not authentication.
Steps to reproduce
- Configure MCP with a valid
ZEPLIN_ACCESS_TOKEN (per the README).
- Call
get_screen with a Zeplin screen URL that returns annotations where type is missing or null from the Zeplin API.
- Observe the error above.
Control: The same token and project work for get_screen on a screen whose annotations list is empty (annotations: []).
Expected behavior
get_screen should tolerate annotations that omit type (e.g. treat as "unknown" or skip invalid entries) and still return layer data.
Actual behavior
The tool throws before returning screen JSON.
Suspected cause
In src/clients/zeplinApi.ts, the function processScreenVersionsAndAnnotations maps each API annotation to an object and sets the type from annotation.type.name:
type: annotation.type.name,
Permalink: line 77 @ 9e61482
If the Zeplin API returns an annotation where type is missing or null, annotation.type is undefined and reading .name throws: Cannot read properties of undefined (reading 'name').
Suggested fix: use optional chaining and a fallback, for example:
type: annotation.type?.name ?? "unknown",
Alternatively, filter out annotations without a type before mapping if you prefer to omit invalid entries instead of labeling them.
Description
get_screenfails for some screens with:Failed to fetch screen data: Cannot read properties of undefined (reading 'name')
Other screens in the same project work when they have no annotations (or only annotations that include a full
type). This points at annotation handling, not authentication.Steps to reproduce
ZEPLIN_ACCESS_TOKEN(per the README).get_screenwith a Zeplin screen URL that returns annotations wheretypeis missing or null from the Zeplin API.Control: The same token and project work for
get_screenon a screen whose annotations list is empty (annotations: []).Expected behavior
get_screenshould tolerate annotations that omittype(e.g. treat as"unknown"or skip invalid entries) and still return layer data.Actual behavior
The tool throws before returning screen JSON.
Suspected cause
In
src/clients/zeplinApi.ts, the functionprocessScreenVersionsAndAnnotationsmaps each API annotation to an object and sets the type fromannotation.type.name:Permalink: line 77 @
9e61482If the Zeplin API returns an annotation where
typeis missing or null,annotation.typeisundefinedand reading.namethrows: Cannot read properties of undefined (reading 'name').Suggested fix: use optional chaining and a fallback, for example:
Alternatively, filter out annotations without a
typebefore mapping if you prefer to omit invalid entries instead of labeling them.