get_resource_download_formats
Retrieve specific resource formats by providing a resource ID and desired format. This tool enables precise downloads of photos, videos, or PSD files from the Freepik FastMCP Toolkit.
Instructions
Retrieve a resource by specifying both the resource ID and the format. This endpoint allows for precise downloading of resources in the desired format.
Path Parameters:
resource-id (Required): Photo, video or PSD resource ID
resource-format (Required): Resource format
Responses:
200 (Success): OK
Content-Type:
application/jsonResponse Properties:
Example:
400: Bad Request - The server could not understand the request due to invalid syntax.
Content-Type:
application/jsonResponse Properties:
Example:
401: Unauthorized - The client must authenticate itself to get the requested response.
Content-Type:
application/jsonResponse Properties:
Example:
403: Forbidden - The client does not have permission to access the requested resource.
Content-Type:
application/jsonResponse Properties:
Example:
404: Not Found - The server can not find the requested resource.
Content-Type:
application/jsonResponse Properties:
Example:
429: Too Many Requests - The client has sent too many requests in a given amount of time.
Content-Type:
application/jsonResponse Properties:
Example:
500: Internal Server Error - The server has encountered a situation it doesn't know how to handle.
Content-Type:
application/jsonResponse Properties:
Example:
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource-format | Yes | Resource format | |
| resource-id | Yes | Photo, video or PSD resource ID |
Implementation Reference
- src/application/server_factory.py:84-90 (registration)Registers the MCP tools from Freepik OpenAPI specification using FastMCP.from_openapi, including the 'get_resource_download_formats' tool via the /v1/resource.* route map.server = FastMCP.from_openapi( openapi_spec=openapi_spec, client=http_client, name=server_config.name, route_maps=route_maps, mcp_component_fn=mcp_component_fn, )
- src/application/route_configuration.py:37-44 (registration)Configures the route map to expose all /v1/resource.* endpoints as MCP tools, which includes the get_resource_download_formats endpoint.RouteMap( methods=[ "GET", "POST", ], pattern=r"/v1/resource.*", mcp_type=MCPType.TOOL, ),
- Loads the OpenAPI specification from Freepik API that defines the input/output schema and operationId for the get_resource_download_formats tool.def load_spec(self) -> dict[str, Any]: """ Load OpenAPI spec with caching. Returns: Dict containing the OpenAPI specification. Raises: Exception: If unable to load the specification. """ cached_spec = self._load_from_cache() if cached_spec is not None: return cached_spec return self._download_and_cache_spec()
- Prepares the OpenAPI spec and route maps used to register the tools, including get_resource_download_formats.spec_loader = OpenApiSpecLoader(cache_config) openapi_spec = spec_loader.load_spec() # Get route configuration route_maps = RouteConfiguration.get_route_maps()