fix: re-add name and description editing on tool mode except for Composio, fix MCP server code (#7901)

* Changed backend to contain readonly props for tools

* Show name editing for not readonly tools

* Fixed edit-tools test

* Updated command to use "uvx" instead of "npx" for stability

* Fixed mcp code for authentication on auto_login=false

* removed args from component desc

* [autofix.ci] apply automated fixes

* making tool mode inputs the priority.

* fix: Clean up comments and whitespace in component_tool.py

* Fix column name

* update the dispaly name in composio

* fix format

* ✨ (get-started-progress.tsx): add data-testid attribute to improve testability and accessibility
🔧 (user-progress-track.spec.ts): update test assertions to use the new data-testid attribute for get started progress title

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
This commit is contained in:
Lucas Oliveira 2025-05-05 18:20:19 -03:00 • committed by GitHub
commit 75deddd102
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 128 additions and 60 deletions

View file

@ -186,7 +186,7 @@ class ComposioBaseComponent(Component):
build_config["action"]["options"] = [
{
"name": self.sanitize_action_name(action),
"metaData": action,
"metadata": action,
}
for action in self._actions_data
]
@ -282,10 +282,12 @@ class ComposioBaseComponent(Component):
configured_tools = []
for tool in tools:
# Set the sanitized name
display_name = self._sanitized_names.get(tool.name, self._name_sanitizer.sub("-", tool.name))
display_name = self._actions_data.get(tool.name, {}).get(
"display_name", self._sanitized_names.get(tool.name, self._name_sanitizer.sub("-", tool.name))
)
# Set the tags
tool.tags = [tool.name]
tool.metadata = {"display_name": display_name, "display_description": tool.description}
tool.metadata = {"display_name": display_name, "display_description": tool.description, "readonly": True}
configured_tools.append(tool)
return configured_tools

View file

@ -7,7 +7,6 @@ from typing import TYPE_CHECKING, Literal
import pandas as pd
from langchain_core.tools import BaseTool, ToolException
from langchain_core.tools.structured import StructuredTool
from loguru import logger
from pydantic import BaseModel
from langflow.base.tools.constants import TOOL_OUTPUT_NAME
@ -40,21 +39,8 @@ def _get_input_type(input_: InputTypes):
def build_description(component: Component, output: Output) -> str:
if not output.required_inputs:
logger.warning(f"Output {output.name} does not have required inputs defined")
name = component.name or component.__class__.__name__
if output.required_inputs:
args = ", ".join(
sorted(
[
f"{name}. {input_name}: {_get_input_type(component._inputs[input_name])}"
for input_name in output.required_inputs
]
)
)
else:
args = ""
return f"{name}. {output.method}({args}) - {component.description}"
return f"{name}. {output.method} - {component.description}"
async def send_message_noop(
@ -211,6 +197,8 @@ class ComponentToolkit:
inputs=flow_mode_inputs,
param_key="flow_tweak_data",
)
elif tool_mode_inputs:
args_schema = create_input_schema(tool_mode_inputs)
elif output.required_inputs:
inputs = [
self.component._inputs[input_name]
@ -220,6 +208,7 @@ class ComponentToolkit:
# If any of the required inputs are not in tool mode, this means
# that when the tool is called it will raise an error.
# so we should raise an error here.
# TODO: This logic might need to be improved, example if the required is an api key.
if not all(getattr(_input, "tool_mode", False) for _input in inputs):
non_tool_mode_inputs = [
input_.name
@ -234,8 +223,7 @@ class ComponentToolkit:
)
raise ValueError(msg)
args_schema = create_input_schema(inputs)
elif tool_mode_inputs:
args_schema = create_input_schema(tool_mode_inputs)
else:
args_schema = create_input_schema(self.component.inputs)

View file

@ -1166,6 +1166,7 @@ class Component(CustomComponent):
async def _build_tools_metadata_input(self):
tools = await self._get_tools()
# Always use the latest tool data
tool_data = [
{
"name": tool.name,
@ -1174,6 +1175,7 @@ class Component(CustomComponent):
"status": True, # Initialize all tools with status True
"display_name": tool.metadata.get("display_name", tool.name),
"display_description": tool.metadata.get("display_description", tool.description),
"readonly": tool.metadata.get("readonly", False),
"args": tool.args,
# "args_schema": tool.args_schema,
}