Skip to main content
Glama

chat.spaces.messages.replaceCards

Replace cards in an existing Google Chat message with new card content, or pass an empty list to remove app-created cards already present.

Instructions

Replaces the cards included in a message. A Chat app can only replace cards on a human-created message if the message already contains cards, and the cards were created by the app. If the app replaces the cards with an empty list, the cards are removed. After removing the cards, the app cannot add cards back to the message. Requires app authentication with the authorization scope: - https://www.googleapis.com/auth/chat.bot [HTTP POST] — creates or triggers a change; refused under --readonly safety profiles. Returns the API's response resource as JSON — request body is a JSON ReplaceMessageCardsRequest object accepting cardsV2; pass it via params or whole via body_file Siblings over the same resource: create, delete, get, list, patch, search, update.

Input Schema

NameRequiredDescriptionDefault
nameYes[URL path segment] Required. The resource name of the message. Format: `spaces/{space}/messages/{message}`
queryNoExtra KEY=VALUE query pairs for endpoints whose parameters Discovery does not describe.
paramsNoParameter map merged into the request; typed parameters win.
dry_runNoReturn the request that would be sent, without sending it.
body_fileNoRead the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON ReplaceMessageCardsRequest object.
request_bodyNoRequest body of type ReplaceMessageCardsRequest: pass it via `params` (merged into the built body) or whole via `body_file`.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / body_file / description
      Previous value: -"Read the request body from this file ('-' for stdin) instead of building one from the parameters."New value: +"Read the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON ReplaceMessageCardsRequest object."
    • addedInput schema / properties / request_body
      Added value: +{
      +  "description": "Request body of type ReplaceMessageCardsRequest: pass it via `params` (merged into the built body) or whole via `body_file`.",
      +  "properties": {
      +    "cardsV2": {
      +      "items": {
      +        "properties": {
      +          "card": {
      +            "properties": {
      +              "cardActions": {
      +                "items": {
      +                  "properties": {
      +                    "actionLabel": {
      +                      "type": "string"
      +                    },
      +                    "onClick": {
      +                      "type": "object"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "displayStyle": {
      +                "enum": [
      +                  "DISPLAY_STYLE_UNSPECIFIED",
      +                  "PEEK",
      +                  "REPLACE"
      +                ],
      +                "type": "string"
      +              },
      +              "expressionData": {
      +                "items": {
      +                  "properties": {
      +                    "conditions": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    },
      +                    "eventActions": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    },
      +                    "expression": {
      +                      "type": "string"
      +                    },
      +                    "id": {
      +                      "type": "string"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "fixedFooter": {
      +                "properties": {
      +                  "primaryButton": {
      +                    "type": "object"
      +                  },
      +                  "secondaryButton": {
      +                    "type": "object"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "header": {
      +                "properties": {
      +                  "imageAltText": {
      +                    "type": "string"
      +                  },
      +                  "imageType": {
      +                    "enum": [
      +                      "SQUARE",
      +                      "CIRCLE"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "imageUrl": {
      +                    "type": "string"
      +                  },
      +                  "subtitle": {
      +                    "type": "string"
      +                  },
      +                  "title": {
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "name": {
      +                "type": "string"
      +              },
      +              "peekCardHeader": {
      +                "properties": {
      +                  "imageAltText": {
      +                    "type": "string"
      +                  },
      +                  "imageType": {
      +                    "enum": [
      +                      "SQUARE",
      +                      "CIRCLE"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "imageUrl": {
      +                    "type": "string"
      +                  },
      +                  "subtitle": {
      +                    "type": "string"
      +                  },
      +                  "title": {
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "sectionDividerStyle": {
      +                "enum": [
      +                  "DIVIDER_STYLE_UNSPECIFIED",
      +                  "SOLID_DIVIDER",
      +                  "NO_DIVIDER"
      +                ],
      +                "type": "string"
      +              },
      +              "sections": {
      +                "items": {
      +                  "properties": {
      +                    "collapseControl": {
      +                      "type": "object"
      +                    },
      +                    "collapsible": {
      +                      "type": "boolean"
      +                    },
      +                    "header": {
      +                      "type": "string"
      +                    },
      +                    "id": {
      +                      "type": "string"
      +                    },
      +                    "uncollapsibleWidgetsCount": {
      +                      "type": "integer"
      +                    },
      +                    "widgets": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "cardId": {
      +            "type": "string"
      +          },
      +          "ownerUser": {
      +            "properties": {
      +              "avatarUrl": {
      +                "type": "string"
      +              },
      +              "displayName": {
      +                "type": "string"
      +              },
      +              "domainId": {
      +                "type": "string"
      +              },
      +              "email": {
      +                "type": "string"
      +              },
      +              "isAnonymous": {
      +                "type": "boolean"
      +              },
      +              "name": {
      +                "type": "string"
      +              },
      +              "type": {
      +                "enum": [
      +                  "TYPE_UNSPECIFIED",
      +                  "HUMAN",
      +                  "BOT"
      +                ],
      +                "type": "string"
      +              }
      +            },
      +            "type": "object"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed3 schema fields changed
    • changedInput schema / properties / name / description
      Previous value: -"Required. The resource name of the message. Format: `spaces/{space}/messages/{message}`"New value: +"[URL path segment] Required. The resource name of the message. Format: `spaces/{space}/messages/{message}`"
    • addedInput schema / properties / name / pattern
      Added value: +"^spaces/[^/]+/messages/[^/]+$"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so: app authentication plus the exact OAuth scope, HTTP POST semantics, refusal under --readonly safety profiles, and the irreversible consequence of passing an empty card list. That is precisely the destructive/one-way information an agent needs before invoking a mutation.

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?

Front-loaded with the purpose, then preconditions, then auth, then transport behavior. Dense but nearly every sentence carries operational weight; the bracketed HTTP POST / readonly-profile aside is the only mildly mechanical addition, and it is still useful.

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

Completeness5/5

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

For a mutation tool with six parameters, deep nested card objects, and no annotations, the description covers preconditions, auth scope, reversibility, and body construction. Return values are covered by the existing output schema, so nothing material is missing.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds real value by identifying the body type (ReplaceMessageCardsRequest accepting cardsV2) and explaining the two delivery paths — merged via `params` or supplied whole via `body_file` — which the schema alone only hints at.

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

Purpose5/5

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

States a specific verb and narrow resource slice: 'Replaces the cards included in a message.' The word 'cards' plus the explicit sibling list (create, delete, get, list, patch, search, update) makes it distinguishable from chat.spaces.messages.patch and update without opening either schema.

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

Usage Guidelines4/5

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

Gives explicit preconditions for use: the message must be human-created, must already contain cards, and those cards must have been created by the calling app. It also warns that emptying the list is a one-way door ('cannot add cards back'). It stops short of naming a concrete alternative tool for the non-card case, which keeps it below a 5.

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

Deploy Server

Other Tools