Skip to main content
Glama
Microsoft 365 MCP Server

Microsoft 365 MCP Server

by Softeria

get-upload-url

Creates a short-lived, single-use upload URL so files upload directly to Microsoft Graph for draft message/event attachments or OneDrive/SharePoint folders, avoiding base64 transfer through the agent.

Instructions

Mint a short-lived, single-use URL that this server serves for uploading a file as an attachment to a draft message or an event, or as a file in a OneDrive/SharePoint folder, so the bytes go straight from the caller to Microsoft Graph instead of passing as base64 through the agent context. target is the attachments collection of the item: /me/messages/{message-id}/attachments (a draft; create it first) or /me/events/{event-id}/attachments; or a drive folder: /me/drive/root, /me/drive/items/{folder-id}, /drives/{drive-id}/items/{folder-id}, /sites/{site-id}/drive/items/{folder-id}. PUT the raw file bytes to the returned uploadUrl with a Content-Length (e.g. curl -T file ""); the response confirms the upload. Up to 150 MB. Pass contentId to attach inline, e.g. a signature picture the HTML body shows with . For a drive folder, conflictBehavior says what happens when the name is taken (default fail; contentId does not apply). Requires --enable-attachment-urls. Returns { uploadUrl, method, expiresAt, singleUse, maxBytes, name, conflictBehavior? }. For several files, pass files (up to 20 entries of target, name and the optional fields) instead: one call returns { results: [...] }, one item per entry with its uploadUrl or its error. The links expire minutes after minting, so start every upload right away, in parallel or in one command.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get-upload-url"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoFile name as it will be stored, e.g. report.pdf: the attachment name, or the file name in the drive folder.
filesNoSeveral files at once, instead of target and name: up to 20 entries, each with the fields of a single upload.
targetNoAttachments collection of a draft message or an event, e.g. /me/messages/{message-id}/attachments, /me/events/{event-id}/attachments, or /users/{user-id}/messages/{message-id}/attachments for another mailbox. Or a OneDrive/SharePoint folder: /me/drive/root, /me/drive/items/{folder-id}, /drives/{drive-id}/items/{folder-id}, /sites/{site-id}/drive/items/{folder-id}.
contentIdNoAttach inline under this Content-ID instead of as a regular attachment, so the HTML body can show the file with <img src="cid:<contentId>">, e.g. a picture in an email signature. Letters, digits, ".", "_", "@", "-".
contentTypeNoMIME type of the file, e.g. application/pdf. Defaults to application/octet-stream.
conflictBehaviorNoDrive folder targets only: what happens when the folder already has a file with this name. fail (default), replace, or rename.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.190.2
    • addedInput schema / properties / files
      Added value: +{
      +  "description": "Several files at once, instead of target and name: up to 20 entries, each with the fields of a single upload.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "conflictBehavior": {
      +        "description": "Drive folder targets only: what happens when the folder already has a file with this name. fail (default), replace, or rename.",
      +        "enum": [
      +          "fail",
      +          "replace",
      +          "rename"
      +        ],
      +        "type": "string"
      +      },
      +      "contentId": {
      +        "description": "Attach inline under this Content-ID instead of as a regular attachment, so the HTML body can show the file with <img src=\"cid:<contentId>\">, e.g. a picture in an email signature. Letters, digits, \".\", \"_\", \"@\", \"-\".",
      +        "type": "string"
      +      },
      +      "contentType": {
      +        "description": "MIME type of the file, e.g. application/pdf. Defaults to application/octet-stream.",
      +        "type": "string"
      +      },
      +      "name": {
      +        "description": "File name as it will be stored, e.g. report.pdf: the attachment name, or the file name in the drive folder.",
      +        "type": "string"
      +      },
      +      "target": {
      +        "description": "Attachments collection of a draft message or an event, e.g. /me/messages/{message-id}/attachments, /me/events/{event-id}/attachments, or /users/{user-id}/messages/{message-id}/attachments for another mailbox. Or a OneDrive/SharePoint folder: /me/drive/root, /me/drive/items/{folder-id}, /drives/{drive-id}/items/{folder-id}, /sites/{site-id}/drive/items/{folder-id}.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "target",
      +      "name"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 20,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "target",
      -  "name"
      -]
  2. Changed3 schema fields changedv0.184.0
    • addedInput schema / properties / conflictBehavior
      Added value: +{
      +  "description": "Drive folder targets only: what happens when the folder already has a file with this name. fail (default), replace, or rename.",
      +  "enum": [
      +    "fail",
      +    "replace",
      +    "rename"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / name / description
      Previous value: -"Attachment file name as the recipient will see it, e.g. report.pdf"New value: +"File name as it will be stored, e.g. report.pdf: the attachment name, or the file name in the drive folder."
    • changedInput schema / properties / target / description
      Previous value: -"Attachments collection of a draft message or an event, e.g. /me/messages/{message-id}/attachments, /me/events/{event-id}/attachments, or /users/{user-id}/messages/{message-id}/attachments for another mailbox."New value: +"Attachments collection of a draft message or an event, e.g. /me/messages/{message-id}/attachments, /me/events/{event-id}/attachments, or /users/{user-id}/messages/{message-id}/attachments for another mailbox. Or a OneDrive/SharePoint folder: /me/drive/root, /me/drive/items/{folder-id}, /drives/{drive-id}/items/{folder-id}, /sites/{site-id}/drive/items/{folder-id}."
  3. Changed1 schema field changedv0.178.0
    • changedInput schema / properties / target / description
      Previous value: -"Attachments collection of a draft message or an event, e.g. /me/messages/{message-id}/attachments or /me/events/{event-id}/attachments."New value: +"Attachments collection of a draft message or an event, e.g. /me/messages/{message-id}/attachments, /me/events/{event-id}/attachments, or /users/{user-id}/messages/{message-id}/attachments for another mailbox."
  4. Changed1 schema field changedv0.175.0
    • addedInput schema / properties / contentId
      Added value: +{
      +  "description": "Attach inline under this Content-ID instead of as a regular attachment, so the HTML body can show the file with <img src=\"cid:<contentId>\">, e.g. a picture in an email signature. Letters, digits, \".\", \"_\", \"@\", \"-\".",
      +  "type": "string"
      +}
  5. Addedv0.166.0

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the readOnlyHint=false / openWorldHint=true annotations, the description discloses a lot of non-obvious behavior: short expiry, single-use semantics, a 150 MB cap, the required PUT with Content-Length and a curl example, the default conflictBehavior of fail, the fact that contentId is ignored for drive folders, and the feature flag gating. It also describes the return payload and the per-item error shape for batch calls.

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 purpose and constraints are front-loaded, but the body is a single dense paragraph with examples, path templates, and return shapes stacked together, and the closing line about parallelism is buried. Every sentence does add information, yet chunking the target formats and the batch mode into separate sentences or a short list would make it noticeably easier to parse.

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?

There is no output schema, so the description must carry the return contract, and it does: { uploadUrl, method, expiresAt, singleUse, maxBytes, name, conflictBehavior? } plus { results: [...] } with per-item errors for the batch path. Feature-flag gating, size limits, expiry, and the follow-up PUT step are all covered, which is complete for a tool of this complexity.

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 already 100%, so the baseline is 3, and the description earns more by adding intent the schema cannot: target must point at an existing draft (create it first), contentId produces a cid: reference usable in an HTML body, conflictBehavior applies only to drive folders, and files is a batch alternative to target/name with one result per entry. Some value is duplication of the schema, which caps it at 4 rather than 5.

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?

The description opens with a specific verb and artifact: 'Mint a short-lived, single-use URL that this server serves for uploading a file'. It enumerates exactly the three upload destinations (draft message attachment, event attachment, OneDrive/SharePoint folder) and the reason for its existence (bytes bypass the agent context instead of base64), which separates it from plain upload-file-content or create-upload-session siblings.

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?

It states clear preconditions and sequencing: the draft message must be created first, the server must run with --enable-attachment-urls, uploads must start immediately because links expire in minutes, and files should be batched (up to 20) rather than looping. It never names a sibling as the alternative for simpler cases, so the agent must infer when to prefer upload-file-content, which keeps this 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