VSCode sends the information to the implemented server for you. For example, the initialize request is sent to the server as soon as the plugin is started on the client-side.
Then, the server would have to build logic to handle the JSON payload sent by the client and return a specific response that conforms to the LSP specifications. I would suggest you turn on tracing in VSCode to see the messages being sent/received by the client and server. For lsp-sample, you can set this setting: "languageServerExample.trace.server": "verbose"
in your package.json
to enable tracing.
In terms of your question regarding function definition text string, I'm assuming you somehow want this in your client code(?) If this is the case, you would have to extract the function definition string in your hover handler, since that's how the server is sending that information over.