Skip to main content
Glama
sdiehl
by sdiehl

calculate_gradient

Compute the gradient of a scalar field to obtain its vector field representation, enabling advanced symbolic algebra operations with precise mathematical results.

Instructions

Calculates the gradient of a scalar field using SymPy's gradient function.

Args:
    scalar_field_key: The key of the scalar field expression.

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

    # Create a scalar field f = x^2 + y^2 + z^2
    scalar_field = introduce_expression("R_x**2 + R_y**2 + R_z**2")

    # Calculate gradient
    grad_result = calculate_gradient(scalar_field)
    # Returns (2x, 2y, 2z)

Returns:
    A key for the gradient vector field expression.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scalar_field_keyYes
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool uses SymPy's gradient function and returns a key for a gradient vector field expression, but doesn't mention error conditions, performance characteristics, or what happens with invalid inputs. The example helps but doesn't cover all behavioral aspects.

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 well-structured with clear sections (description, args, example, returns) and front-loaded with the core purpose. The example is detailed but necessary for understanding usage. Some minor redundancy exists between the description and example.

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 mathematical complexity, no annotations, no output schema, and 0% schema coverage, the description does a good job explaining the tool's purpose, parameter, and usage through example. It covers the essential context but could benefit from more explicit behavioral details like error handling.

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

Parameters4/5

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

With 0% schema description coverage and only 1 parameter, the description compensates well by explaining what 'scalar_field_key' represents (the key of the scalar field expression) and showing its usage in the example. It adds meaningful context beyond the bare schema, though it could specify format constraints for the key.

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's purpose with a specific verb ('calculates') and resource ('gradient of a scalar field'), and distinguishes it from siblings by specifying it uses SymPy's gradient function. It explicitly differentiates from tools like calculate_curl or calculate_divergence by focusing on gradient calculation.

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 provides clear context through an example showing prerequisite steps (creating coordinate system and scalar field) and when to use this tool. However, it doesn't explicitly state when NOT to use it or mention specific alternatives like calculate_curl or calculate_divergence for different operations.

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

Related 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/sdiehl/sympy-mcp'

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