Skip to main content
Glama
YawLabs

@yawlabs/electron-mcp

Official
by YawLabs

electron_generate_preload_bridge

Read-onlyIdempotent

Generate a complete, secure preload bridge exposing multiple IPC methods to the renderer via contextBridge, including TypeScript declarations and security best practices.

Instructions

Generate a complete, secure preload.ts with contextBridge.exposeInMainWorld for multiple API methods. Produces the preload script, TypeScript declarations for window.electronAPI, and security best practices. Use this when you need to expose several main-process APIs to the renderer at once.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodsYesArray of methods to expose through the preload bridge
namespaceNoThe property name on window, e.g. 'electronAPI'. Defaults to 'electronAPI'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.2.15
    • addedInput schema / properties / methods / items / properties / args / pattern
      Added value: +"^[^`\\r\\n]*$"
    • addedInput schema / properties / methods / items / properties / name / pattern
      Added value: +"^[a-zA-Z_$][\\w$]*$"
    • addedInput schema / properties / methods / items / properties / returnType / pattern
      Added value: +"^[^`\\r\\n]*$"
    • addedInput schema / properties / namespace / pattern
      Added value: +"^[a-zA-Z_$][\\w$]*$"
  2. First observedv1.2.13

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, destructiveHint, and idempotentHint, establishing the tool as a safe, idempotent code generator. The description adds behavioral context by detailing the generated artifacts (preload script, declarations, security best practices) and focuses on generation rather than side effects. No contradictions or missing behavioral traits given the tool's nature.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the main action, and every word earns its place. It efficiently conveys purpose, outputs, and usage guidance without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 parameters, one required), the description provides complete context: what it does, when to use it, what it produces, and security implications. Annotations cover safety, and no output schema is needed as the description already describes outputs. No gaps are evident.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with each parameter having descriptive details (e.g., method name, channel, type, args, returnType). The description adds no new parameter semantics beyond the schema, only reiterating the context of multiple methods. Baseline score of 3 is appropriate as the schema carries the parameter documentation burden.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates a complete, secure preload.ts with contextBridge.exposeInMainWorld for multiple API methods, and specifies outputs (preload script, TypeScript declarations, security best practices). It distinguishes from sibling tools by indicating it's for exposing several APIs at once, implying a difference from single-channel tools like electron_scaffold_ipc_channel.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says 'Use this when you need to expose several main-process APIs to the renderer at once,' providing clear usage context. It implicitly suggests alternatives for single methods but does not explicitly name them or state when not to use it, which would enhance guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.