Skip to main content
Glama

get_row_data

Retrieve specific row data from CSV files with optional column filtering. Converts pandas types for JSON serialization in DataBeak's MCP server.

Instructions

Get data from specific row with optional column filtering.

Returns complete row data or filtered by column list. Converts pandas types for JSON serialization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
row_indexYesRow index (0-based) to retrieve data from
columnsNoOptional list of column names to retrieve (all columns if None)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesRow data as column name to value mapping
columnsYesList of column names included in data
successNoWhether operation completed successfully
row_indexYesRow index (0-based)

Implementation Reference

  • The core handler function for the 'get_row_data' tool. Retrieves data from a specific row in the session's DataFrame, supports optional column filtering, validates row index and columns, converts pandas/numpy types to JSON-serializable Python types (handling NaN as None), and returns a structured RowDataResult.
    def get_row_data(
        ctx: Annotated[Context, Field(description="FastMCP context for session access")],
        row_index: Annotated[int, Field(description="Row index (0-based) to retrieve data from")],
        columns: Annotated[
            list[str] | None,
            Field(description="Optional list of column names to retrieve (all columns if None)"),
        ] = None,
    ) -> RowDataResult:
        """Get data from specific row with optional column filtering.
    
        Returns complete row data or filtered by column list. Converts pandas types for JSON
        serialization.
        """
        session_id = ctx.session_id
        _session, df = get_session_data(session_id)
    
        # Validate row index
        if row_index < 0 or row_index >= len(df):
            msg = f"Row index {row_index} out of range (0-{len(df) - 1})"
            raise ToolError(msg)
    
        # Handle column filtering
        if columns is None:
            selected_columns = list(df.columns)
            row_data = df.iloc[row_index].to_dict()
        else:
            # Validate all columns exist
            missing_columns = [col for col in columns if col not in df.columns]
            if missing_columns:
                raise ColumnNotFoundError(missing_columns[0], list(df.columns))
    
            selected_columns = columns
            row_data = df.iloc[row_index][columns].to_dict()
    
        # Handle pandas/numpy types for JSON serialization
        for key, value in row_data.items():
            if pd.isna(value):
                row_data[key] = None
            elif hasattr(value, "item"):  # numpy scalar
                row_data[key] = value.item()
    
        # No longer recording operations (simplified MCP architecture)
    
        return RowDataResult(
            row_index=row_index,
            data=row_data,
            columns=selected_columns,
        )
  • Registers the get_row_data handler function as an MCP tool named 'get_row_data' on the row_operations_server FastMCP instance.
    row_operations_server.tool(name="get_row_data")(get_row_data)
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It adds some behavioral context: 'Returns complete row data or filtered by column list' clarifies the output behavior, and 'Converts pandas types for JSON serialization' discloses a data transformation trait. However, it doesn't cover error handling, performance implications, or other operational details that would be helpful for an agent.

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 description is extremely concise and well-structured: two sentences that efficiently convey the core functionality and a key behavioral trait. Every sentence earns its place with no wasted words, making it easy for an agent to parse quickly.

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 is an output schema (though not shown here), the description doesn't need to explain return values. It covers the essential purpose and a key behavioral trait (pandas type conversion). For a read operation with good schema coverage and output schema, this is reasonably complete, though it could benefit from more usage context.

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 fully documents both parameters (row_index and columns). The description adds minimal value beyond the schema: it mentions 'optional column filtering' which aligns with the schema's description of columns as 'Optional list of column names to retrieve (all columns if None).' 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 row with optional column filtering.' It specifies the verb ('Get'), resource ('data from specific row'), and scope ('optional column filtering'). However, it doesn't explicitly differentiate from sibling tools like 'get_cell_value' or 'get_column_data', which reduces it from a perfect score.

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 doesn't mention sibling tools like 'get_cell_value' (for single cells), 'get_column_data' (for columns), or 'filter_rows' (for multiple rows), leaving the agent to infer usage context from the name alone.

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