Skip to main content
Glama
angrysky56

Cognitive Diagram Navigation MCP Server

by angrysky56

apply_rewrite_rule

Apply a formal Double-Pushout rewrite rule to a diagram using a rule spec and match mapping, transforming its graph structure and returning modified stats.

Instructions

Apply a formal Double-Pushout (DPO) rewrite rule to a diagram.

Args: diagram_id: Target diagram ID rule_spec: Serialize RewriteRule dict with 'lhs' and 'rhs' patterns match_mapping: Mapping of rule LHS node IDs to diagram node IDs (from pattern_match)

Returns: dict containing success status and modified diagram stats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rule_specYes
diagram_idYes
match_mappingYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries full burden. It discloses it's a mutation ('modified diagram stats', 'Apply'), that it requires a match mapping, and that it returns success status. But it doesn't state whether the operation is reversible, whether it modifies in place, what permissions are needed, or how failures manifest beyond a 'success status'.

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

Conciseness4/5

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

Structured with clear Args and Returns sections. Front-loaded with the core action. Efficient and no wasted text, though the formal DPO terminology might be opaque to some agents.

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

Completeness4/5

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

Given the complexity (nested objects, no schema descriptions, output schema exists), the description provides adequate context: it names the operation, references the prerequisite pattern_match, describes parameters, and mentions return value. It could more explicitly state workflow order or error behavior, but is fairly complete.

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 description coverage is 0%, so description must compensate. It documents each parameter's meaning: diagram_id is the target, rule_spec is a serialized RewriteRule dict with lhs/rhs, match_mapping maps rule LHS nodes to diagram nodes. This is meaningful but doesn't fully specify the expected structure of rule_spec or match_mapping's format beyond a high-level description.

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

Purpose4/5

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

The description states a specific verb and resource: applying a formal DPO rewrite rule to a diagram. This is distinct from siblings like pattern_match (finding matches) or check_diagram_equivalence (comparison). However, it doesn't explicitly differentiate itself from those siblings or clarify its relationship to the pattern_match → apply workflow.

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

Usage Guidelines3/5

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

It implies usage via the match_mapping parameter ('from pattern_match'), suggesting it should be called after a pattern match. But there's no explicit when-to-use, prerequisites section, or when-not-to-use guidance. An agent would infer the workflow but not with certainty.

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