Skip to content

[Bug]: Parameter Mismatch in MCP.update() Method #2161

@fsto

Description

@fsto

SDK Language

Python SDK (composio package)

SDK Version

composio==0.9.1

Runtime Environment

3.13.1

Environment

Local Development

Describe the Bug

The Python SDK's MCP.update() method has a parameter mapping bug that causes a TypeError when attempting to update an MCP server with the allowed_tools parameter. 1

Error Message:

TypeError: McpResource.update() got an unexpected keyword argument 'custom_tools'

Root Cause

The bug occurs in python/composio/core/models/mcp.py where the update() method incorrectly maps the allowed_tools parameter to custom_tools

However, the underlying API client's update() method expects the parameter to be named allowed_tools, not custom_tools.

This differs from the create() method, which correctly uses custom_tools because it calls a different endpoint (mcp.custom.create()) that expects that parameter name.

Expected Behavior

The update() method should successfully update the MCP server's allowed tools without throwing a TypeError.

Actual Behavior

A TypeError is raised: McpResource.update() got an unexpected keyword argument 'custom_tools'

Proposed Fix

Change line 373 in python/composio/core/models/mcp.py from:

update_params["custom_tools"] = allowed_tools

to:

update_params["allowed_tools"] = allowed_tools

Additional Context

  • This bug is already documented in the test suite with a skipped test
  • The create() method works correctly because it uses a different endpoint that expects custom_tools
  • The update() method calls self._client.mcp.update() which expects allowed_tools

Steps to Reproduce

  1. Initialize Composio using the Python SDK
  2. Create an MCP server with allowed_tools
  3. Try to update that MCP server with allowed_tools

Minimal Reproducible Example

from composio import Composio  
  
composio = Composio(api_key="YOUR_API_KEY")  
  
# Create an MCP server (this works)  
server = composio.mcp.create(  
    name="test-server",  
    toolkits=["github"],  
    allowed_tools=["GITHUB_CREATE_ISSUE"]  
)  
  
# Try to update the server (this fails)  
composio.mcp.update(  
    server_id=server.id,  
    allowed_tools=["GITHUB_CREATE_ISSUE", "GITHUB_LIST_REPOS"]  
)

Error Output / Stack Trace

TypeError                                 Traceback (most recent call last)
File .venv/lib/python3.13/site-packages/composio/core/models/mcp.py:381, in MCP.update(self, server_id, name, toolkits, manually_manage_connections, allowed_tools)
    380 # Use the MCP update endpoint
--> 381 response = self._client.mcp.update(server_id, **update_params)
    383 return response

TypeError: McpResource.update() got an unexpected keyword argument 'custom_tools'

The above exception was the direct cause of the following exception:

ValidationError                           Traceback (most recent call last)
Cell In[4], line 1
----> 1 composio.mcp.update(  
      2     server_id=server.id,  
      3     allowed_tools=["GITHUB_CREATE_ISSUE", "GITHUB_LIST_REPOS"]  
      4 )

File .venv/lib/python3.13/site-packages/composio/core/models/base.py:63, in trace_method.<locals>.trace_wrapper(self, *args, **kwargs)
     57     payload["error"] = {
     58         "name": e.__class__.__name__,
     59         "message": str(e),
     60         "stack": traceback.format_exc(),
     61     }
     62     event = ("error", payload)
---> 63     raise e
     64 finally:
     65     if event is not None:

File .venv/lib/python3.13/site-packages/composio/core/models/base.py:54, in trace_method.<locals>.trace_wrapper(self, *args, **kwargs)
     38 event = create_event(
     39     type="metric",
     40     functionName=name,
   (...)
     51     },
     52 )
     53 try:
---> 54     return method(self, *args, **kwargs)
     55 except Exception as e:
     56     _, payload = event

File .venv/lib/python3.13/site-packages/composio/core/models/mcp.py:386, in MCP.update(self, server_id, name, toolkits, manually_manage_connections, allowed_tools)
    383     return response
    385 except Exception as e:
--> 386     raise ValidationError(f"Failed to update MCP server {server_id}") from e

ValidationError: Failed to update MCP server 68cf2933-4d41-446d-b3b1-673ac210ed90

Reproducibility

  • Always reproducible
  • Intermittent / Sometimes
  • Happened once, can’t reproduce

Additional Context or Screenshots

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions