Skip to main content
Glama

think_about_task_adherence

Assess alignment with the original task during extended conversations to ensure focus and clarity. Use this tool to evaluate progress before modifying code to maintain adherence to the intended goal.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler implementation for the 'think_about_task_adherence' tool. The 'apply' method generates and returns a prompt via the prompt factory to guide the agent in evaluating task adherence.
    class ThinkAboutTaskAdherenceTool(Tool): """ Thinking tool for determining whether the agent is still on track with the current task. """ def apply(self) -> str: """ 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. """ return self.prompt_factory.create_think_about_task_adherence()
  • ToolRegistry automatically discovers and registers all subclasses of Tool in serena.tools modules, deriving the tool name (e.g., 'think_about_task_adherence' from 'ThinkAboutTaskAdherenceTool') and storing them for instantiation by the agent.
    class ToolRegistry: def __init__(self) -> None: self._tool_dict: dict[str, RegisteredTool] = {} for cls in iter_subclasses(Tool): if not cls.__module__.startswith("serena.tools"): continue is_optional = issubclass(cls, ToolMarkerOptional) name = cls.get_name_from_cls() if name in self._tool_dict: raise ValueError(f"Duplicate tool name found: {name}. Tool classes must have unique names.") self._tool_dict[name] = RegisteredTool(tool_class=cls, is_optional=is_optional, tool_name=name)
  • Helper method in the generated prompt factory that renders the specific prompt template used by the tool's handler.
    def create_think_about_task_adherence(self) -> str: return self._render_prompt("think_about_task_adherence", locals())
  • Class method that derives the MCP tool name 'think_about_task_adherence' from the class name 'ThinkAboutTaskAdherenceTool', used during registration.
    def get_name_from_cls(cls) -> str: name = cls.__name__ if name.endswith("Tool"): name = name[:-4] # convert to snake_case name = "".join(["_" + c.lower() if c.isupper() else c for c in name]).lstrip("_") return name

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/oraios/serena'

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