Skip to main content
Glama
Symbolic Algebra MCP Server

Symbolic Algebra MCP Server

calculate_divergence

Computes the divergence of a vector field from a given key, returning a key for the resulting scalar expression.

Instructions

Calculates the divergence of a vector field using SymPy's divergence function.

Args:
    vector_field_key: The key of the vector field expression.

Example:
    # First create a coordinate system
    create_coordinate_system("R")

    # Create a vector field F = (x, y, z)
    vector_field = create_vector_field("R", "R_x", "R_y", "R_z")

    # Calculate divergence
    div_result = calculate_divergence(vector_field)
    # Returns 3

Returns:
    A key for the divergence expression.

Input Schema

NameRequiredDescriptionDefault
vector_field_keyYes

Output Schema

NameRequiredDescriptionDefault
resultYes

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 the full behavioral burden. It does disclose that the result is a key for the divergence expression, and the example suggests the output may be a simplified scalar (e.g., 3), but it does not describe error conditions, required context beyond the example, or any side effects.

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?

The description is front-loaded with the purpose, then uses structured Args, Example, and Returns sections. It is appropriately sized for a simple one-parameter tool, though the example is longer than strictly necessary.

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?

For a simple one-parameter calculation tool with an output schema, the description provides enough context to call it correctly: the purpose, parameter meaning, an end-to-end example, and the return type. Minor gaps remain around explicit usage criteria and error handling.

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 the description must compensate. It defines vector_field_key as the key of the vector field expression, and the example shows how such a key is produced via create_vector_field, but it does not specify the expected key format or validate what happens if the key is invalid.

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: it calculates the divergence of a vector field, and names SymPy as the underlying implementation. It is clear what the tool does, though it does not explicitly contrast itself with sibling operations like calculate_curl or calculate_gradient.

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?

The example demonstrates the expected workflow: create a coordinate system, create a vector field, then calculate divergence. However, there is no explicit statement about when to use this tool versus alternatives such as calculate_curl, nor are prerequisites or exclusions spelled out beyond the example.

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