MediaParam¶
Mark tool parameters that accept media URIs.
Python¶
mesh.MediaParam()¶
Usage as a type hint on tool parameters:
@mesh.tool(capability="analyzer")
async def analyze(
question: str,
image: mesh.MediaParam("image/*") = None,
document: mesh.MediaParam("application/pdf") = None,
) -> str:
...
| Parameter | Type | Default | Description |
|---|---|---|---|
media_type | str | "*/*" | MIME type pattern to accept |
Effect: Adds x-media-type field to the parameter's JSON schema.
MIME Type Patterns¶
| Pattern | Accepts |
|---|---|
"image/*" | PNG, JPEG, GIF, WebP |
"application/pdf" | PDF documents |
"text/*" | Plain text, CSV, Markdown, HTML |
"*/*" | Any media type |
TypeScript¶
mediaParam()¶
Returns a Zod z.string().optional() schema with media type annotation.
Java¶
@MediaParam¶
import io.mcpmesh.MediaParam;
@MeshTool(capability = "analyzer")
public String analyze(
@Param("question") String question,
@MediaParam("image/*") @Param("image") String imageUri
) { ... }
| Element | Type | Default | Description |
|---|---|---|---|
value | String | "*/*" | MIME type pattern |
Retention: RUNTIME. Target: PARAMETER.
Generated JSON Schema¶
{
"image": {
"type": "string",
"x-media-type": "image/*",
"description": "Media URI for this parameter (accepts media URI: image/*)"
}
}
See Also¶
- MediaParam Guide -- Usage patterns and multi-agent flow