Skip to main content
Glama
cmendezs

mcp-facture-electronique-fr

get_flow

Retrieve a flow by its identifier and select the document type: metadata, original, converted, or readable PDF view.

Instructions

Retrieve a flow by its identifier. docType allows choosing between JSON metadata (Metadata), the original document (Original), the converted document (Converted), or the readable representation (ReadableView). By default, returns the JSON metadata (status, dates, identifiers).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flow_idYesFlow identifier assigned by the Approved Platform (returned by submit_flow or search_flows, maxLength 36).
doc_typeNoDocument type to retrieve: Metadata (default, returns the flow's JSON metadata — recommended), Original (original submitted document, returned as base64), Converted (document converted by the AP, returned as base64), ReadableView (human-readable PDF representation, returned as base64).Metadata

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'get_flow'. Defines the async function decorated with @mcp.tool() that accepts flow_id (required) and doc_type (optional, defaults to 'Metadata'). Calls the HTTP client, and if the result is bytes (binary doc types), encodes it as base64 in the response dict.
    @mcp.tool()
    async def get_flow(
        flow_id: Annotated[
            str,
            Field(
                description=(
                    "Flow identifier assigned by the Approved Platform "
                    "(returned by submit_flow or search_flows, maxLength 36)."
                )
            ),
        ],
        doc_type: Annotated[
            str,
            Field(
                default="Metadata",
                description=(
                    "Document type to retrieve: "
                    "Metadata (default, returns the flow's JSON metadata — recommended), "
                    "Original (original submitted document, returned as base64), "
                    "Converted (document converted by the AP, returned as base64), "
                    "ReadableView (human-readable PDF representation, returned as base64)."
                ),
            ),
        ] = "Metadata",
    ) -> dict:
        """
        Retrieve a flow by its identifier. docType allows choosing between
        JSON metadata (Metadata), the original document (Original), the converted
        document (Converted), or the readable representation (ReadableView).
        By default, returns the JSON metadata (status, dates, identifiers).
        """
        client = get_flow_client()
        result = await client.get_flow(flow_id=flow_id, doc_type=doc_type)
    
        if isinstance(result, bytes):
            # Encode as base64 for JSON serialisation
            return {
                "flowId": flow_id,
                "docType": doc_type,
                "contentBase64": base64.b64encode(result).decode(),
            }
        return result
  • Pydantic field definitions for the get_flow tool. flow_id is required (string, maxLength 36). doc_type is optional with a default of 'Metadata', allowing values Metadata, Original, Converted, or ReadableView.
    @mcp.tool()
    async def get_flow(
        flow_id: Annotated[
            str,
            Field(
                description=(
                    "Flow identifier assigned by the Approved Platform "
                    "(returned by submit_flow or search_flows, maxLength 36)."
                )
            ),
        ],
        doc_type: Annotated[
            str,
            Field(
                default="Metadata",
                description=(
                    "Document type to retrieve: "
                    "Metadata (default, returns the flow's JSON metadata — recommended), "
                    "Original (original submitted document, returned as base64), "
                    "Converted (document converted by the AP, returned as base64), "
                    "ReadableView (human-readable PDF representation, returned as base64)."
                ),
            ),
        ] = "Metadata",
  • Helper function that returns a shared singleton FlowClient instance, used by get_flow and all other flow tools.
    def get_flow_client() -> FlowClient:
        global _flow_client
        if _flow_client is None:
            _flow_client = FlowClient()
        return _flow_client
  • The HTTP client method `FlowClient.get_flow()` that makes the actual GET /v1/flows/{flowId} request. For doc_type='Metadata' it returns parsed JSON, otherwise returns raw bytes content.
    async def get_flow(
        self, flow_id: str, doc_type: str = "Metadata"
    ) -> dict[str, Any] | bytes:
        """GET /v1/flows/{flowId} — Retrieve a flow by identifier."""
        response = await self._request(
            "GET", f"/v1/flows/{flow_id}", params={"docType": doc_type}
        )
        if doc_type == "Metadata":
            return response.json()
        return response.content
  • server.py:63-64 (registration)
    The top-level registration call that passes the FastMCP instance to register_flow_tools, which decorates the get_flow function with @mcp.tool().
    register_flow_tools(mcp)
    register_directory_tools(mcp)
Behavior3/5

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

With no annotations provided, the description discloses the behavior of docType options (returning Metadata, Original, Converted, or ReadableView) and mentions that non-Metadata types return base64. However, it omits details like error handling or idempotency, which would be expected for a retrieval tool.

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

Conciseness5/5

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

The description is two sentences long, front-loads the purpose, and every sentence adds value without redundancy or fluff.

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?

Given the tool's simplicity (2 params, output schema exists), the description covers the essential behavior. It could mention error handling or prerequisites (like needing a valid flow ID), but for a basic retrieval, it's largely complete.

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%, but the description adds value by explaining the docType default, listing options, and noting that flow_id comes from sibling tools. It clarifies the meaning beyond the schema's descriptions.

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 clearly states 'Retrieve a flow by its identifier' with specific verb and resource. It also explains the docType options, distinguishing this tool from sibling tools like search_flows (which searches by criteria) or submit_flow (which creates flows).

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?

The description implies usage: use when you have a flow ID from submit_flow or search_flows. It does not explicitly state when not to use or name alternatives, but the context is clear enough for an agent to decide.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cmendezs/mcp-facture-electronique-fr'

If you have feedback or need assistance with the MCP directory API, please join our Discord server