Skip to main content
Glama

refactor

Replace duplicate patterns in PySpark code with utility functions, extract common utilities, and generate optimized data pipelines.

Instructions

Refactor PySpark code and generate pipeline structures.

Modes:

patterns Refactor code by replacing duplicate patterns with utility function calls. Parameters: original_code (required), code_samples (required)

utilities Extract common utility functions from code patterns. Parameters: code_samples (required), patterns

pipeline Generate optimized PySpark data pipeline code or project structure. Parameters (pipeline): data_sources (required list), processing_requirements (required), target_format, include_monitoring Parameters (project): sql_content, workspace_name, workspace_path, output_dir, include_glue_template, dialect, include_batch_processing, include_visualization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYes
dialectNo
patternsNo
output_dirNo
sql_contentNo
code_samplesNo
data_sourcesNo
original_codeNo
target_formatNodelta
workspace_nameNo
workspace_pathNo
include_monitoringNo
include_glue_templateNo
include_visualizationNo
processing_requirementsNo
include_batch_processingNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior2/5

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

No annotations are provided, so the description must fully disclose behavior. It describes what each mode does but fails to mention side effects, auth requirements, read-only status, or return value details. The tool's behavioral traits beyond function are vague.

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

Conciseness3/5

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

The description is structured with mode headings and bullet-like parameter lists, making it scannable. However, it is somewhat verbose and could be more concise by shortening parameter lists or merging redundant phrases.

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

Completeness2/5

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

Given the complexity (16 params, multiple modes) and lack of annotations, the description should be comprehensive. It covers mode purposes and parameter names but lacks parameter details, behavioral context, and output explanation. An output schema exists but is not leveraged in the description.

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

Parameters2/5

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

Schema description coverage is 0%, requiring the description to compensate. It lists parameters per mode but does not explain their meaning (e.g., dialect, sql_content). For 16 parameters, this is insufficient; only names and required status are given.

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 refactors PySpark code and generates pipeline structures, with three distinct modes (patterns, utilities, pipeline) each explained. This specific verb+resource and mode differentiation distinguish it from sibling tools like analyze or convert.

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 for when to use each mode, e.g., 'Refactor code by replacing duplicate patterns' for patterns mode. However, it does not explicitly state when not to use the tool or suggest alternatives, lacking exclusion guidance.

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

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