Skip to main content
Glama

apply_mapping

Map column values using a dictionary to translate codes, merge categories, or create ordinal mappings. Unmapped values remain unchanged, with automatic type conversion.

Instructions

Map values in a column using a dictionary. Unmapped values stay as-is. Values are auto-converted to match the column's type. Map categorical values to new values. Useful for translating codes, merging similar categories, or creating ordinal mappings. Example: apply_mapping(column="FlownMonth", mapping={"SEPTEMBER":"9","OCTOBER":"10"})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnYes
df_nameNo
mappingYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
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 two important behaviors: 'Unmapped values stay as-is' and 'Values are auto-converted to match the column's type.' However, it does not state whether the operation mutates the dataframe in place or returns a new one, which is a notable gap for a transformation tool.

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 concise and well-structured: it leads with the core action, then key behaviors, then use cases, then a concrete example. Every sentence adds value and the length is appropriate for the tool's complexity.

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?

The description covers the purpose, key behaviors, use cases, and includes a clear example. With an output schema present, return values need not be explained. Minor gaps remain around df_name semantics and in-place vs. return behavior, but overall the description is quite complete.

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 does explain 'column' and 'mapping' through prose and an example, and clarifies that values are auto-converted. However, the 'df_name' parameter is not mentioned at all, and the description only partially covers the parameter semantics.

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 maps values in a column using a dictionary, which is a specific verb+resource combination. It also distinguishes itself from sibling encoding tools by explicitly mentioning use cases like translating codes, merging categories, and creating ordinal mappings.

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 the tool ('Useful for translating codes, merging similar categories, or creating ordinal mappings'). It does not explicitly mention alternatives or exclusions, but the use cases are specific enough to guide 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/AstyanM/mcp-data-science'

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