Skip to main content
Glama

add_field

Add a class field or attribute at the top of a class body following fields-before-methods convention. Use to insert class attributes in Python, fields in JavaScript/TypeScript, or member variables in C++.

Instructions

Add a field/attribute/member at the top of a class body (fields-before-methods convention).

Use this when: You're adding a class attribute (Python), class field (JS/TS), or member variable (C++). Don't use this when: You're adding a method -> use add_method.

Example: class_target="LRUCache" content=' version = "1.0"'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
class_targetYes
contentYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
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 describes the action (adding a field) and placement (top of class body, fields-before-methods convention), but lacks details on permissions, error handling, or what happens if the class doesn't exist. It adds some behavioral context but not comprehensively.

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?

Front-loaded with the core purpose, followed by usage guidelines and a concrete example. Every sentence serves a distinct purpose with zero waste, making it easy to scan and understand 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 the presence of an output schema (which handles return values), the description focuses on purpose and usage effectively. It covers key aspects like sibling differentiation and parameter illustration, but as a mutation tool with no annotations, it could benefit from more behavioral transparency (e.g., error cases).

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

Parameters4/5

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

With 0% schema description coverage, the description must compensate. The example illustrates usage of 'class_target' and 'content' parameters, clarifying their roles. However, 'file_path' is not explained in the description, leaving one parameter undocumented. The example adds significant value but doesn't fully cover all parameters.

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 specific action ('Add a field/attribute/member') and the location ('at the top of a class body'), distinguishing it from sibling tools like 'add_method' by specifying it's for fields, not methods. The example reinforces this distinction.

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

Usage Guidelines5/5

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

Explicitly provides when to use ('when: You're adding a class attribute...') and when not to use ('Don't use this when: You're adding a method -> use `add_method`'), naming the alternative tool. This directly addresses sibling tool differentiation.

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/kambleakash0/agent-skills'

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