Skip to content

MCP Toolbox HTTP Source - Header Parameter don't allow headers with hyphen. #580

@riaz

Description

@riaz

Prerequisites

  • I've searched the current open issues
  • I've updated to the latest version of Toolbox
  • I've updated to the latest version of the SDK

Toolbox version

0.28.0+Homebrew.darwin.arm64

Environment

  1. OS type and version: (output of uname -a) - Darwin riazs-MacBook-Pro-2.local 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:41 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6031 arm64
  2. How are you running Toolbox:
  • As a downloaded binary (e.g. from curl -O https://storage.googleapis.com/genai-toolbox/v$VERSION/linux/amd64/toolbox) - brew install mcp-toolbox
  • As a container (e.g. from us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:$VERSION)
  • Compiled from source (include the command used to build)
  1. Python version (output of python --version) - 3.12.11
  2. pip version (output of pip --version) - 25.3

Client

  1. Client: .
  2. Version: (pip show <package-name>)? e.g.
  • toolbox-langchain version 0.6.0
  1. Example: If possible, please include your code of configuration:
async with ToolboxClient("http://127.0.0.1:5000", protocol=Protocol.MCP) as toolbox:
    toolbox_tools = toolbox.load_toolset()

  agent = create_agent(
        model,
        tools=toolbox_tools,
        system_prompt=(
            "You are a Question Answering Agent that replies user queries from a known knowledge base"
        ),
        middleware=[SkillMiddleware()],
        checkpointer=InMemorySaver(),
    )
anon-src:
    kind: http
   baseUrl: <vectordb_src_url>
   
retrieve:
    kind: http
    source: anon-src
    method: POST
    path: /get_data
    headers:
      Content-Type: application/json
  
    description: Retrieve relevant content chunks from the vector database based on a query
    requestBody: |
      {
        "message": {
          "role": "user",
          "content": {
            "text": {{json .text}}
          }
        }
      }
    bodyParams:
      - name: text
        description: The query text to retrieve relevant chunks against
        type: string
    headerParams:
       - name: X-Token
         description: Application Token
         type: string
       - name: X-Application-ID
         description: Application ID
        type: string

Expected Behavior

The HeaderParams work as expected in the MCP Inspector , but when loading the ToolBox using the langchain client, I expect to see similar behavior where the LLM can successfully pass the required header params, but i get a error instead - since the headers with - hyphen fail validation.

Current Behavior

118 elif self.has_default:
119 default_value = self.default
--> 121 return Parameter(
122 self.name,
123 Parameter.POSITIONAL_OR_KEYWORD,
124 annotation=self.__get_type(),
125 default=default_value,
126 )

File ~/.pyenv/versions/3.12.11/lib/python3.12/inspect.py:2782, in Parameter.init(self, name, kind, default, annotation)
2780 is_keyword = iskeyword(name) and self._kind is not _POSITIONAL_ONLY
2781 if is_keyword or not name.isidentifier():
-> 2782 raise ValueError('{!r} is not a valid parameter name'.format(name))
2784 self._name = name

ValueError: 'X-Application-ID' is not a valid parameter name

Steps to reproduce?

  1. Create the tools.yaml file that requeires a headerParam which has hyphen in them
  2. Load the tools.yml using toolbox --tools-file tools.yaml
  3. load the tools server using -
    4.async with ToolboxClient("http://127.0.0.1:5000", protocol=Protocol.MCP) as toolbox:
    toolbox_tools = toolbox.load_toolset()
  4. The Step 4, leads to the error above.
    ...

Additional Details

No response

Metadata

Metadata

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions