Skip to main content
Glama

SEC Filing MCP Server

helper.cpython-311.pyc2.78 kB
� ^�h��2�ddlZddlZddlZdedefd�Zdedefd�Zdedefd�Zdd �Zed krhe d d d���5Z e � ��Z ddd��n #1swxYwYee ��Z ede �d���edde z �d���dSdS)�N�ticker�returnc���tj�tj�t����}tj�|dd|��}t j|�d���}|S)Nz..�dataz/*.txt)�os�path�dirname�abspath�__file__�join�glob)r� script_dir�data_dir�filess �#/Users/sharhad/mcp/ingest/helper.py�get_sec_filings_filesrsY�����������!:�!:�;�;�J��w�|�|�J��f�f�=�=�H� �I��)�)�)� *� *�E� �L�� file_pathc�~�t|d��5}|���cddd��S#1swxYwYdS)N�r)�open�read)r�fs r�get_sec_filings_file_contentr s~�� �i�� � ����v�v�x�x���������������������s �2�6�6�summaryc��t|d��5}|�|��ddd��dS#1swxYwYdS)N�w)r�write)rrrs r� write_summaryrs��� �i�� � ��� ���������������������������s �4�8�8�text-embedding-3-smallc�v�tj|��}|�|��}t|��}|S)N)�tiktoken�encoding_for_model�encode�len)�text�model�encoding�tokens� num_tokenss r�count_document_tokensr+s4���*�5�1�1�H� �_�_�T� "� "�F��V���J� �r�__main__z$../data/AAPL/AAPL_10K_2024-11-01.txtrzutf-8)r(z Document has z tokenszMax chunk size available: i�z tokens remaining)r )rr r"�strrrrr+�__name__r�filer�doc_text� token_count�print�rr�<module>r4s|�� � � � � � � � ������#��#����� �C��C������3��3��������� �z��� ��4�c�g� N� N� N��RV��9�9�;�;��������������������(�'��1�1�K� �E� .�+� .� .� .�/�/�/� �E� L�t�k�'9� L� L� L�M�M�M�M�M� �s�A�A"�%A"

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/SharhadBashar/SEC-filing-mcp'

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