Skip to main content
Glama

get_column_data

Extract specific column data from datasets with optional row range filtering for focused analysis and targeted data retrieval.

Instructions

Get data from specific column with optional row range slicing.

Supports row range filtering for focused analysis. Returns column values with range metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnYesColumn name to retrieve data from
start_rowNoStarting row index (inclusive, 0-based) for data slice
end_rowNoEnding row index (exclusive, 0-based) for data slice

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnYesColumn name
valuesYesColumn values in specified range
end_rowNoEnding row index used (None if to end)
successNoWhether operation completed successfully
start_rowNoStarting row index used (None if from beginning)
total_valuesYesNumber of values returned

Implementation Reference

  • The handler function implementing the get_column_data tool. Retrieves column data with optional row slicing, validates inputs, handles pandas DataFrame slicing and type conversions.
    def get_column_data(
        ctx: Annotated[Context, Field(description="FastMCP context for session access")],
        column: Annotated[str, Field(description="Column name to retrieve data from")],
        start_row: Annotated[
            int | None,
            Field(description="Starting row index (inclusive, 0-based) for data slice"),
        ] = None,
        end_row: Annotated[
            int | None,
            Field(description="Ending row index (exclusive, 0-based) for data slice"),
        ] = None,
    ) -> ColumnDataResult:
        """Get data from specific column with optional row range slicing.
    
        Supports row range filtering for focused analysis. Returns column values with range metadata.
        """
        session_id = ctx.session_id
        _session, df = get_session_data(session_id)
    
        # Validate column exists
        if column not in df.columns:
            raise ColumnNotFoundError(column, list(df.columns))
    
        # Validate and set row range
        if start_row is not None and start_row < 0:
            msg = "start_row"
            raise InvalidParameterError(msg, start_row, "must be non-negative")
        if end_row is not None and end_row < 0:
            msg = "end_row"
            raise InvalidParameterError(msg, end_row, "must be non-negative")
        if start_row is not None and start_row >= len(df):
            msg = f"start_row {start_row} out of range (0-{len(df) - 1})"
            raise ToolError(msg)
        if end_row is not None and end_row > len(df):
            msg = f"end_row {end_row} out of range (0-{len(df)})"
            raise ToolError(msg)
        if start_row is not None and end_row is not None and start_row >= end_row:
            msg = "start_row"
            raise InvalidParameterError(msg, start_row, "must be less than end_row")
    
        # Apply row range slicing
        if start_row is None and end_row is None:
            column_data = df[column]
            start_row = 0
            end_row = len(df) - 1
        elif start_row is None:
            column_data = df[column][:end_row]
            start_row = 0
        elif end_row is None:
            column_data = df[column][start_row:]
            end_row = len(df) - 1
        else:
            column_data = df[column][start_row:end_row]
    
        # Convert to list and handle pandas/numpy types
        values = convert_pandas_na_list(column_data.tolist())
    
        # No longer recording operations (simplified MCP architecture)
    
        return ColumnDataResult(
            column=column,
            values=values,
            total_values=len(values),
            start_row=start_row,
            end_row=end_row,
        )
  • Pydantic input schema model for the get_column_data tool parameters.
    class ColumnDataRequest(BaseModel):
        """Request parameters for column data retrieval."""
    
        model_config = ConfigDict(extra="forbid")
    
        column: str = Field(description="Column name")
        start_row: int | None = Field(None, ge=0, description="Starting row index (inclusive)")
        end_row: int | None = Field(None, ge=0, description="Ending row index (exclusive)")
    
        @field_validator("start_row", "end_row")
        @classmethod
        def validate_row_indices(cls, v: int | None) -> int | None:
            """Validate row indices are non-negative."""
            if v is not None and v < 0:
                msg = "Row indices must be non-negative"
                raise ValueError(msg)
            return v
  • Registration of the get_column_data handler as a tool on the FastMCP row_operations_server.
    row_operations_server.tool(name="get_column_data")(get_column_data)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'Returns column values with range metadata' which adds some behavioral context about output format. However, it doesn't disclose critical traits like whether this is a read-only operation, potential performance implications, error conditions, or data size limitations. For a data retrieval tool with zero annotation coverage, this is insufficient.

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 appropriately concise with two sentences. The first sentence clearly states the core functionality, and the second adds context about filtering and returns. There's no wasted text, though it could be slightly more front-loaded with key differentiators.

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 that there's an output schema (which handles return value documentation), 100% schema description coverage, and the tool's moderate complexity, the description is reasonably complete. It covers the basic operation and output format. However, for a data retrieval tool with many similar siblings, more guidance on usage context would improve completeness.

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 100%, so the schema already documents all three parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'optional row range slicing' and 'focused analysis,' but doesn't provide additional semantics about parameter interactions, default behaviors, or practical examples. This meets the baseline for high schema coverage.

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 clearly states the tool's purpose: 'Get data from specific column with optional row range slicing.' It specifies the verb ('Get'), resource ('data from specific column'), and optional capability ('row range slicing'). However, it doesn't explicitly differentiate from sibling tools like 'get_cell_value' or 'get_row_data', which reduces the score from a perfect 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'focused analysis' but doesn't specify scenarios or compare with siblings like 'get_cell_value' (single cell), 'get_row_data' (row-based), or 'extract_from_column' (similar sounding). Without explicit when/when-not instructions, the agent lacks context for tool selection.

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/jonpspri/databeak'

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