Skip to content

get_screen crashes when an annotation has no type (Cannot read properties of undefined (reading 'name')) #5

@Brockenstein

Description

@Brockenstein

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

  1. Configure MCP with a valid ZEPLIN_ACCESS_TOKEN (per the README).
  2. Call get_screen with a Zeplin screen URL that returns annotations where type is missing or null from the Zeplin API.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions