{"record":{"id":"6d14b428ad2f1335","repo":"langchain-ai/deepagents","slug":"context-tool-names-conflict-with-rubric-grader-too","errorCode":null,"errorMessage":"Context tool names conflict with rubric-grader tools: {names}.","messagePattern":"Context tool names conflict with rubric-grader tools: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/agent.py","lineNumber":661,"sourceCode":"                runtime=runtime,\n                offset=offset,\n                limit=clamped[\"limit\"],\n            ),\n        )\n\n    normalized_context_tools = _normalize_rubric_grader_context_tools(context_tools)\n\n    def _with_context_tools(grader_tools: list[BaseTool]) -> list[BaseTool]:\n        reserved_names = {\"GraderResponse\", *(tool.name for tool in grader_tools)}\n        conflicts: list[str] = []\n        for context_tool in normalized_context_tools:\n            if context_tool.name in reserved_names:\n                conflicts.append(context_tool.name)\n            reserved_names.add(context_tool.name)\n        if conflicts:\n            names = \", \".join(sorted(set(conflicts)))\n            msg = f\"Context tool names conflict with rubric-grader tools: {names}.\"\n            raise ValueError(msg)\n        return [*grader_tools, *normalized_context_tools]\n\n    grader_tools: list[BaseTool] = [read_file]\n    if bounds is None:\n        return _with_context_tools(grader_tools)\n\n    # `bounds` is available: expose whichever working-directory search tools the\n    # parent allowlist permits. `read_file`'s working-directory branch is gated\n    # separately (above) on the allowlist including `read_file`, so `ls`,\n    # `glob`, and `grep` remain available even when `read_file` is excluded.\n    active_bounds = bounds\n\n    repository_wrapper_tools: list[BaseTool] = []\n\n    if \"ls\" in repository_tools:\n        fs_ls = cast(\"StructuredTool\", repository_tools[\"ls\"])\n        fs_ls_func = _fs_func(repository_tools, \"ls\")\n","sourceCodeStart":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/agent.py#L643-L679","documentation":"`_with_context_tools` merges caller-supplied context tools into the rubric grader's tool list, but tool names must be unique in an agent's tool registry. It reserves `GraderResponse` plus the grader's own tool names (e.g. the prefixed `read_file`) and raises ValueError if any context tool shares one of those names (or duplicates another context tool).","triggerScenarios":"Calling `create_cli_agent` (or the rubric-grader builder) with context tools whose `.name` equals `GraderResponse`, the grader's read_file tool name (e.g. under a `read_file_prefix`), or duplicates another context tool — e.g. passing a custom tool named `read_file` or `GraderResponse` in `context_tools`.","commonSituations":"Wrapping an SDK filesystem tool and passing it back as a context tool; defining a pydantic tool whose schema name collides with `GraderResponse`; copying tool lists between agents without renaming.","solutions":["Rename the conflicting context tool so its `.name` differs from `GraderResponse` and all grader tool names.","Remove the context tool that duplicates a grader tool — the grader already exposes its own read_file.","If a tool's name is auto-derived from its schema, rename the schema/model instead of the tool instance."],"exampleFix":"// before\nclass GraderResponse(BaseModel):\n    ...\ncontext_tools = [my_read_file_tool]  # name collides\n// after\nclass RubricContextResponse(BaseModel):\n    ...\ncontext_tools = [build_tool(RubricContextResponse, name=\"rubric_context\")]","handlingStrategy":"validation","validationCode":"RESERVED = {\"GraderResponse\", \"read_file\"}\nnames = [t.name for t in context_tools]\ndupes = RESERVED & set(names)\nassert not dupes, f\"Rename context tools colliding with grader tools: {sorted(dupes)}\"\nassert len(names) == len(set(names)), \"Context tools contain duplicate names\"","typeGuard":null,"tryCatchPattern":"try:\n    agent = create_cli_agent(..., context_tools=context_tools)\nexcept ValueError as e:\n    if \"Context tool names conflict\" in str(e):\n        print(f\"Rename these tools: {e}\")\n    raise","preventionTips":["Namespace context tool names with a project prefix (e.g. rubric_context_*).","Never reuse SDK tool names (read_file, write_file, task) for custom tools.","Avoid naming tool schemas GraderResponse; that name is reserved by the grader."],"tags":["python","naming-conflict","tool-registry","validation"],"backgroundTag":"duplicate-tool-name","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}