Skip to main content
Glama

chat.spaces.messages.search

Search Google Chat messages the user can access and return matching results; use parent spaces/- to search across all accessible spaces.

Instructions

Searches for messages in Google Chat that the calling user has access to. Returns a list of messages matching the search criteria. To search across all spaces the user has access to, set parent to spaces/-. Using any other value for parent results in an INVALID_ARGUMENT error. The returned messages have their name field populated with the full resource name, which includes the specific space in which the message resides. This API doesn't return all message types. The types of messages listed below aren't included in the response. Use ListMessages to list all messages. - Private Mes [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 SearchMessagesRequest object accepting filter, markupSyntax, orderBy, pageSize, pageToken, view; pass it via params or whole via body_file Siblings over the same resource: create, delete, get, list, patch, replaceCards, update.

Input Schema

NameRequiredDescriptionDefault
queryNoExtra KEY=VALUE query pairs for endpoints whose parameters Discovery does not describe.
paramsNoParameter map merged into the request; typed parameters win.
parentYes[URL path segment] Required. The resource name of the space to search within. To search across all spaces the user has access to, set this field to `spaces/-`. Using any other val
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 SearchMessagesRequest object.
request_bodyNoRequest body of type SearchMessagesRequest: pass it via `params` (merged into the built body) or whole via `body_file`.

Output Schema

NameRequiredDescriptionDefault
resultsNo
nextPageTokenNo

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 SearchMessagesRequest object."
    • addedInput schema / properties / request_body
      Added value: +{
      +  "description": "Request body of type SearchMessagesRequest: pass it via `params` (merged into the built body) or whole via `body_file`.",
      +  "properties": {
      +    "filter": {
      +      "type": "string"
      +    },
      +    "markupSyntax": {
      +      "enum": [
      +        "MARKUP_SYNTAX_UNSPECIFIED",
      +        "MARKUP_SYNTAX_CHAT",
      +        "MARKUP_SYNTAX_MARKDOWN"
      +      ],
      +      "type": "string"
      +    },
      +    "orderBy": {
      +      "type": "string"
      +    },
      +    "pageSize": {
      +      "type": "integer"
      +    },
      +    "pageToken": {
      +      "type": "string"
      +    },
      +    "view": {
      +      "enum": [
      +        "SEARCH_MESSAGES_VIEW_UNSPECIFIED",
      +        "SEARCH_MESSAGES_VIEW_BASIC",
      +        "SEARCH_MESSAGES_VIEW_FULL"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed3 schema fields changed
    • changedInput schema / properties / parent / description
      Previous value: -"Required. The resource name of the space to search within. To search across all spaces the user has access to, set this field to `spaces/-`. Using any other val"New value: +"[URL path segment] Required. The resource name of the space to search within. To search across all spaces the user has access to, set this field to `spaces/-`. Using any other val"
    • addedInput schema / properties / parent / pattern
      Added value: +"^spaces/[^/]+$"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "nextPageToken": {
      +      "type": "string"
      +    },
      +    "results": {
      +      "items": {
      +        "properties": {
      +          "message": {
      +            "properties": {
      +              "accessoryWidgets": {
      +                "items": {
      +                  "properties": {
      +                    "buttonList": {
      +                      "type": "object"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "actionResponse": {
      +                "properties": {
      +                  "dialogAction": {
      +                    "type": "object"
      +                  },
      +                  "type": {
      +                    "enum": [
      +                      "TYPE_UNSPECIFIED",
      +                      "NEW_MESSAGE",
      +                      "UPDATE_MESSAGE",
      +                      "UPDATE_USER_MESSAGE_CARDS",
      +                      "REQUEST_CONFIG",
      +                      "DIALOG",
      +                      "UPDATE_WIDGET"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "updatedWidget": {
      +                    "type": "object"
      +                  },
      +                  "url": {
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "annotations": {
      +                "items": {
      +                  "properties": {
      +                    "customEmojiMetadata": {
      +                      "type": "object"
      +                    },
      +                    "length": {
      +                      "type": "integer"
      +                    },
      +                    "richLinkMetadata": {
      +                      "type": "object"
      +                    },
      +                    "slashCommand": {
      +                      "type": "object"
      +                    },
      +                    "startIndex": {
      +                      "type": "integer"
      +                    },
      +                    "type": {
      +                      "enum": [
      +                        "ANNOTATION_TYPE_UNSPECIFIED",
      +                        "USER_MENTION",
      +                        "SLASH_COMMAND",
      +                        "RICH_LINK",
      +                        "CUSTOM_EMOJI"
      +                      ],
      +                      "type": "string"
      +                    },
      +                    "userMention": {
      +                      "type": "object"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "argumentText": {
      +                "type": "string"
      +              },
      +              "attachedGifs": {
      +                "items": {
      +                  "properties": {
      +                    "uri": {
      +                      "type": "string"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "attachment": {
      +                "items": {
      +                  "properties": {
      +                    "attachmentDataRef": {
      +                      "type": "object"
      +                    },
      +                    "contentName": {
      +                      "type": "string"
      +                    },
      +                    "contentType": {
      +                      "type": "string"
      +                    },
      +                    "downloadUri": {
      +                      "type": "string"
      +                    },
      +                    "driveDataRef": {
      +                      "type": "object"
      +                    },
      +                    "name": {
      +                      "type": "string"
      +                    },
      +                    "source": {
      +                      "enum": [
      +                        "SOURCE_UNSPECIFIED",
      +                        "DRIVE_FILE",
      +                        "UPLOADED_CONTENT"
      +                      ],
      +                      "type": "string"
      +                    },
      +                    "thumbnailUri": {
      +                      "type": "string"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "cards": {
      +                "items": {
      +                  "properties": {
      +                    "cardActions": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    },
      +                    "header": {
      +                      "type": "object"
      +                    },
      +                    "name": {
      +                      "type": "string"
      +                    },
      +                    "sections": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "cardsV2": {
      +                "items": {
      +                  "properties": {
      +                    "card": {
      +                      "type": "object"
      +                    },
      +                    "cardId": {
      +                      "type": "string"
      +                    },
      +                    "ownerUser": {
      +                      "type": "object"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "clientAssignedMessageId": {
      +                "type": "string"
      +              },
      +              "createTime": {
      +                "type": "string"
      +              },
      +              "deleteTime": {
      +                "type": "string"
      +              },
      +              "deletionMetadata": {
      +                "properties": {
      +                  "deletionType": {
      +                    "enum": [
      +                      "DELETION_TYPE_UNSPECIFIED",
      +                      "CREATOR",
      +                      "SPACE_OWNER",
      +                      "ADMIN",
      +                      "APP_MESSAGE_EXPIRY",
      +                      "CREATOR_VIA_APP",
      +                      "SPACE_OWNER_VIA_APP",
      +                      "SPACE_MEMBER"
      +                    ],
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "emojiReactionSummaries": {
      +                "items": {
      +                  "properties": {
      +                    "emoji": {
      +                      "type": "object"
      +                    },
      +                    "reactionCount": {
      +                      "type": "integer"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "fallbackText": {
      +                "type": "string"
      +              },
      +              "formattedText": {
      +                "type": "string"
      +              },
      +              "lastUpdateTime": {
      +                "type": "string"
      +              },
      +              "markupSyntax": {
      +                "enum": [
      +                  "MARKUP_SYNTAX_UNSPECIFIED",
      +                  "MARKUP_SYNTAX_CHAT",
      +                  "MARKUP_SYNTAX_MARKDOWN"
      +                ],
      +                "type": "string"
      +              },
      +              "matchedUrl": {
      +                "properties": {
      +                  "url": {
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "name": {
      +                "type": "string"
      +              },
      +              "privateMessageViewer": {
      +                "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"
      +              },
      +              "quotedMessageMetadata": {
      +                "properties": {
      +                  "forwardedMetadata": {
      +                    "type": "object"
      +                  },
      +                  "lastUpdateTime": {
      +                    "type": "string"
      +                  },
      +                  "name": {
      +                    "type": "string"
      +                  },
      +                  "quoteType": {
      +                    "enum": [
      +                      "QUOTE_TYPE_UNSPECIFIED",
      +                      "REPLY",
      +                      "FORWARD"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "quotedMessageSnapshot": {
      +                    "type": "object"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "sender": {
      +                "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"
      +              },
      +              "silent": {
      +                "type": "boolean"
      +              },
      +              "slashCommand": {
      +                "properties": {
      +                  "commandId": {
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "space": {
      +                "properties": {
      +                  "accessSettings": {
      +                    "type": "object"
      +                  },
      +                  "adminInstalled": {
      +                    "type": "boolean"
      +                  },
      +                  "createTime": {
      +                    "type": "string"
      +                  },
      +                  "customer": {
      +                    "type": "string"
      +                  },
      +                  "displayName": {
      +                    "type": "string"
      +                  },
      +                  "externalUserAllowed": {
      +                    "type": "boolean"
      +                  },
      +                  "importMode": {
      +                    "type": "boolean"
      +                  },
      +                  "importModeExpireTime": {
      +                    "type": "string"
      +                  },
      +                  "lastActiveTime": {
      +                    "type": "string"
      +                  },
      +                  "membershipCount": {
      +                    "type": "object"
      +                  },
      +                  "name": {
      +                    "type": "string"
      +                  },
      +                  "permissionSettings": {
      +                    "type": "object"
      +                  },
      +                  "predefinedPermissionSettings": {
      +                    "enum": [
      +                      "PREDEFINED_PERMISSION_SETTINGS_UNSPECIFIED",
      +                      "COLLABORATION_SPACE",
      +                      "ANNOUNCEMENT_SPACE"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "singleUserBotDm": {
      +                    "type": "boolean"
      +                  },
      +                  "spaceDetails": {
      +                    "type": "object"
      +                  },
      +                  "spaceHistoryState": {
      +                    "enum": [
      +                      "HISTORY_STATE_UNSPECIFIED",
      +                      "HISTORY_OFF",
      +                      "HISTORY_ON"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "spaceThreadingState": {
      +                    "enum": [
      +                      "SPACE_THREADING_STATE_UNSPECIFIED",
      +                      "THREADED_MESSAGES",
      +                      "GROUPED_MESSAGES",
      +                      "UNTHREADED_MESSAGES"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "spaceType": {
      +                    "enum": [
      +                      "SPACE_TYPE_UNSPECIFIED",
      +                      "SPACE",
      +                      "GROUP_CHAT",
      +                      "DIRECT_MESSAGE"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "spaceUri": {
      +                    "type": "string"
      +                  },
      +                  "threaded": {
      +                    "type": "boolean"
      +                  },
      +                  "type": {
      +                    "enum": [
      +                      "TYPE_UNSPECIFIED",
      +                      "ROOM",
      +                      "DM"
      +                    ],
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "text": {
      +                "type": "string"
      +              },
      +              "thread": {
      +                "properties": {
      +                  "name": {
      +                    "type": "string"
      +                  },
      +                  "threadKey": {
      +                    "type": "string"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "threadReply": {
      +                "type": "boolean"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "read": {
      +            "type": "boolean"
      +          },
      +          "spaceMuteSetting": {
      +            "enum": [
      +              "MUTE_SETTING_UNSPECIFIED",
      +              "UNMUTED",
      +              "MUTED"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses that this is an HTTP POST that is refused under --readonly profiles, the INVALID_ARGUMENT failure mode for parent, that results carry fully-qualified name fields including the space, and that certain message types are omitted. It loses a point because the omitted-types list is truncated mid-sentence, so the agent never learns which types are missing.

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

Conciseness3/5

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

The core rules are front-loaded, which is good, but the text is bloated with harness meta-commentary ('[HTTP POST] — refused under --readonly safety profiles', 'pass it via params or whole via body_file', 'Siblings over the same resource: ...') and is visibly truncated, leaving a broken enumeration in the middle.

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 search tool with a full output schema, the description covers what matters: scope, the required parent sentinel, the error case, POST/readonly behavior, and the caveat that not all message types are returned. The only informational loss is the truncated type list, which is supplementary rather than essential to calling the tool correctly.

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 coverage is 100%, so the baseline applies; the schema already documents parent, dry_run, body_file, and the nested SearchMessagesRequest fields. The description restates the parent semantics and enumerates the body fields (filter, markupSyntax, orderBy, pageSize, pageToken, view) without adding format or constraint detail beyond what the schema provides.

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?

Opens with a specific verb and resource ('Searches for messages in Google Chat') and scopes it to what the calling user can access, distinct from chat.spaces.messages.list which is named later. The purpose is unmistakable, but the mangled tail ('- Private Mes') and the trailing sibling enumeration dilute the clarity a notch below exemplary.

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

Usage Guidelines5/5

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

Explicitly names the alternative ('Use ListMessages to list all messages') and the condition that selects it, and states the exact routing rule: parent=spaces/- searches everything, any other value yields INVALID_ARGUMENT. It also warns that some message types are never returned, which affects when an agent should pick this over list.

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