Skip to main content
Glama

unregister_agent

Remove an A2A agent from the bridge server by providing its URL to disconnect communication between AI assistants and agents.

Instructions

Unregister an A2A agent from the bridge server.

Args: url: URL of the A2A agent to unregister

Returns: Dictionary with unregistration status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'unregister_agent' MCP tool. Decorated with @mcp.tool(), it removes the specified agent URL from the registered_agents dictionary, cleans up associated tasks in task_agent_mapping, persists the changes to JSON files, logs the action, and returns a status dictionary.
    @mcp.tool()
    async def unregister_agent(url: str, ctx: Context = None) -> Dict[str, Any]:
        """
        Unregister an A2A agent from the bridge server.
        
        Args:
            url: URL of the A2A agent to unregister
            
        Returns:
            Dictionary with unregistration status
        """
        if url not in registered_agents:
            return {
                "status": "error",
                "message": f"Agent not registered: {url}",
            }
        
        try:
            # Get agent name before removing it
            agent_name = registered_agents[url].name
            
            # Remove from registered agents
            del registered_agents[url]
            
            # Clean up any task mappings related to this agent
            # Create a list of task_ids to remove to avoid modifying the dictionary during iteration
            tasks_to_remove = []
            for task_id, agent_url in task_agent_mapping.items():
                if agent_url == url:
                    tasks_to_remove.append(task_id)
            
            # Now remove the task mappings
            for task_id in tasks_to_remove:
                del task_agent_mapping[task_id]
            
            # Save changes to disk immediately
            agents_data = {url: agent.model_dump() for url, agent in registered_agents.items()}
            save_to_json(agents_data, REGISTERED_AGENTS_FILE)
            save_to_json(task_agent_mapping, TASK_AGENT_MAPPING_FILE)
            
            if ctx:
                await ctx.info(f"Successfully unregistered agent: {agent_name}")
            
            return {
                "status": "success",
                "message": f"Successfully unregistered agent: {agent_name}",
                "removed_tasks": len(tasks_to_remove),
            }
        except Exception as e:
            return {
                "status": "error",
                "message": f"Error unregistering agent: {str(e)}",
            }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the action ('unregister') but doesn't disclose behavioral traits such as whether this is destructive (likely yes, but not confirmed), permission requirements, error conditions, or side effects. The return value is mentioned but not elaborated, leaving gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence states the purpose clearly, followed by brief sections for Args and Returns. There's no wasted text, though the structure could be more integrated (e.g., combining purpose with parameter context).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation with no annotations), the description is moderately complete. It covers the purpose and parameter role, and an output schema exists, so return values don't need explanation. However, it lacks critical context like when to use, behavioral risks, or error handling, making it adequate but with clear gaps for safe invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description adds minimal semantics: it notes that 'url' is the 'URL of the A2A agent to unregister'. This clarifies the parameter's role beyond the schema's type definition. However, with only one parameter and no format details (e.g., expected URL structure), it partially compensates but doesn't fully address the coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Unregister an A2A agent from the bridge server.' It specifies the verb ('unregister') and resource ('A2A agent'), distinguishing it from siblings like 'register_agent' and 'list_agents'. However, it doesn't explicitly differentiate from 'cancel_task' or 'send_message' in terms of domain scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., agent must be registered first), exclusions, or compare it to siblings like 'cancel_task' or 'list_agents'. The agent must infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/GongRzhe/A2A-MCP-Server'

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