Skip to content

Tools do not work with Copilot CLI #36

@fmatsos

Description

@fmatsos

Hi!

I got some erreors when my client (Copilot CLI) tries to execute tools from the MCP server.

The server is well configured, with sse connection, using Docker. You can see below that Copilot communicates well with it:

Image

But when I do a prompt to Copilot and it tries to execute a tool, I always have an error despite the model choice (the error changes depending on model):

  • GPT-5: Model call failed: {"message":"Invalid 'tools[52].function.name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_\\.-]+$'.","code":"invalid_value"}
  • Sonnet 4: Model call failed: {"message":"tools.52.custom.name: String should match pattern '^[a-zA-Z0-9_-] 1,128}$'","code":"invalid_request_body"}
  • Sonnet 4.5: Model call failed: "400 400 Bad Request\n"

Below the detailed errors from logs:

Sonnet 4

2025-10-01T08:07:42.530Z [ERROR] {
  "status": 400,
  "headers": {
    "content-length": "12",
    "content-security-policy": "default-src 'none'; sandbox",
    "content-type": "text/plain; charset=utf-8",
    "date": "Wed, 01 Oct 2025 08:07:42 GMT",
    "strict-transport-security": "max-age=31536000",
    "x-content-type-options": "nosniff",
    "x-github-backend": "Kubernetes",
    "x-github-request-id": "EA56:27BEE:BBEBD:DDFE0:68DCE14D",
    "x-request-id": "00000-ee07ab1c-8a11-42df-b8c6-868ce769b709"
  },
  "request_id": "00000-ee07ab1c-8a11-42df-b8c6-868ce769b709",
  "ghRequestId": "EA56:27BEE:BBEBD:DDFE0:68DCE14D",
  "name": "CAPIError"
}

GPT-5

2025-10-01T08:29:53.462Z [ERROR] {
  "status": 400,
  "headers": {
    "content-length": "129",
    "content-security-policy": "default-src 'none'; sandbox",
    "content-type": "text/plain; charset=utf-8",
    "date": "Wed, 01 Oct 2025 08:29:53 GMT",
    "strict-transport-security": "max-age=31536000",
    "x-content-type-options": "nosniff",
    "x-github-backend": "Kubernetes",
    "x-github-request-id": "E6A4:14B8B3:64AB1:76364:68DCE680",
    "x-request-id": "00000-5ddef6ae-093f-4c17-b89d-1463c52fdf67"
  },
  "request_id": "00000-5ddef6ae-093f-4c17-b89d-1463c52fdf67",
  "error": {
    "message": "tools.52.custom.name: String should match pattern '^[a-zA-Z0-9_-]{1,128}$'",
    "code": "invalid_request_body"
  },
  "code": "invalid_request_body",
  "ghRequestId": "E6A4:14B8B3:64AB1:76364:68DCE680",
  "name": "CAPIError"
}

Sonnet 4.5

2025-10-01T08:30:08.768Z [ERROR] {
  "status": 400,
  "headers": {
    "content-length": "179",
    "content-security-policy": "default-src 'none'; sandbox",
    "content-type": "text/plain; charset=utf-8",
    "date": "Wed, 01 Oct 2025 08:30:08 GMT",
    "strict-transport-security": "max-age=31536000",
    "x-content-type-options": "nosniff",
    "x-github-backend": "Kubernetes",
    "x-github-request-id": "B696:1D0275:C873E:E8367:68DCE68F",
    "x-request-id": "00000-5b7623f2-576e-4867-a5ee-dc9eed2e125b"
  },
  "request_id": "00000-5b7623f2-576e-4867-a5ee-dc9eed2e125b",
  "error": {
    "message": "Invalid 'tools[52].function.name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_\\.-]+$'.",
    "code": "invalid_value"
  },
  "code": "invalid_value",
  "ghRequestId": "B696:1D0275:C873E:E8367:68DCE68F",
  "name": "CAPIError"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions