View the source code for this module on GitHub: https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/agents/prompts/system_prompt_builder.py
build_system_prompt_content
function build_system_prompt_content
Builds the final system prompt string using a template, tool descriptions,
and optional additional instructions.from mcp_use.agents.prompts.system_prompt_builder import build_system_prompt_content
ReturnsstrrequiredThe system prompt template string (must contain '').list[str]requiredA list of formatted tool description strings.str | Nonedefault:"None"Optional extra instructions to append.
SignaturestrThe fully formatted system prompt content string.
def build_system_prompt_content(
template: str,
tool_description_lines: list[str],
additional_instructions: str | None = None
):
create_system_message
function create_system_message
Creates the final SystemMessage object for the agent.Handles selecting the correct template, generating tool descriptions,
and incorporating user overrides and additional instructions.from mcp_use.agents.prompts.system_prompt_builder import create_system_message
Returnslist[langchain_core.tools.base.BaseTool]requiredList of available tools.strrequiredThe default system prompt template.strrequiredThe template to use when server manager is active.boolrequiredFlag indicating if server manager mode is enabled.list[str] | Nonedefault:"None"List of tool names to exclude.str | Nonedefault:"None"A complete system prompt provided by the user, overriding templates.str | Nonedefault:"None"Extra instructions to append to the template-based prompt.
Signaturelangchain_core.messages.system.SystemMessageA SystemMessage object containing the final prompt content.
def create_system_message(
tools: list[langchain_core.tools.base.BaseTool],
system_prompt_template: str,
server_manager_template: str,
use_server_manager: bool,
disallowed_tools: list[str] | None = None,
user_provided_prompt: str | None = None,
additional_instructions: str | None = None
):
generate_tool_descriptions
function generate_tool_descriptions
Generates a list of formatted tool descriptions, excluding disallowed tools.from mcp_use.agents.prompts.system_prompt_builder import generate_tool_descriptions
Returnslist[langchain_core.tools.base.BaseTool]requiredThe list of available BaseTool objects.list[str] | Nonedefault:"None"A list of tool names to exclude.
Signaturelist[str]A list of strings, each describing a tool in the format ”- tool_name: description”.
def generate_tool_descriptions(
tools: list[langchain_core.tools.base.BaseTool],
disallowed_tools: list[str] | None = None
):