Skip to main content
Glama
Microsoft 365 MCP Server

Microsoft 365 MCP Server

by Softeria

add-mail-attachment

add-mail-attachment
Destructive

Attach a file to an email message by creating a new attachment with base64-encoded content for files under 3MB.

Instructions

Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachment resource.

šŸ’” TIP: The only path for attachments under 3MB. contentBytes must carry the complete base64 verbatim; a truncated argument fails with 400 UnableToDeserializePostBody. At 3MB and above use create-mail-attachment-upload-session, which rejects anything smaller. Body requires @odata.type: {"@odata.type": "#microsoft.graph.fileAttachment", "name": "file.pdf", "contentBytes": ""}.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "body": "<body>",
      "messageId": "<messageId>"
    },
    "name": "add-mail-attachment"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyYes
confirmNoFor destructive operations when the confirm gate is enabled (MS365_MCP_REQUIRE_CONFIRM=true; off by default). Set to true only after the user has explicitly approved this action. When the gate is on, calls without confirm: true return { error: "confirmation_required" } without touching user data.
messageIdYesValue for the 'messageId' path segment. Pass it under the name 'messageId', not as 'id'. Use the 'id' field of the message object as returned by Microsoft Graph.
includeHeadersNoInclude response headers (including ETag) in the response metadata
excludeResponseNoExclude the full response body and only return success or failure indication

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.176.1
    • removedInput schema / properties / body / properties / lastModifiedDateTime / description
      Removed value: -"The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z"
  2. Changed1 schema field changedv0.134.4
    • changedInput schema / properties / messageId / description
      Previous value: -"Path parameter: messageId"New value: +"Value for the 'messageId' path segment. Pass it under the name 'messageId', not as 'id'. Use the 'id' field of the message object as returned by Microsoft Graph."
  3. Changed1 schema field changedv0.131.2
    • changedInput schema / additionalProperties
      Previous value: -falseNew value: +true
  4. Changed1 schema field changedv0.131.1
    • addedInput schema / properties / confirm
      Added value: +{
      +  "description": "For destructive operations when the confirm gate is enabled (MS365_MCP_REQUIRE_CONFIRM=true; off by default). Set to true only after the user has explicitly approved this action. When the gate is on, calls without confirm: true return { error: \"confirmation_required\" } without touching user data.",
      +  "type": "boolean"
      +}
  5. Addedv0.114.0
  6. Removedv0.112.2
  7. Addedv0.110.0
  8. Removedv0.108.0
  9. First observedv0.31.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and openWorldHint=true, so the safety profile is covered. The description goes beyond them by disclosing a concrete failure mode (truncated contentBytes yields 400 UnableToDeserializePostBody) and the verbatim-base64 requirement, which is real operational guidance. It stops short of discussing message-size effects or permissions, so not a 5.

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 actionable content is well front-loaded in the TIP, but the middle sentences ('An attachment can be one of the following types: All these types...') are truncated doc boilerplate that promises a list it never delivers and wastes the reader's attention.

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

Completeness4/5

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

For a 5-param, nested-body mutation with no output schema, the description covers the essentials: correct payload shape, size threshold routing, and the primary error condition. It leaves response behavior to the includeHeaders/excludeResponse schema fields, which is reasonable. Slightly incomplete on whether an existing attachment with the same name is replaced.

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 80%, but the schema's `body` object does not even declare `@odata.type`, so the description supplies genuinely missing semantics with a concrete payload example ('{"@odata.type": "#microsoft.graph.fileAttachment", "name": ..., "contentBytes": ...}'). It also constrains contentBytes to complete, non-truncated base64. It does not explain confirm/includeHeaders/excludeResponse, but those are documented in the schema.

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 concrete verb+resource ('create a new Attachment') and the TIP makes the actual operation unambiguous: it attaches a base64 file to a mail message. The dangling sentence ('An attachment can be one of the following types:' with no list) is vestigial boilerplate that adds noise but not confusion about the purpose. It also implicitly distinguishes itself from create-mail-attachment-upload-session by the size rule.

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?

Gives an explicit, testable routing rule: under 3MB use this tool, at 3MB and above use create-mail-attachment-upload-session, which 'rejects anything smaller.' That is exactly the when-to-use / when-not-to-use / alternative pattern an agent needs, and it names the sibling directly.

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