Skip to main content
Glama
bmorphism

Penrose MCP Server

create_style

Define visual representation rules for mathematical diagrams by specifying canvas dimensions and styling rules with selectors, properties, and constraints.

Instructions

Define visual representation rules

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
canvasYes
rulesYes

Implementation Reference

  • The main handler logic for the 'create_style' tool. It validates the input arguments (canvas with width/height and array of rules), constructs a Style object with validated rules, generates a unique ID, stores it in the global 'styles' Map, and returns a success message with the ID.
    case "create_style": {
      const args = request.params.arguments;
      if (!args || typeof args !== 'object') {
        throw new Error('Invalid arguments');
      }
    
      const { canvas, rules } = args as {
        canvas?: { width?: number; height?: number };
        rules?: Array<any>;
      };
    
      if (!canvas || typeof canvas.width !== 'number' || typeof canvas.height !== 'number') {
        throw new Error('Invalid style definition: requires canvas with width and height');
      }
    
      if (!Array.isArray(rules)) {
        throw new Error('Invalid style definition: requires rules array');
      }
    
      // Validate rules
      const validatedRules: Array<StyleRule> = rules.map(rule => {
        if (!rule.selector || typeof rule.selector !== 'string' ||
            !rule.properties || typeof rule.properties !== 'object' ||
            !Array.isArray(rule.constraints)) {
          throw new Error('Invalid rule: requires selector, properties object, and constraints array');
        }
        return {
          selector: rule.selector,
          properties: rule.properties,
          constraints: rule.constraints.map((c: any) => String(c))
        };
      });
    
      const style: Style = {
        canvas: {
          width: canvas.width,
          height: canvas.height
        },
        rules: validatedRules
      };
    
      const id = `style_${styles.size + 1}`;
      styles.set(id, style);
      return {
        content: [{
          type: "text",
          text: `Created style: ${id}`
        }]
      };
    }
  • src/index.ts:255-287 (registration)
    The tool registration entry in the listTools response, including the name, description, and detailed inputSchema for validation.
    {
      name: "create_style",
      description: "Define visual representation rules",
      inputSchema: {
        type: "object",
        properties: {
          canvas: {
            type: "object",
            properties: {
              width: { type: "number" },
              height: { type: "number" }
            },
            required: ["width", "height"]
          },
          rules: {
            type: "array",
            items: {
              type: "object",
              properties: {
                selector: { type: "string" },
                properties: { type: "object" },
                constraints: {
                  type: "array",
                  items: { type: "string" }
                }
              },
              required: ["selector", "properties", "constraints"]
            }
          }
        },
        required: ["canvas", "rules"]
      }
    },
  • The input schema definition for the 'create_style' tool, specifying the structure for canvas (width, height) and rules array (selector, properties, constraints).
    inputSchema: {
      type: "object",
      properties: {
        canvas: {
          type: "object",
          properties: {
            width: { type: "number" },
            height: { type: "number" }
          },
          required: ["width", "height"]
        },
        rules: {
          type: "array",
          items: {
            type: "object",
            properties: {
              selector: { type: "string" },
              properties: { type: "object" },
              constraints: {
                type: "array",
                items: { type: "string" }
              }
            },
            required: ["selector", "properties", "constraints"]
          }
        }
      },
      required: ["canvas", "rules"]
    }
Behavior1/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but provides none. 'Define' suggests a creation/mutation operation, but there's no information about permissions needed, whether this is idempotent, what happens on failure, rate limits, or what the tool actually does beyond the vague 'define' action. No behavioral traits are disclosed.

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 extremely concise at just three words. While this represents severe under-specification, from a pure conciseness perspective, there's zero wasted language. Every word earns its place, and the description is front-loaded with the core concept.

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

Completeness1/5

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

For a tool with 2 complex parameters (including nested objects), 0% schema description coverage, no annotations, no output schema, and no sibling tool differentiation, the description is completely inadequate. It provides minimal context for what is clearly a sophisticated styling/visualization tool that requires understanding of canvas dimensions and rule structures.

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

Parameters2/5

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

With 0% schema description coverage and 2 complex parameters (canvas and rules), the description provides no parameter information whatsoever. It doesn't explain what 'canvas' represents, what 'rules' contain, or how these relate to 'visual representation rules.' The description fails to compensate for the complete lack of schema documentation.

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

Purpose2/5

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

The description 'Define visual representation rules' is vague and tautological - it essentially restates the tool name 'create_style' in different words. While it suggests something about visual rules, it doesn't specify what kind of style is being created, for what purpose, or what resource it operates on. It doesn't distinguish this from sibling tools like create_domain or create_substance.

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

Usage Guidelines1/5

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

The description provides absolutely no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, appropriate contexts, or when to choose this over sibling tools like create_domain, create_substance, or generate_diagram. The agent receives no usage direction whatsoever.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bmorphism/penrose-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server