Skip to main content
Glama

optimize

Analyze PySpark code to recommend performance improvements, including join strategies and partitioning. Supports targeted modes and comprehensive analysis with performance estimates.

Instructions

Deprecated. Prefer review. Still registered this minor version.

Optimize PySpark code and recommend performance improvements.

Modes:

code Return pattern-based suggestions for PySpark code. Does not rewrite the input. Parameters: code (required), optimization_level

joins Recommend join strategies based on estimated table sizes. Parameters: pyspark_code (required), table_info

partitioning Suggest optimal partitioning strategies. Parameters: pyspark_code (required), table_info

comprehensive Generate comprehensive optimization recommendations + performance estimates. Parameters: pyspark_code (required), table_info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNo
modeYes
table_infoNo
pyspark_codeNo
optimization_levelNostandard

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.0.4

TDQS

A3.9/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 burden. It discloses that the code mode 'does not rewrite the input' and that outputs are recommendations/estimates, which is useful. However, it does not state whether the other modes have side effects, what happens with invalid inputs, or any environment prerequisites such as a running Spark session.

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 deprecation warning is front-loaded, followed by a one-sentence purpose and compact mode bullets. The repeated parameter lists are a minor redundancy but every section earns its place and the format is easy for an agent to scan.

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

Completeness3/5

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

The output schema covers return values, so the description does not need to describe them. It covers deprecation, modes, and mode-specific parameters, but misses allowed values for optimization_level and the structure of table_info; for a 5-parameter tool with no annotations, this is an incomplete picture.

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 adds a useful mode-to-parameter mapping and distinguishes code from pyspark_code by mode. It does not define allowed values for optimization_level or the expected shape of table_info, leaving important invocation details unresolved.

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 opens with a deprecation notice and then states 'Optimize PySpark code and recommend performance improvements,' a specific verb and resource. The mode list further clarifies what each invocation produces. It identifies review as preferred but does not explain how review differs functionally, so it stops short of perfect sibling differentiation.

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

Usage Guidelines5/5

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

It explicitly says 'Deprecated. Prefer review,' which is a direct when-not-to-use directive with a named alternative. Each mode section also states the exact parameters required for that mode, giving clear invocation guidance.

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

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/AnnasMazhar/pyspark_mcp'

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