Skip to main content
Glama

get_ksef_invoice_status

Retrieve the processing status of a submitted KSeF invoice using the reference number. Pass only the session reference number to get the overall session status.

Instructions

Retrieve the processing status of a submitted KSeF invoice (API v2).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reference_numberYes ("{sessionRef}:{invoiceRef}"). Pass just the sessionRef to retrieve the overall session status instead.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for get_ksef_invoice_status — decorated with @mcp.tool, accepts a reference_number string and delegates to KSeFLifecycleManager.get_document_status.
    @mcp.tool
    async def get_ksef_invoice_status(reference_number: str) -> dict[str, Any]:
        """Retrieve the processing status of a submitted KSeF invoice (API v2).
    
        Parameters
        ----------
        reference_number: The 'reference_number' field from submit_invoice_to_ksef
                          ("{sessionRef}:{invoiceRef}").  Pass just the sessionRef
                          to retrieve the overall session status instead.
        """
        settings = KSeFSettings()
        manager = KSeFLifecycleManager(settings)
        return await manager.get_document_status(reference_number)
  • KSeFLifecycleManager.get_document_status — parses the compound reference (sessionRef:invoiceRef) or session-only reference and dispatches to KSeFClient.get_invoice_status or get_session_status.
    async def get_document_status(self, document_id: str) -> dict[str, Any]:
        """Get the status of a submitted invoice.
    
        Args:
            document_id: Either the compound "{sessionRef}:{invoiceRef}" string
                         returned by submit_document, or just a sessionRef to get
                         the overall session status.
        """
        if ":" in document_id:
            session_ref, invoice_ref = document_id.split(":", 1)
            return await self._client.get_invoice_status(session_ref, invoice_ref)
        return await self._client.get_session_status(document_id)
  • KSeFClient.get_invoice_status — makes a GET request to /sessions/{sessionRef}/invoices/{invoiceRef} and returns the JSON response (the actual KSeF API call to check invoice processing status).
    async def get_invoice_status(
        self,
        session_reference: str,
        invoice_reference: str,
    ) -> dict[str, Any]:
        """GET /sessions/{sessionRef}/invoices/{invoiceRef} — invoice status."""
        response = await self._request(
            "GET",
            f"/sessions/{session_reference}/invoices/{invoice_reference}",
        )
        return response.json()  # type: ignore[no-any-return]
  • Tool registration via @mcp.tool decorator on the get_ksef_invoice_status function (line 142 in server.py) using FastMCP framework — no separate registration file.
    async def get_invoice_status(
        self,
        session_reference: str,
        invoice_reference: str,
    ) -> dict[str, Any]:
        """GET /sessions/{sessionRef}/invoices/{invoiceRef} — invoice status."""
        response = await self._request(
            "GET",
            f"/sessions/{session_reference}/invoices/{invoice_reference}",
        )
        return response.json()  # type: ignore[no-any-return]
Behavior2/5

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

No annotations provided, and the description does not disclose behavioral traits like being read-only, authentication requirements, or any side effects. It merely restates the basic function.

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?

A single, well-structured sentence that conveys the essential information without unnecessary words.

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 simple nature of the tool (one parameter, output schema exists), the description covers the core purpose adequately. It could elaborate on how to interpret the status, but the output schema likely handles that.

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% and the schema parameter description is detailed (explains compound reference). The tool description adds no additional parameter meaning beyond the schema, warranting a baseline of 3.

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 the action ('Retrieve'), the resource ('processing status of a submitted KSeF invoice'), and the API version, making it distinct from sibling tools like submit_invoice_to_ksef or search_ksef_invoices.

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

Usage Guidelines3/5

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

No explicit guidance on when to use this tool vs alternatives (e.g., after submitting an invoice). The purpose is implied but not stated.

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-ksef-pl'

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