Skip to main content
Glama

prepend_to_body

Insert content at the top of a function body while preserving existing statements. Use for adding logging, input validation, or early-return guards to the beginning of functions.

Instructions

Insert content at the top of a function body, preserving existing statements.

Use this when: You're adding one or two lines at the START of a function (logging, input validation, early-return guards, debug prints). Don't use this when: You're replacing the whole body -> use replace_function_body. You're adding to the bottom -> use append_to_body.

Example: target="LRUCache.get" content=" print(f'get called with {key}')"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
targetYes
contentYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/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 discloses key behavioral traits: it preserves existing statements (non-destructive), operates on function bodies, and handles specific use cases. However, it doesn't mention error handling, permissions, or rate limits, which could be relevant for a mutation 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?

Front-loaded with the core purpose, followed by usage guidelines and a concrete example. Every sentence earns its place with no wasted words, and the structure is logical and easy to parse.

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 a mutation tool with no annotations, 3 parameters, 0% schema coverage, but an output schema exists, the description is mostly complete. It covers purpose, usage, and provides an example, but could better explain parameters or error cases. The output schema reduces the need to describe return values.

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 provides an example that clarifies 'target' (function name like 'LRUCache.get') and 'content' (code string to insert), adding meaning beyond the bare schema. However, it doesn't explain 'file_path' or provide full parameter details, leaving some gaps.

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 ('Insert content at the top of a function body') and resource ('function body'), and distinguishes it from sibling tools like 'append_to_body' and 'replace_function_body'. The verb 'prepend' is precise and matches the tool name.

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 'Use this when' scenarios (adding lines at the start for logging, validation, guards, debug prints) and 'Don't use this when' alternatives (replacing whole body or adding to bottom), naming specific sibling tools ('replace_function_body', 'append_to_body') for comparison.

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