Skip to main content
Glama
blitzstermayank

Teradata MCP Server

plot_polar_chart

Generate a polar area plot to visualize data relationships in Teradata databases by specifying table, labels, and column parameters for circular data representation.

Instructions

Function to generate a polar area plot for labels and columns. Columns mentioned in labels are used as labels and column is used to plot.

PARAMETERS: table_name: Required Argument. Specifies the name of the table to generate the donut plot. Types: str

labels:
    Required Argument.
    Specifies the labels to be used for the line plot.
    Types: str

column:
    Required Argument.
    Specifies the column to be used for generating the line plot.
    Types: str

RETURNS: dict

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes
labelsYes
columnYes

Implementation Reference

  • Handler function that implements the core logic for the 'plot_polar_chart' tool. It validates inputs and delegates to get_plot_json_data with chart_type='polar' to generate JSON data for a polar area chart.
    def handle_plot_polar_chart(conn: TeradataConnection, table_name: str, labels: str, column: str):
        """
        Function to generate a polar area plot for labels and columns.
        Columns mentioned in labels are used as labels and column is used to plot.
    
        PARAMETERS:
            table_name:
                Required Argument.
                Specifies the name of the table to generate the donut plot.
                Types: str
    
            labels:
                Required Argument.
                Specifies the labels to be used for the line plot.
                Types: str
    
            column:
                Required Argument.
                Specifies the column to be used for generating the line plot.
                Types: str
    
        RETURNS:
            dict
        """
        # Labels must be always a string which represents a column.
        if not isinstance(labels, str):
            raise ValueError("labels must be a string representing the column name for x-axis.")
    
        return get_plot_json_data(conn, table_name, labels, column, 'polar')
  • Key helper utility that executes the SQL query, processes the data into Chart.js polar chart format (when chart_type='polar'), and structures the response. Called directly by the handler.
    def get_plot_json_data(conn, table_name, labels, columns, chart_type='line'):
        """
        Helper function to fetch data from a Teradata table and formats it for plotting.
        Right now, designed only to support line plots from chart.js .
        """
        # Define the colors first.
        colors = ['rgb(75, 192, 192)', '#99cbba', '#d7d0c4', '#fac778', '#e46c59', '#F9CB99', '#280A3E', '#F2EDD1', '#689B8A']
        # Chart properties. Every chart needs different property for colors.
        chart_properties = {'line': 'borderColor', 'polar': 'backgroundColor', 'pie': 'backgroundColor'}
    
        columns = [columns] if isinstance(columns, str) else columns
        sql = "select {labels}, {columns} from {table_name} order by {labels}".format(
              labels=labels, columns=','.join(columns), table_name=table_name)
    
        # Prepare the statement.
        with conn.cursor() as cur:
            recs = cur.execute(sql).fetchall()
    
        # Define the structure of the chart data. Below is the structure expected by chart.js
        # {
        #     labels: labels,
        #     datasets: [{
        #         label: 'My First Dataset',
        #         data: [65, 59, 80, 81, 56, 55, 40],
        #         fill: false,
        #         borderColor: 'rgb(75, 192, 192)',
        #         tension: 0.1
        #     }]
        # }
        labels = []
        datasets = [[] for _ in range(len(columns))]
        for rec in recs:
            labels.append(rec[0])
            for i_, val in enumerate(rec[1:]):
                datasets[i_].append(val)
    
        # Prepare the datasets for chart.js
        datasets_ = []
        for i, dataset in enumerate(datasets):
            datasets_.append({
                'label': columns[i],
                'data': dataset,
                'borderColor': colors[i],
                'fill': False
            })
    
        # For polar plot, every dataset needs different colors.
        if chart_type in ('polar', 'pie'):
            for i, dataset in enumerate(datasets_):
                # Remove borderColor and add backgroundColor
                dataset.pop('borderColor', None)
                dataset['backgroundColor'] = colors
    
        chart_data = {"labels": [str(l) for l in labels],
                      "datasets": datasets_}
        logger.debug("Chart data: %s", json.dumps(chart_data, indent=2))
    
        return create_response(data=chart_data, metadata={
                "tool_description": "chart js {} plot data".format(chart_type),
                "table_name": table_name,
                "labels": labels,
                "columns": columns
            })
  • The plot module's __init__.py imports all tools and helpers, making handle_plot_polar_chart available for dynamic loading and registration via the ModuleLoader which scans imported functions.
    from .plot_resources import *
    from .plot_tools import *
    from .plot_utils import *
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions that the tool 'generate[s] a polar area plot' and returns a dict, but lacks critical details: what the dict contains, whether this creates a file or displays a plot, error conditions, performance characteristics, or any side effects. The description is insufficient for a mutation/creation tool with zero annotation coverage.

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 reasonably concise with a purpose statement followed by parameter and return sections. However, the structure is somewhat awkward with inconsistent terminology ('donut plot' vs 'line plot' vs 'polar area plot'), and some sentences could be more efficiently worded. It's not wasteful but could be more polished.

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?

For a 3-parameter tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the returned dict contains, how the plot is generated or displayed, error handling, or important constraints. Given the complexity of a chart generation tool and the lack of structured documentation, the description leaves too many questions unanswered.

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%, so the description must compensate. While it lists three parameters with brief explanations, these are minimal and don't clarify semantics beyond what the schema titles provide. For example, it doesn't explain how 'labels' and 'column' interact, what format they should be in, or what 'table_name' refers to (database table? file?). The description adds some value but doesn't adequately compensate for the schema coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'generate[s] a polar area plot for labels and columns', which is a clear verb+resource combination. However, it doesn't distinguish this polar chart tool from its sibling visualization tools like plot_line_chart, plot_pie_chart, and plot_radar_chart, leaving ambiguity about when to choose this specific chart type.

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

Usage Guidelines2/5

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

No guidance is provided about when to use this tool versus alternatives. With multiple sibling plotting tools available, the description offers no context about appropriate use cases for polar charts versus line, pie, or radar charts, nor does it mention prerequisites or exclusions.

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/blitzstermayank/MCP'

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