Server Configuration
Describes the environment variables required to run the server.
Name | Required | Description | Default |
---|---|---|---|
No arguments |
Schema
Prompts
Interactive templates invoked by user choice
Name | Description |
---|---|
No prompts |
Resources
Contextual data attached and managed by the client
Name | Description |
---|---|
No resources |
Tools
Functions exposed to the LLM to take actions
Name | Description |
---|---|
restart_language_server | Use this tool only on explicit user request or after confirmation. It may be necessary to restart the language server if the user performs edits not through Serena, so the language server state becomes outdated and further editing attempts lead to errors. If such editing errors happen, you should suggest using this tool. |
read_file | Reads the given file or a chunk of it. Generally, symbolic operations like find_symbol or find_referencing_symbols should be preferred if you know which symbols you are looking for. Reading the entire file is only recommended if there is no other way to get the content required for the task. Returns the full text of the file at the given relative path. |
create_text_file | Write a new file (or overwrite an existing file). For existing files, it is strongly recommended to use symbolic operations like replace_symbol_body or insert_after_symbol/insert_before_symbol, if possible. You can also use insert_at_line to insert content at a specific line for existing files if the symbolic operations are not the right choice for what you want to do. If ever used on an existing file, the content has to be the complete content of that file (so it may never end with something like "The remaining content of the file is left unchanged."). For operations that just replace a part of a file, use the replace_lines or the symbolic editing tools instead. Returns a message indicating success or failure. |
list_dir | Lists files and directories in the given directory (optionally with recursion). Returns a JSON object with the names of directories and files within the given directory. |
find_file | Finds files matching the given file mask within the given relative path. Returns a JSON object with the list of matching files. |
get_symbols_overview | Gets an overview of the given file or directory. For each analyzed file, we list the top-level symbols in the file (name_path, kind). Use this tool to get a high-level understanding of the code symbols. Calling this is often a good idea before more targeted reading, searching or editing operations on the code symbols. Returns a JSON object mapping relative paths of all contained files to info about top-level symbols in the file (name_path, kind). |
find_symbol | Retrieves information on all symbols/code entities (classes, methods, etc.) based on the given The matching behavior is determined by the structure of Key aspects of the name path matching behavior:
|
find_referencing_symbols | Finds symbols that reference the symbol at the given |
replace_symbol_body | Replaces the body of the symbol with the given Important: You don't need to provide an adjusted indentation, as the tool will automatically add the indentation of the original symbol to each line. For example, for replacing a method in python, you can just write (using the standard python indentation): body="def my_method_replacement(self, ...):\n first_line\n second_line...". So each line after the first line only has an indentation of 4 (the indentation relative to the first characted), since the additional indentation will be added by the tool. Same for more deeply nested cases. You always only need to write the relative indentation to the first character of the first line, and that in turn should not have any indentation. ALWAYS REMEMBER TO USE THE CORRECT INDENTATION IN THE BODY!. |
insert_after_symbol | Inserts the given body/content after the end of the definition of the given symbol (via the symbol's location). A typical use case is to insert a new class, function, method, field or variable assignment. |
insert_before_symbol | Inserts the given body/content before the beginning of the definition of the given symbol (via the symbol's location). A typical use case is to insert a new class, function, method, field or variable assignment. It also can be used to insert a new import statement before the first symbol in the file. |
replace_regex | Replaces one or more occurrences of the given regular expression. This is the preferred way to replace content in a file whenever the symbol-level tools are not appropriate. Even large sections of code can be replaced by providing a concise regular expression of the form "beginning.*?end-of-text-to-be-replaced". Always try to use wildcards to avoid specifying the exact content of the code to be replaced, especially if it spans several lines. IMPORTANT: REMEMBER TO USE WILDCARDS WEHEN APPROPRIATE! I WILL BE VERY UNHAPPY IF YOU WRITE LONG REGEXES WITHOUT USING WILDCARDS INSTEAD!. |
delete_lines | Deletes the given lines in the file.
Requires that the same range of lines was previously read using the |
replace_lines | Replaces the given range of lines in the given file.
Requires that the same range of lines was previously read using the |
insert_at_line | Inserts the given content at the given line in the file, pushing existing content of the line down. In general, symbolic insert operations like insert_after_symbol or insert_before_symbol should be preferred if you know which symbol you are looking for. However, this can also be useful for small targeted edits of the body of a longer symbol (without replacing the entire body). |
check_onboarding_performed | Checks whether project onboarding was already performed. You should always call this tool before beginning to actually work on the project/after activating a project, but after calling the initial instructions tool. |
onboarding | Call this tool if onboarding was not performed yet. You will call this tool at most once per conversation. Returns instructions on how to create the onboarding information. |
write_memory | Write some information about this project that can be useful for future tasks to a memory. Use markdown formatting for the content. The information should be short and to the point. The memory name should be meaningful, such that from the name you can infer what the information is about. It is better to have multiple small memories than to have a single large one because memories will be read one by one and we only ever want to read relevant memories. This tool is either called during the onboarding process or when you have identified something worth remembering about the project from the past conversation. |
read_memory | Read the content of a memory file. This tool should only be used if the information is relevant to the current task. You can infer whether the information is relevant from the memory file name. You should not read the same memory file multiple times in the same conversation. |
list_memories | List available memories. Any memory can be read using the |
delete_memory | Delete a memory file. Should only happen if a user asks for it explicitly, for example by saying that the information retrieved from a memory file is no longer correct or no longer relevant for the project. |
think_about_collected_information | Think about the collected information and whether it is sufficient and relevant. This tool should ALWAYS be called after you have completed a non-trivial sequence of searching steps like find_symbol, find_referencing_symbols, search_files_for_pattern, read_file, etc. |
think_about_task_adherence | Think about the task at hand and whether you are still on track. Especially important if the conversation has been going on for a while and there has been a lot of back and forth. This tool should ALWAYS be called before you insert, replace, or delete code. |
think_about_whether_you_are_done | Whenever you feel that you are done with what the user has asked for, it is important to call this tool. |
summarize_changes | Summarize the changes you have made to the codebase. This tool should always be called after you have fully completed any non-trivial coding task, but only after the think_about_whether_you_are_done call. |
prepare_for_new_conversation | Instructions for preparing for a new conversation. This tool should only be called on explicit user request. |
search_for_pattern | Search for a pattern in the project. You can select whether all files or only code files should be searched. Generally, symbolic operations like find_symbol or find_referencing_symbols should be preferred if you know which symbols you are looking for. Returns A JSON object mapping file paths to lists of matched consecutive lines (with context, if requested). |
execute_shell_command | Execute a shell command and return its output. IMPORTANT: you should always consider the memory about suggested shell commands before using this tool.
If this memory was not loaded in the current conversation, you should load it using the You should have at least once looked at the suggested shell commands from the corresponding memory
created during the onboarding process before using this tool.
Never execute unsafe shell commands like |
activate_project | Activates the project with the given name. |
remove_project | Removes a project from the Serena configuration. |
switch_modes | Activates the desired modes, like ["editing", "interactive"] or ["planning", "one-shot"]. |
get_current_config | Print the current configuration of the agent, including the active and available projects, tools, contexts, and modes. |
initial_instructions | Get the initial instructions for the current coding project.
You should always call this tool before starting to work (including using any other tool) on any programming task!
The only exception is when a user asks you to activate a project, in which case you should call the |