Skip to main content
Glama
dmarsters

Constellation Composition MCP Server

by dmarsters

compute_constellation_trajectory

Calculate smooth interpolation trajectories between two constellation states for AI image generation, using cosine ease-in-out transitions with full 5D coordinates at each step.

Instructions

Compute smooth interpolation trajectory between two canonical states.

Layer 2: Deterministic interpolation (0 tokens).

Uses cosine ease-in-out for perceptually smooth transitions. Each step includes full 5D coordinates suitable for attractor prompt generation or multi-domain composition input.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYesInput for computing trajectory between two constellation states.

Implementation Reference

  • The compute_constellation_trajectory tool is defined here as an MCP tool, using _interpolate_states to compute smooth interpolation between two canonical states.
    @mcp.tool(
        name="compute_constellation_trajectory",
        annotations={
            "title": "Compute Smooth Trajectory Between Two Constellation States",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": False
        }
    )
    async def compute_constellation_trajectory(params: TrajectoryInput) -> str:
        """
        Compute smooth interpolation trajectory between two canonical states.
    
        Layer 2: Deterministic interpolation (0 tokens).
    
        Uses cosine ease-in-out for perceptually smooth transitions. Each step
        includes full 5D coordinates suitable for attractor prompt generation
        or multi-domain composition input.
        """
        coords_a = _get_state_coordinates(params.state_a)
        coords_b = _get_state_coordinates(params.state_b)
        trajectory = _interpolate_states(coords_a, coords_b, params.steps)
    
        # Compute Euclidean distance between endpoints
        dist = math.sqrt(sum(
            (coords_a[p] - coords_b[p]) ** 2
            for p in CONSTELLATION_PARAMETER_NAMES
        ))
    
        return json.dumps({
            "state_a": params.state_a,
            "state_b": params.state_b,
            "steps": params.steps,
            "euclidean_distance": round(dist, 4),
            "parameter_names": CONSTELLATION_PARAMETER_NAMES,
            "trajectory": trajectory
        }, indent=2)
  • _interpolate_states helper function that performs the actual smooth cosine interpolation logic used by the tool.
    def _interpolate_states(
        state_a: Dict[str, float],
        state_b: Dict[str, float],
        steps: int
    ) -> List[Dict[str, float]]:
        """Smooth sinusoidal interpolation between two states (half-period: A → B)."""
        trajectory = []
        for i in range(steps):
            t = i / max(steps - 1, 1)
            # Smooth ease-in-out via cosine interpolation
            alpha = 0.5 * (1.0 - math.cos(t * math.pi))
            state = {
                p: (1.0 - alpha) * state_a[p] + alpha * state_b[p]
                for p in CONSTELLATION_PARAMETER_NAMES
            }
            trajectory.append(state)
        return trajectory

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/dmarsters/constellation-composition-mcp'

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